diff options
author | Arne H Juul <arnej@yahoo-inc.com> | 2017-04-20 15:07:35 +0200 |
---|---|---|
committer | Arne H Juul <arnej@yahoo-inc.com> | 2017-04-20 15:17:35 +0200 |
commit | 88a760736b35e0b388081499ee02dcbaee6677d7 (patch) | |
tree | 674df4d0ecc7cb461b5d57974055ae3294192622 /jdisc_core/src/test | |
parent | 952c3c64a26679a8b75136723361059898848cf4 (diff) |
fix or suppress warnings
Diffstat (limited to 'jdisc_core/src/test')
8 files changed, 23 insertions, 21 deletions
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingRepositoryTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingRepositoryTestCase.java index aa9bc783b74..41807513991 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingRepositoryTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingRepositoryTestCase.java @@ -87,7 +87,7 @@ public class BindingRepositoryTestCase { bindings.bind(pattern, originallyBoundHandler); bindings.bind(pattern, new PatternStealingRequestHandler()); - BindingSet bindingSet = bindings.activate(); + BindingSet<?> bindingSet = bindings.activate(); assertEquals(originallyBoundHandler, bindingSet.resolve(URI.create(pattern))); } diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerBuilderTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerBuilderTestCase.java index 811f8fa901b..3591d6dc165 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerBuilderTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerBuilderTestCase.java @@ -74,7 +74,7 @@ public class ContainerBuilderTestCase { public void requireThatBindingSetsAreCreatedOnDemand() { TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); ContainerBuilder builder = driver.newContainerBuilder(); - BindingRepository repo = builder.serverBindings("foo"); + BindingRepository<?> repo = builder.serverBindings("foo"); assertNotNull(repo); assertSame(repo, builder.serverBindings("foo")); assertNotNull(repo = builder.serverBindings("bar")); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java index 77af705cfac..bf3e285e3aa 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java @@ -25,7 +25,7 @@ public class ApplicationEnvironmentModuleTestCase { @Test public void requireThatBindingsExist() { - List<Class> expected = new LinkedList<>(); + List<Class<?>> expected = new LinkedList<>(); expected.add(ContainerActivator.class); expected.add(ContainerBuilder.class); expected.add(CurrentContainer.class); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.java index 901817dbd26..7871694c12d 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.java @@ -211,7 +211,7 @@ public class ConsoleLogFormatterTestCase { final int level; final long time; Bundle bundle = null; - ServiceReference serviceReference = null; + ServiceReference<?> serviceReference = null; Throwable exception; MyEntry(long time, int level, String message) { @@ -263,7 +263,7 @@ public class ConsoleLogFormatterTestCase { } @Override - public ServiceReference getServiceReference() { + public ServiceReference<?> getServiceReference() { return serviceReference; } } diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.java index 3ac30f0456e..502b3857024 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.java @@ -108,7 +108,7 @@ public class ConsoleLogListenerTestCase { } @Override - public ServiceReference getServiceReference() { + public ServiceReference<?> getServiceReference() { return null; } } diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java index eb18e6f8e49..1904c05d135 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java @@ -90,7 +90,7 @@ public class OsgiLogHandlerTestCase { record.setThrown(thrown); log.log(record); - ServiceReference ref = logService.lastServiceReference; + ServiceReference<?> ref = logService.lastServiceReference; assertNotNull(ref); assertTrue(Arrays.equals(new String[] { "LEVEL", "LOGGER_NAME", @@ -146,9 +146,10 @@ public class OsgiLogHandlerTestCase { } } + @SuppressWarnings("rawtypes") private static class MyLogService implements LogService { - ServiceReference lastServiceReference; + ServiceReference<?> lastServiceReference; int lastLevel; String lastMessage; Throwable lastThrowable; diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java index 32e4b37aca8..ba31a5da118 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java @@ -41,11 +41,11 @@ public class OsgiLogManagerTestCase { manager.log(4, "b", t1); assertLast(service, null, 4, "b", t1); - ServiceReference ref1 = Mockito.mock(ServiceReference.class); + ServiceReference<?> ref1 = Mockito.mock(ServiceReference.class); manager.log(ref1, 8, "c"); assertLast(service, ref1, 8, "c", null); - ServiceReference ref2 = Mockito.mock(ServiceReference.class); + ServiceReference<?> ref2 = Mockito.mock(ServiceReference.class); Throwable t2 = new Throwable(); manager.log(ref2, 16, "d", t2); assertLast(service, ref2, 16, "d", t2); @@ -66,7 +66,7 @@ public class OsgiLogManagerTestCase { OsgiLogManager manager = new OsgiLogManager(true); manager.install(ctx); - ServiceReference ref1 = Mockito.mock(ServiceReference.class); + ServiceReference<?> ref1 = Mockito.mock(ServiceReference.class); Throwable t1 = new Throwable(); manager.log(ref1, 2, "a", t1); assertLast(foo, ref1, 2, "a", t1); @@ -74,7 +74,7 @@ public class OsgiLogManagerTestCase { MyLogService bar = new MyLogService(); ServiceRegistration<LogService> barReg = ctx.registerService(LogService.class, bar, null); - ServiceReference ref2 = Mockito.mock(ServiceReference.class); + ServiceReference<?> ref2 = Mockito.mock(ServiceReference.class); Throwable t2 = new Throwable(); manager.log(ref2, 4, "b", t2); assertLast(foo, ref2, 4, "b", t2); @@ -83,7 +83,7 @@ public class OsgiLogManagerTestCase { MyLogService baz = new MyLogService(); ServiceRegistration<LogService> bazReg = ctx.registerService(LogService.class, baz, null); - ServiceReference ref3 = Mockito.mock(ServiceReference.class); + ServiceReference<?> ref3 = Mockito.mock(ServiceReference.class); Throwable t3 = new Throwable(); manager.log(ref3, 8, "c", t3); assertLast(foo, ref3, 8, "c", t3); @@ -92,7 +92,7 @@ public class OsgiLogManagerTestCase { fooReg.unregister(); - ServiceReference ref4 = Mockito.mock(ServiceReference.class); + ServiceReference<?> ref4 = Mockito.mock(ServiceReference.class); Throwable t4 = new Throwable(); manager.log(ref4, 16, "d", t4); assertLast(foo, ref3, 8, "c", t3); @@ -101,7 +101,7 @@ public class OsgiLogManagerTestCase { barReg.unregister(); - ServiceReference ref5 = Mockito.mock(ServiceReference.class); + ServiceReference<?> ref5 = Mockito.mock(ServiceReference.class); Throwable t5 = new Throwable(); manager.log(ref5, 32, "e", t5); assertLast(foo, ref3, 8, "c", t3); @@ -110,7 +110,7 @@ public class OsgiLogManagerTestCase { bazReg.unregister(); - ServiceReference ref6 = Mockito.mock(ServiceReference.class); + ServiceReference<?> ref6 = Mockito.mock(ServiceReference.class); Throwable t6 = new Throwable(); manager.log(ref6, 64, "f", t6); assertLast(foo, ref3, 8, "c", t3); @@ -144,13 +144,14 @@ public class OsgiLogManagerTestCase { assertEquals(Level.ALL, logger.getLevel()); } - private static void assertLast(MyLogService service, ServiceReference ref, int level, String message, Throwable t) { + private static void assertLast(MyLogService service, ServiceReference<?> ref, int level, String message, Throwable t) { assertSame(ref, service.lastServiceReference); assertEquals(level, service.lastLevel); assertEquals(message, service.lastMessage); assertSame(t, service.lastThrowable); } + @SuppressWarnings("rawtypes") private static class MyLogService implements LogService { ServiceReference lastServiceReference; diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java index fbd6f5a3f88..ad2d7826c43 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java @@ -24,8 +24,8 @@ public class OsgiLogServiceTestCase { OsgiFramework osgi = TestDriver.newOsgiFramework(); osgi.start(); - ServiceTracker logs = newTracker(osgi, LogService.class); - ServiceTracker logReaders = newTracker(osgi, LogReaderService.class); + ServiceTracker<?,?> logs = newTracker(osgi, LogService.class); + ServiceTracker<?,?> logReaders = newTracker(osgi, LogReaderService.class); assertEquals(1, logs.getTrackingCount()); assertEquals(1, logReaders.getTrackingCount()); @@ -97,8 +97,8 @@ public class OsgiLogServiceTestCase { } @SuppressWarnings("unchecked") - private static ServiceTracker newTracker(OsgiFramework osgi, Class trackedClass) { - ServiceTracker tracker = new ServiceTracker(osgi.bundleContext(), trackedClass, null); + private static ServiceTracker<?,?> newTracker(OsgiFramework osgi, Class<?> trackedClass) { + ServiceTracker<?,?> tracker = new ServiceTracker<>(osgi.bundleContext(), trackedClass, null); tracker.open(); return tracker; } |