Skip to content

Commit b75c9aa

Browse files
authored
remove unused parameter (GoogleCloudPlatform#3402)
* remove unused parameter * Update tests
1 parent 35cf56e commit b75c9aa

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

logging/cloud-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<configuration>
6868
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
6969
<forkCount>3</forkCount>
70-
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
70+
<argLine>-Xmx1024m</argLine>
7171
</configuration>
7272
<executions>
7373
<execution>

logging/cloud-client/src/main/java/com/example/logging/ListLogs.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
import com.google.cloud.logging.Logging.EntryListOption;
2323
import com.google.cloud.logging.LoggingOptions;
2424

25-
/**
26-
* List logs programmatically using the StackDriver Logging API.
27-
*/
25+
/** List logs programmatically using the StackDriver Logging API. */
2826
public class ListLogs {
2927

3028
/** Expects an existing Stackdriver log name as an argument. */
@@ -40,15 +38,13 @@ public static void main(String... args) throws Exception {
4038
String logFilter = "logName=projects/" + options.getProjectId() + "/logs/" + logName;
4139

4240
// List all log entries
43-
Page<LogEntry> entries = logging.listLogEntries(
44-
EntryListOption.filter(logFilter));
41+
Page<LogEntry> entries = logging.listLogEntries(EntryListOption.filter(logFilter));
4542
do {
4643
for (LogEntry logEntry : entries.iterateAll()) {
4744
System.out.println(logEntry);
4845
}
4946
entries = entries.getNextPage();
5047
} while (entries != null);
51-
5248
}
5349
// [END logging_list_log_entries]
5450
}

logging/cloud-client/src/test/java/com/example/logging/LoggingIT.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@
2626
import java.io.ByteArrayOutputStream;
2727
import java.io.PrintStream;
2828
import java.util.Collections;
29-
import org.junit.After;
29+
import org.junit.AfterClass;
3030
import org.junit.Before;
3131
import org.junit.Test;
3232
import org.junit.runner.RunWith;
3333
import org.junit.runners.JUnit4;
3434

35-
/**
36-
* Tests for quickstart sample.
37-
*/
35+
/** Tests for quickstart sample. */
3836
@RunWith(JUnit4.class)
3937
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4038
public class LoggingIT {
@@ -44,9 +42,9 @@ public class LoggingIT {
4442

4543
private ByteArrayOutputStream bout;
4644
private PrintStream out;
47-
private Logging logging = LoggingOptions.getDefaultInstance().getService();
45+
private static Logging logging = LoggingOptions.getDefaultInstance().getService();
4846

49-
private void deleteLog(String logName) {
47+
private static void deleteLog(String logName) {
5048
logging.deleteLog(logName);
5149
}
5250

@@ -57,8 +55,8 @@ public void setUp() {
5755
System.setOut(out);
5856
}
5957

60-
@After
61-
public void tearDown() {
58+
@AfterClass
59+
public static void tearDown() {
6260
// Clean up created logs
6361
deleteLog(QUICKSTART_LOG);
6462
deleteLog(TEST_WRITE_LOG);
@@ -73,13 +71,14 @@ public void testQuickstart() throws Exception {
7371
assertThat(got).contains("Logged: Hello, world!");
7472
}
7573

76-
@Test(timeout = 60000)
74+
@Test(timeout = 30000)
7775
public void testWriteAndListLogs() throws Exception {
7876
// write a log entry
79-
LogEntry entry = LogEntry.newBuilder(StringPayload.of("Hello world again"))
80-
.setLogName(TEST_WRITE_LOG)
81-
.setResource(MonitoredResource.newBuilder("global").build())
82-
.build();
77+
LogEntry entry =
78+
LogEntry.newBuilder(StringPayload.of("Hello world again"))
79+
.setLogName(TEST_WRITE_LOG)
80+
.setResource(MonitoredResource.newBuilder("global").build())
81+
.build();
8382
logging.write(Collections.singleton(entry));
8483
// flush out log immediately
8584
logging.flush();

0 commit comments

Comments
 (0)