This is an automated email from the ASF dual-hosted git repository. amichai pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf-dosgi.git
commit 97564d0a37d87210e6582e393e2cb3c5f86480cf Author: Amichai Rothman <amic...@apache.org> AuthorDate: Tue May 28 22:11:30 2019 +0300 Migrate to diamond operator --- .../common/httpservice/HttpServiceManager.java | 2 +- .../common/intent/impl/IntentManagerImpl.java | 14 ++++----- .../cxf/dosgi/common/proxy/ExceptionMapper.java | 4 +-- .../common/proxy/ServiceInvocationHandlerTest.java | 4 +-- .../cxf/dosgi/common/util/PropertyHelperTest.java | 4 +-- .../cxf/dosgi/dsw/decorator/DecorationParser.java | 2 +- .../cxf/dosgi/dsw/decorator/InterfaceRule.java | 4 +-- .../dosgi/dsw/decorator/ServiceDecoratorImpl.java | 4 +-- .../cxf/dosgi/dsw/decorator/InterfaceRuleTest.java | 32 +++++++++---------- .../ServiceDecoratorBundleListenerTest.java | 2 +- .../dsw/decorator/ServiceDecoratorImplTest.java | 36 +++++++++++----------- .../multi/customintent/CustomIntentActivator.java | 4 +-- .../cxf/dosgi/dsw/handlers/rest/RsProvider.java | 2 +- .../ws/PojoConfigurationTypeHandlerTest.java | 24 +++++++-------- .../dosgi/samples/rest/impl/TaskResourceImpl.java | 2 +- .../dosgi/samples/rest/impl/TaskResourceImpl.java | 2 +- .../dosgi/samples/soap/impl/TaskServiceImpl.java | 4 +-- 17 files changed, 73 insertions(+), 73 deletions(-) diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java b/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java index 188cccc..45f9723 100644 --- a/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java +++ b/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java @@ -74,7 +74,7 @@ public class HttpServiceManager { public void initFromConfig(Dictionary<String, Object> config) { if (config == null) { - config = new Hashtable<String, Object>(); + config = new Hashtable<>(); } this.httpBase = getWithDefault(config.get(KEY_HTTP_BASE), "http://localhost:8181"); this.cxfServletAlias = getWithDefault(config.get(KEY_CXF_SERVLET_ALIAS), "/cxf"); diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java index 1cf26cf..b9b4525 100644 --- a/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java +++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java @@ -51,7 +51,7 @@ public class IntentManagerImpl implements IntentManager { static final Logger LOG = LoggerFactory.getLogger(IntentManagerImpl.class); private static final int DEFAULT_INTENT_TIMEOUT = 30000; - private final Map<String, Object> intentMap = new HashMap<String, Object>(); + private final Map<String, Object> intentMap = new HashMap<>(); private final long maxIntentWaitTime = DEFAULT_INTENT_TIMEOUT; private ServiceTracker<Object, Object> tracker; @@ -100,7 +100,7 @@ public class IntentManagerImpl implements IntentManager { @SuppressWarnings("unchecked") public synchronized List<Object> getRequiredIntents(Set<String> requiredIntents) { String[] intentNames = assertAllIntentsSupported(requiredIntents); - List<Object> intents = new ArrayList<Object>(); + List<Object> intents = new ArrayList<>(); for (String intentName : intentNames) { Object intent = intentMap.get(intentName); if (intent instanceof Callable<?>) { @@ -139,7 +139,7 @@ public class IntentManagerImpl implements IntentManager { @Override public <T> List<T> getIntents(Class<? extends T> type, List<Object> intents) { - List<T> result = new ArrayList<T>(); + List<T> result = new ArrayList<>(); for (Object intent : intents) { if (type.isInstance(intent)) { result.add(type.cast(intent)); @@ -182,7 +182,7 @@ public class IntentManagerImpl implements IntentManager { } private synchronized Set<String> getMissingIntents(Collection<String> requiredIntents) { - Set<String> unsupportedIntents = new HashSet<String>(); + Set<String> unsupportedIntents = new HashSet<>(); unsupportedIntents.clear(); for (String ri : requiredIntents) { if (!intentMap.containsKey(ri)) { @@ -194,7 +194,7 @@ public class IntentManagerImpl implements IntentManager { @Override public Set<String> getExported(Map<String, Object> sd) { - Set<String> allIntents = new HashSet<String>(); + Set<String> allIntents = new HashSet<>(); Collection<String> intents = PropertyHelper .getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS)); allIntents.addAll(parseIntents(intents)); @@ -226,11 +226,11 @@ public class IntentManagerImpl implements IntentManager { @Override public Set<String> getImported(Map<String, Object> sd) { Collection<String> intents = PropertyHelper.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_INTENTS)); - return new HashSet<String>(intents); + return new HashSet<>(intents); } private static Collection<String> parseIntents(Collection<String> intents) { - List<String> parsed = new ArrayList<String>(); + List<String> parsed = new ArrayList<>(); for (String intent : intents) { parsed.addAll(Arrays.asList(intent.split("[ ]"))); } diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java b/common/src/main/java/org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java index 01d7ef4..ce03ae4 100644 --- a/common/src/main/java/org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java +++ b/common/src/main/java/org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java @@ -28,7 +28,7 @@ import org.osgi.framework.ServiceException; public class ExceptionMapper { private static final String REMOTE_EXCEPTION_TYPE = "REMOTE"; - private Map<Method, Set<Class<?>>> exceptionsMap = new HashMap<Method, Set<Class<?>>>(); + private Map<Method, Set<Class<?>>> exceptionsMap = new HashMap<>(); public ExceptionMapper(Class<?> iType) { introspectTypeForExceptions(iType); @@ -70,7 +70,7 @@ public class ExceptionMapper { private Set<Class<?>> getCurrentExTypes(Method m) { Set<Class<?>> types = exceptionsMap.get(m); if (types == null) { - types = new HashSet<Class<?>>(); + types = new HashSet<>(); exceptionsMap.put(m, types); } return types; diff --git a/common/src/test/java/org/apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java b/common/src/test/java/org/apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java index aeb620e..985a9a0 100644 --- a/common/src/test/java/org/apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java +++ b/common/src/test/java/org/apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java @@ -33,7 +33,7 @@ import org.junit.Test; public class ServiceInvocationHandlerTest { - private static final Map<String, Method> OBJECT_METHODS = new HashMap<String, Method>(); { + private static final Map<String, Method> OBJECT_METHODS = new HashMap<>(); { for (Method m : Object.class.getMethods()) { OBJECT_METHODS.put(m.getName(), m); } @@ -48,7 +48,7 @@ public class ServiceInvocationHandlerTest { @Test public void testInvokeObjectMethod() throws Throwable { - final List<String> called = new ArrayList<String>(); + final List<String> called = new ArrayList<>(); ServiceInvocationHandler sih = new ServiceInvocationHandler("hi", String.class) { @Override public boolean equals(Object obj) { diff --git a/common/src/test/java/org/apache/cxf/dosgi/common/util/PropertyHelperTest.java b/common/src/test/java/org/apache/cxf/dosgi/common/util/PropertyHelperTest.java index 41e8115..f842caf 100644 --- a/common/src/test/java/org/apache/cxf/dosgi/common/util/PropertyHelperTest.java +++ b/common/src/test/java/org/apache/cxf/dosgi/common/util/PropertyHelperTest.java @@ -43,7 +43,7 @@ public class PropertyHelperTest extends TestCase { } public void testMultiValuePropertyAsCollection() { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); list.add("1"); list.add("2"); list.add("3"); @@ -55,7 +55,7 @@ public class PropertyHelperTest extends TestCase { } public void testGetProperty() { - Map<String, Object> p = new HashMap<String, Object>(); + Map<String, Object> p = new HashMap<>(); p.put(RemoteConstants.ENDPOINT_ID, "http://google.de"); p.put("notAString", new Object()); p.put(org.osgi.framework.Constants.OBJECTCLASS, new String[]{"my.class"}); diff --git a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java index 1f35820..e8f51b4 100644 --- a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java +++ b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java @@ -59,7 +59,7 @@ class DecorationParser { List<ServiceDecorationType> getDecorations(URL resourceURL) throws JAXBException, IOException { if (resourceURL == null || !decorationType(resourceURL)) { - return new ArrayList<ServiceDecorationType>(); + return new ArrayList<>(); } Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(schema); diff --git a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java index 1510cf7..02578f3 100644 --- a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java +++ b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java @@ -36,8 +36,8 @@ public class InterfaceRule implements Rule { private final Bundle bundle; private final Pattern matchPattern; - private final Map<String, String> propMatches = new HashMap<String, String>(); - private final Map<String, Object> addProps = new HashMap<String, Object>(); + private final Map<String, String> propMatches = new HashMap<>(); + private final Map<String, Object> addProps = new HashMap<>(); public InterfaceRule(Bundle b, String im) { bundle = b; diff --git a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java index e850c92..c00bbb9 100644 --- a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java +++ b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java @@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory; public class ServiceDecoratorImpl implements ServiceDecorator { private static final Logger LOG = LoggerFactory.getLogger(ServiceDecoratorImpl.class); - final List<Rule> decorations = new CopyOnWriteArrayList<Rule>(); + final List<Rule> decorations = new CopyOnWriteArrayList<>(); private DecorationParser parser; @@ -77,7 +77,7 @@ public class ServiceDecoratorImpl implements ServiceDecorator { if (entries == null) { return Collections.emptyList(); } - List<ServiceDecorationType> elements = new ArrayList<ServiceDecorationType>(); + List<ServiceDecorationType> elements = new ArrayList<>(); while (entries.hasMoreElements()) { try { elements.addAll(parser.getDecorations((URL)entries.nextElement())); diff --git a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java index c74e08a..fed8706 100644 --- a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java +++ b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java @@ -47,14 +47,14 @@ public class InterfaceRuleTest extends TestCase { InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo"); ir.addProperty("x", "y", String.class.getName()); - final Map<String, Object> serviceProps = new HashMap<String, Object>(); + final Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"a.b.C", "org.apache.Foo"}); ServiceReference sref = mockServiceReference(serviceProps); - Map<String, Object> m = new HashMap<String, Object>(); + Map<String, Object> m = new HashMap<>(); m.put("a", "b"); ir.apply(sref, m); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("a", "b"); expected.put("x", "y"); assertEquals(expected, m); @@ -66,14 +66,14 @@ public class InterfaceRuleTest extends TestCase { ir.addProperty("x", "1", Integer.class.getName()); ir.addProperty("aaa.bbb", "true", Boolean.class.getName()); - final Map<String, Object> serviceProps = new HashMap<String, Object>(); + final Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put("boo", "baah"); serviceProps.put(Constants.OBJECTCLASS, new String[] {"a.b.C", "org.apache.Foo"}); ServiceReference sref = mockServiceReference(serviceProps); - Map<String, Object> m = new HashMap<String, Object>(); + Map<String, Object> m = new HashMap<>(); ir.apply(sref, m); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("x", 1); expected.put("aaa.bbb", Boolean.TRUE); assertEquals(expected, m); @@ -83,12 +83,12 @@ public class InterfaceRuleTest extends TestCase { InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)"); ir.addProperty("x", "y", String.class.getName()); - final Map<String, Object> serviceProps = new HashMap<String, Object>(); + final Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put("boo", "baah"); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Boo"}); ServiceReference sref = mockServiceReference(serviceProps); - Map<String, Object> m = new HashMap<String, Object>(); + Map<String, Object> m = new HashMap<>(); ir.apply(sref, m); assertEquals(0, m.size()); } @@ -98,11 +98,11 @@ public class InterfaceRuleTest extends TestCase { ir.addPropMatch("boo", "baah"); ir.addProperty("x", "y", String.class.getName()); - final Map<String, Object> serviceProps = new HashMap<String, Object>(); + final Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"}); ServiceReference sref = mockServiceReference(serviceProps); - Map<String, Object> m = new HashMap<String, Object>(); + Map<String, Object> m = new HashMap<>(); ir.apply(sref, m); assertEquals(0, m.size()); } @@ -112,16 +112,16 @@ public class InterfaceRuleTest extends TestCase { ir.addPropMatch("test.int", "42"); ir.addProperty("x", "1", Long.class.getName()); - final Map<String, Object> serviceProps = new HashMap<String, Object>(); + final Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put("test.int", 42); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"}); ServiceReference sref = mockServiceReference(serviceProps); - Map<String, Object> m = new HashMap<String, Object>(); + Map<String, Object> m = new HashMap<>(); m.put("x", "foo"); m.put("aaa.bbb", Boolean.TRUE); ir.apply(sref, m); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("x", 1L); expected.put("aaa.bbb", Boolean.TRUE); assertEquals(expected, m); @@ -132,16 +132,16 @@ public class InterfaceRuleTest extends TestCase { ir.addPropMatch("test.int", "42"); ir.addProperty("x", "1", Long.class.getName()); - final Map<String, Object> serviceProps = new HashMap<String, Object>(); + final Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put("test.int", 51); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"}); ServiceReference sref = mockServiceReference(serviceProps); - Map<String, Object> m = new HashMap<String, Object>(); + Map<String, Object> m = new HashMap<>(); m.put("x", "foo"); m.put("aaa.bbb", Boolean.TRUE); ir.apply(sref, m); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("x", "foo"); expected.put("aaa.bbb", Boolean.TRUE); assertEquals(expected, m); diff --git a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java index 1b09bea..fda2edb 100644 --- a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java +++ b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java @@ -37,7 +37,7 @@ public class ServiceDecoratorBundleListenerTest { BundleContext bc = EasyMock.createMock(BundleContext.class); EasyMock.replay(bc); - final List<String> called = new ArrayList<String>(); + final List<String> called = new ArrayList<>(); ServiceDecoratorImpl serviceDecorator = new ServiceDecoratorImpl() { @Override void addDecorations(Bundle bundle) { diff --git a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java index aac3b00..4e870e5 100644 --- a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java +++ b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java @@ -34,7 +34,7 @@ import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; public class ServiceDecoratorImplTest extends TestCase { - private static final Map<String, Object> EMPTY = new HashMap<String, Object>(); + private static final Map<String, Object> EMPTY = new HashMap<>(); private static final URL RES_SD = getResource("/test-resources/sd.xml"); private static final URL RES_SD1 = getResource("/test-resources/sd1.xml"); private static final URL RES_SD2 = getResource("/test-resources/sd2.xml"); @@ -43,7 +43,7 @@ public class ServiceDecoratorImplTest extends TestCase { @SuppressWarnings("rawtypes") public void testAddRemoveDecorations() { - final Map<String, Object> serviceProps = new HashMap<String, Object>(); + final Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.acme.foo.Bar"}); serviceProps.put("test.prop", "xyz"); @@ -53,7 +53,7 @@ public class ServiceDecoratorImplTest extends TestCase { sd.addDecorations(b); assertEquals(1, sd.decorations.size()); - Map<String, Object> target = new HashMap<String, Object>(); + Map<String, Object> target = new HashMap<>(); ServiceReference sref = EasyMock.createMock(ServiceReference.class); EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() { @Override @@ -64,67 +64,67 @@ public class ServiceDecoratorImplTest extends TestCase { EasyMock.replay(sref); sd.decorate(sref, target); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("test.too", "ahaha"); assertEquals(expected, target); // remove it again sd.removeDecorations(b); assertEquals(0, sd.decorations.size()); - Map<String, Object> target2 = new HashMap<String, Object>(); + Map<String, Object> target2 = new HashMap<>(); sd.decorate(sref, target2); assertEquals(EMPTY, target2); } public void testAddDecorations() { - final Map<String, Object> serviceProps = new HashMap<String, Object>(); + final Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.acme.foo.Bar"}); serviceProps.put("test.prop", "xyz"); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("test.too", "ahaha"); assertDecorate(serviceProps, expected, RES_SD); } public void testAddDecorations1() { - Map<String, Object> serviceProps = new HashMap<String, Object>(); + Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.A"}); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("A", "B"); expected.put("C", 2); assertDecorate(serviceProps, expected, RES_SD1, RES_SD2); } public void testAddDecorations2() { - Map<String, Object> serviceProps = new HashMap<String, Object>(); + Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"}); assertDecorate(serviceProps, EMPTY, RES_SD1, RES_SD2); } public void testAddDecorations3() { - Map<String, Object> serviceProps = new HashMap<String, Object>(); + Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.B"}); serviceProps.put("x", "y"); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("bool", Boolean.TRUE); assertDecorate(serviceProps, expected, RES_SD1, RES_SD2); } public void testAddDecorations4() { - Map<String, Object> serviceProps = new HashMap<String, Object>(); + Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.C"}); serviceProps.put("x", "z"); - Map<String, Object> expected = new HashMap<String, Object>(); + Map<String, Object> expected = new HashMap<>(); expected.put("bool", Boolean.FALSE); assertDecorate(serviceProps, expected, RES_SD1, RES_SD2); } public void testAddDecorations5() { - Map<String, Object> serviceProps = new HashMap<String, Object>(); + Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.C"}); serviceProps.put("x", "x"); @@ -132,14 +132,14 @@ public class ServiceDecoratorImplTest extends TestCase { } public void testAddDecorations6() { - Map<String, Object> serviceProps = new HashMap<String, Object>(); + Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"}); assertDecorate(serviceProps, EMPTY, RES_SD0); } public void testAddDecorations7() { - Map<String, Object> serviceProps = new HashMap<String, Object>(); + Map<String, Object> serviceProps = new HashMap<>(); serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"}); assertDecorate(serviceProps, EMPTY, RES_SD_1); @@ -158,7 +158,7 @@ public class ServiceDecoratorImplTest extends TestCase { ServiceDecoratorImpl sd = new ServiceDecoratorImpl(); sd.addDecorations(b); - Map<String, Object> target = new HashMap<String, Object>(); + Map<String, Object> target = new HashMap<>(); ServiceReference sref = EasyMock.createMock(ServiceReference.class); EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() { @Override diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java index c5782f3..b077969 100644 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java @@ -31,11 +31,11 @@ public class CustomIntentActivator implements BundleActivator { @Override public void start(BundleContext context) { - Dictionary<String, String> props = new Hashtable<String, String>(); + Dictionary<String, String> props = new Hashtable<>(); props.put("org.apache.cxf.dosgi.IntentName", "myIntent"); context.registerService(CustomFeatureProvider.class, new CustomFeatureProvider(), props); - Dictionary<String, String> props2 = new Hashtable<String, String>(); + Dictionary<String, String> props2 = new Hashtable<>(); props2.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, "org.apache.cxf.ws"); props2.put("org.apache.cxf.ws.address", "/taskservice"); props2.put(RemoteConstants.SERVICE_EXPORTED_INTERFACES, "*"); diff --git a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java index 7e5c20e..6cf8ff4 100644 --- a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java +++ b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java @@ -167,7 +167,7 @@ public class RsProvider extends BaseDistributionProvider implements Distribution factory.setBindingConfig(binding); } - List<Object> providers = new ArrayList<Object>(); + List<Object> providers = new ArrayList<>(); for (Object intent : intents) { if (isProvider(intent)) { providers.add(intent); diff --git a/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java b/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java index c36aecc..9e232d9 100644 --- a/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java +++ b/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java @@ -64,7 +64,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { WsProvider handler = new WsProvider(); handler.setIntentManager(intentManager); handler.setHttpServiceManager(dummyHttpServiceManager()); - Map<String, Object> sd = new HashMap<String, Object>(); + Map<String, Object> sd = new HashMap<>(); String url = "http://somewhere:1234/blah"; sd.put(RemoteConstants.ENDPOINT_ID, url); assertEquals(url, handler.getServerAddress(sd, String.class)); @@ -79,7 +79,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { WsProvider handler = new WsProvider(); handler.setIntentManager(intentManager); handler.setHttpServiceManager(dummyHttpServiceManager()); - Map<String, Object> sd = new HashMap<String, Object>(); + Map<String, Object> sd = new HashMap<>(); String url = "http://somewhere:29/boo"; sd.put("org.apache.cxf.ws.address", url); assertEquals(url, handler.getServerAddress(sd, String.class)); @@ -90,7 +90,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { WsProvider handler = new WsProvider(); handler.setIntentManager(intentManager); handler.setHttpServiceManager(dummyHttpServiceManager()); - Map<String, Object> sd = new HashMap<String, Object>(); + Map<String, Object> sd = new HashMap<>(); assertEquals("/java/lang/String", handler.getServerAddress(sd, String.class)); } @@ -120,7 +120,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { Class<?>[] exportedInterfaces = new Class[] {Runnable.class}; - Map<String, Object> props = new HashMap<String, Object>(); + Map<String, Object> props = new HashMap<>(); props.put(RemoteConstants.ENDPOINT_ID, "http://google.de/"); EndpointHelper.addObjectClass(props, exportedInterfaces); props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[] {"my.config"}); @@ -162,7 +162,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { Class<?>[] exportedInterface = new Class[] {String.class }; - Map<String, Object> props = new HashMap<String, Object>(); + Map<String, Object> props = new HashMap<>(); EndpointHelper.addObjectClass(props, exportedInterface); props.put(WsConstants.WS_ADDRESS_PROPERTY, "http://alternate_host:80/myString"); @@ -179,15 +179,15 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { public void testAddressing() { runAddressingTest(new HashMap<String, Object>(), "http://localhost:9000/java/lang/Runnable"); - Map<String, Object> p1 = new HashMap<String, Object>(); + Map<String, Object> p1 = new HashMap<>(); p1.put("org.apache.cxf.ws.address", "http://somewhere"); runAddressingTest(p1, "http://somewhere"); - Map<String, Object> p3 = new HashMap<String, Object>(); + Map<String, Object> p3 = new HashMap<>(); p3.put("org.apache.cxf.ws.port", 65535); runAddressingTest(p3, "http://localhost:65535/java/lang/Runnable"); - Map<String, Object> p4 = new HashMap<String, Object>(); + Map<String, Object> p4 = new HashMap<>(); p4.put("org.apache.cxf.ws.port", "8181"); runAddressingTest(p4, "http://localhost:8181/java/lang/Runnable"); } @@ -247,7 +247,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { handler.activate(dswContext); Class[] exportedInterfaces = {Runnable.class}; - Map<String, Object> props = new HashMap<String, Object>(); + Map<String, Object> props = new HashMap<>(); EndpointHelper.addObjectClass(props, exportedInterfaces); Runnable myService = EasyMock.createMock(Runnable.class); @@ -329,7 +329,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { pch.setHttpServiceManager(dummyHttpServiceManager()); pch.activate(bc); Class<?>[] exportedInterfaces = new Class[] {String.class}; - Map<String, Object> sd = new HashMap<String, Object>(); + Map<String, Object> sd = new HashMap<>(); sd.put(org.osgi.framework.Constants.SERVICE_ID, 42); EndpointHelper.addObjectClass(sd, exportedInterfaces); List<String> intents = Arrays.asList("my_intent", "your_intent"); @@ -356,7 +356,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { handler.activate(dswBC); Class<?>[] exportedInterfaces = new Class[] {MyJaxWsEchoService.class}; - Map<String, Object> sd = new HashMap<String, Object>(); + Map<String, Object> sd = new HashMap<>(); sd.put(WsConstants.WS_ADDRESS_PROPERTY, "/somewhere"); EndpointHelper.addObjectClass(sd, exportedInterfaces); BundleContext serviceBC = c.createMock(BundleContext.class); @@ -384,7 +384,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase { handler.setIntentManager(intentManager); handler.setHttpServiceManager(dummyHttpServiceManager()); handler.activate(dswBC); - Map<String, Object> sd = new HashMap<String, Object>(); + Map<String, Object> sd = new HashMap<>(); sd.put(Constants.OBJECTCLASS, new String[]{MySimpleEchoService.class.getName()}); sd.put(WsConstants.WS_ADDRESS_PROPERTY, "/somewhere_else"); BundleContext serviceBC = c.createMock(BundleContext.class); diff --git a/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java b/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java index eca3bc7..0f9856b 100644 --- a/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java +++ b/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java @@ -54,7 +54,7 @@ public class TaskResourceImpl implements TaskResource, IntentsProvider { Map<Integer, Task> taskMap; public TaskResourceImpl() { - taskMap = new HashMap<Integer, Task>(); + taskMap = new HashMap<>(); Task task = new Task(); task.setId(1); task.setTitle("Buy some coffee"); diff --git a/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java b/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java index 52a6afe..7262aae 100644 --- a/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java +++ b/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java @@ -45,7 +45,7 @@ public class TaskResourceImpl implements TaskResource, IntentsProvider { Map<Integer, Task> taskMap; public TaskResourceImpl() { - taskMap = new HashMap<Integer, Task>(); + taskMap = new HashMap<>(); Task task = new Task(); task.setId(1); task.setTitle("Buy some coffee"); diff --git a/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java b/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java index 4bf4dbe..241ff99 100644 --- a/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java +++ b/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java @@ -42,7 +42,7 @@ public class TaskServiceImpl implements TaskService { Map<Integer, Task> taskMap; public TaskServiceImpl() { - taskMap = new HashMap<Integer, Task>(); + taskMap = new HashMap<>(); Task task = new Task(); task.setId(1); task.setTitle("Buy some coffee"); @@ -68,7 +68,7 @@ public class TaskServiceImpl implements TaskService { @Override public Collection<Task> getAll() { // taskMap.values is not serializable - return new ArrayList<Task>(taskMap.values()); + return new ArrayList<>(taskMap.values()); } @Override