diff options
Diffstat (limited to 'vespalog/src/test/java')
11 files changed, 58 insertions, 6 deletions
diff --git a/vespalog/src/test/java/com/yahoo/log/FileLogTargetTest.java b/vespalog/src/test/java/com/yahoo/log/FileLogTargetTest.java index 34d8ec33093..5bcf2b76fdf 100644 --- a/vespalog/src/test/java/com/yahoo/log/FileLogTargetTest.java +++ b/vespalog/src/test/java/com/yahoo/log/FileLogTargetTest.java @@ -16,6 +16,7 @@ import static org.junit.Assert.assertTrue; * @author Ulf Lilleengen * @since 5.1 */ +@SuppressWarnings("removal") public class FileLogTargetTest { @Test(expected = RuntimeException.class) public void requireThatExceptionIsThrowIfFileNotFound() throws IOException { diff --git a/vespalog/src/test/java/com/yahoo/log/LogSetupTestCase.java b/vespalog/src/test/java/com/yahoo/log/LogSetupTestCase.java index 6b0912a78d5..a8dc6e3e8e9 100644 --- a/vespalog/src/test/java/com/yahoo/log/LogSetupTestCase.java +++ b/vespalog/src/test/java/com/yahoo/log/LogSetupTestCase.java @@ -1,6 +1,8 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.log; +import com.yahoo.log.impl.LogUtils; + import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -23,6 +25,7 @@ import static org.junit.Assert.assertTrue; * * @author Bjorn Borud */ +@SuppressWarnings("removal") public class LogSetupTestCase { // For testing zookeeper log records protected static LogRecord zookeeperLogRecord; @@ -51,8 +54,8 @@ public class LogSetupTestCase { curatorLogRecord.setLoggerName("org.apache.curator.utils.DefaultTracerDriver"); curatorLogRecord.setInstant(Instant.ofEpochMilli(1107011348029L)); - hostname = Util.getHostName(); - pid = Util.getPID(); + hostname = LogUtils.getHostName(); + pid = LogUtils.getPID(); zookeeperLogRecordString = "1107011348.029000\t" + hostname diff --git a/vespalog/src/test/java/com/yahoo/log/LogUtilTest.java b/vespalog/src/test/java/com/yahoo/log/LogUtilTest.java index 96717e9ac88..4a5c59a18cb 100644 --- a/vespalog/src/test/java/com/yahoo/log/LogUtilTest.java +++ b/vespalog/src/test/java/com/yahoo/log/LogUtilTest.java @@ -10,6 +10,7 @@ import static org.junit.Assert.assertFalse; * @author Ulf Lilleengen * @since 5.1 */ +@SuppressWarnings("removal") public class LogUtilTest { @Test public void testEmpty() { diff --git a/vespalog/src/test/java/com/yahoo/log/RejectFilterTest.java b/vespalog/src/test/java/com/yahoo/log/RejectFilterTest.java index 311359a37a0..3bce09801a1 100644 --- a/vespalog/src/test/java/com/yahoo/log/RejectFilterTest.java +++ b/vespalog/src/test/java/com/yahoo/log/RejectFilterTest.java @@ -10,6 +10,7 @@ import static org.junit.Assert.assertTrue; * @author Ulf Lilleengen * @since 5.1 */ +@SuppressWarnings("removal") public class RejectFilterTest { @Test public void testBasicPatternMatching() { diff --git a/vespalog/src/test/java/com/yahoo/log/UncloseableOutputStreamTestCase.java b/vespalog/src/test/java/com/yahoo/log/UncloseableOutputStreamTestCase.java index 95889a01e67..4b0e6622c1e 100644 --- a/vespalog/src/test/java/com/yahoo/log/UncloseableOutputStreamTestCase.java +++ b/vespalog/src/test/java/com/yahoo/log/UncloseableOutputStreamTestCase.java @@ -10,6 +10,7 @@ import java.io.OutputStream; /** * @author Simon Thoresen Hult */ +@SuppressWarnings("removal") public class UncloseableOutputStreamTestCase { @Test diff --git a/vespalog/src/test/java/com/yahoo/log/UtilTestCase.java b/vespalog/src/test/java/com/yahoo/log/UtilTestCase.java index 096672d8858..75294f67fb3 100644 --- a/vespalog/src/test/java/com/yahoo/log/UtilTestCase.java +++ b/vespalog/src/test/java/com/yahoo/log/UtilTestCase.java @@ -8,6 +8,7 @@ import static org.junit.Assert.*; /** * @author Bjorn Borud */ +@SuppressWarnings("removal") public class UtilTestCase { /** diff --git a/vespalog/src/test/java/com/yahoo/log/VespaFormatterTestCase.java b/vespalog/src/test/java/com/yahoo/log/VespaFormatterTestCase.java index 913bcafdd44..3a986ccede3 100644 --- a/vespalog/src/test/java/com/yahoo/log/VespaFormatterTestCase.java +++ b/vespalog/src/test/java/com/yahoo/log/VespaFormatterTestCase.java @@ -1,6 +1,8 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.log; +import com.yahoo.log.impl.LogUtils; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -17,6 +19,7 @@ import static org.junit.Assert.fail; /** * @author Bjorn Borud */ +@SuppressWarnings("removal") public class VespaFormatterTestCase { private String hostname; @@ -33,8 +36,8 @@ public class VespaFormatterTestCase { @Before public void setUp () { - hostname = Util.getHostName(); - pid = Util.getPID(); + hostname = LogUtils.getHostName(); + pid = LogUtils.getPID(); testRecord1 = new LogRecord(Level.INFO, "this is a test"); testRecord1.setInstant(Instant.ofEpochMilli(1098709021843L)); diff --git a/vespalog/src/test/java/com/yahoo/log/VespaLevelControllerRepoTest.java b/vespalog/src/test/java/com/yahoo/log/VespaLevelControllerRepoTest.java index 264938fcd24..57f5424f4c2 100644 --- a/vespalog/src/test/java/com/yahoo/log/VespaLevelControllerRepoTest.java +++ b/vespalog/src/test/java/com/yahoo/log/VespaLevelControllerRepoTest.java @@ -18,6 +18,7 @@ import static org.junit.Assert.assertTrue; * @author Ulf Lilleengen * @since 5.1 */ +@SuppressWarnings("removal") public class VespaLevelControllerRepoTest { static int findControlString(RandomAccessFile f, String s) { diff --git a/vespalog/src/test/java/com/yahoo/log/VespaLogHandlerTestCase.java b/vespalog/src/test/java/com/yahoo/log/VespaLogHandlerTestCase.java index 9b2af866f65..77d7fa66bb6 100644 --- a/vespalog/src/test/java/com/yahoo/log/VespaLogHandlerTestCase.java +++ b/vespalog/src/test/java/com/yahoo/log/VespaLogHandlerTestCase.java @@ -1,6 +1,8 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.log; +import com.yahoo.log.impl.LogUtils; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -30,6 +32,7 @@ import static org.junit.Assert.fail; /** * @author Bjorn Borud */ +@SuppressWarnings("removal") public class VespaLogHandlerTestCase { private final static String hostname; private final static String pid; @@ -47,8 +50,8 @@ public class VespaLogHandlerTestCase { private static final String record4String; static { - hostname = Util.getHostName(); - pid = Util.getPID(); + hostname = LogUtils.getHostName(); + pid = LogUtils.getPID(); record1 = new LogRecord(Level.INFO, "This is a test"); record1.setInstant(ofEpochSecond(1100011348L, 29_123_543)); diff --git a/vespalog/src/test/java/com/yahoo/log/event/EventTestCase.java b/vespalog/src/test/java/com/yahoo/log/event/EventTestCase.java index b3890f860c9..045c7cd874f 100644 --- a/vespalog/src/test/java/com/yahoo/log/event/EventTestCase.java +++ b/vespalog/src/test/java/com/yahoo/log/event/EventTestCase.java @@ -13,6 +13,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +@SuppressWarnings("removal") public class EventTestCase { Count countEvent; diff --git a/vespalog/src/test/java/com/yahoo/log/impl/LogUtilsTest.java b/vespalog/src/test/java/com/yahoo/log/impl/LogUtilsTest.java new file mode 100644 index 00000000000..76998395e12 --- /dev/null +++ b/vespalog/src/test/java/com/yahoo/log/impl/LogUtilsTest.java @@ -0,0 +1,36 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.log.impl; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; + +/** + * @author Ulf Lilleengen + * @author Bjorn Borud + */ +public class LogUtilsTest { + + @Test + public void testEmpty() { + assertTrue(LogUtils.empty(null)); + assertTrue(LogUtils.empty("")); + assertFalse(LogUtils.empty("f")); + assertFalse(LogUtils.empty("fo")); + assertFalse(LogUtils.empty("foo")); + } + + /** + * Just make sure the static getHostName() method returns something + * that looks half sensible. + */ + @Test + public void testSimple () { + String name = LogUtils.getHostName(); + assertNotNull(name); + assertFalse(name.equals("")); + } + +} |