Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions monitoring/src/main/java/CloudMonitoringAuthSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ private static CloudMonitoring authenticate()
* @throws Exception if something goes wrong.
*/
public static void main(final String[] args) throws Exception {
if (args.length != 2) {
System.err.println(String.format("Usage: %s <project-name>", args[0]));
if (args.length != 1) {
System.err.println(String.format("Usage: %s <project-name>",
CloudMonitoringAuthSample.class.getSimpleName()));
return;
}

String project = args[1];
String project = args[0];

// Create an authorized API client
CloudMonitoring cloudmonitoring = authenticate();
Expand Down
6 changes: 3 additions & 3 deletions monitoring/src/test/java/CloudMonitoringAuthSampleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public void tearDown() {

@Test
public void testUsage() throws Exception {
CloudMonitoringAuthSample.main(new String[] { "command-name" });
assertEquals("Usage: command-name <project-name>\n", stderr.toString());
CloudMonitoringAuthSample.main(new String[] { });
assertEquals("Usage: CloudMonitoringAuthSample <project-name>\n", stderr.toString());
}

@Test
public void testListTimeSeries() throws Exception {
CloudMonitoringAuthSample.main(new String[] { "", "cloud-samples-tests" });
CloudMonitoringAuthSample.main(new String[] { "cloud-samples-tests" });
String out = stdout.toString();
assertThat(out, containsPattern("Timeseries.list raw response:"));
assertThat(out, containsPattern("\\{\\s*\"kind\" *: *\"cloudmonitoring#listTimeseriesResponse\","));
Expand Down