diff options
author | Alexander Kurtakov | 2020-01-14 11:38:02 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2020-01-14 11:38:02 +0000 |
commit | 4d9b3a851bc877af780577fa4f096976399c121b (patch) | |
tree | 0b7b4577416def48105a066b5861113330376d7f | |
parent | dcb22c2837aa404f962f53a04e8e48473b9178fc (diff) | |
download | rt.equinox.framework-4d9b3a851bc877af780577fa4f096976399c121b.tar.gz rt.equinox.framework-4d9b3a851bc877af780577fa4f096976399c121b.tar.xz rt.equinox.framework-4d9b3a851bc877af780577fa4f096976399c121b.zip |
Remove redundant type arguments in osgi.tests.I20200114-1805
Change-Id: I192d24bf559330e059993971c662aac11f1c2cf6
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
38 files changed, 320 insertions, 284 deletions
diff --git a/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs index 8d88fa3d6..a56a1b4b3 100644 --- a/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs @@ -86,7 +86,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java index f211bb9e0..aa29bef72 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java @@ -100,7 +100,7 @@ public class TestHookConfigurator implements HookConfigurator { // try setting the ID to something which is checked during the test builder.setId(5678); Map<String, String> dirs = Collections.emptyMap(); - Map<String, Object> attrs = new HashMap<String, Object>(); + Map<String, Object> attrs = new HashMap<>(); attrs.put("test.file.path", getGeneration().getContent().getPath() + " - " + adaptCount.getAndIncrement()); attrs.put("test.operation", operation.toString()); attrs.put("test.origin", origin.getLocation()); diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.protocol.handler/test/protocol/handler/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.protocol.handler/test/protocol/handler/Activator.java index ce79a297d..5c095d3f4 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.protocol.handler/test/protocol/handler/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.protocol.handler/test/protocol/handler/Activator.java @@ -28,7 +28,7 @@ public class Activator extends AbstractURLStreamHandlerService implements Bundle @Override public void start(BundleContext context) throws Exception { bc = context; - Dictionary<String, String> props = new Hashtable<String, String>(); + Dictionary<String, String> props = new Hashtable<>(); props.put(URLConstants.URL_HANDLER_PROTOCOL, "testing1"); context.registerService(URLStreamHandlerService.class, this, props); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/ExtendedLogReaderServiceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/ExtendedLogReaderServiceTest.java index 6e27a6494..ee57016f5 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/ExtendedLogReaderServiceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/ExtendedLogReaderServiceTest.java @@ -58,7 +58,7 @@ public class ExtendedLogReaderServiceTest extends TestCase { rootLoggerContext = loggerAdmin.getLoggerContext(null); rootLogLevels = rootLoggerContext.getLogLevels(); - Map<String, LogLevel> copyLogLevels = new HashMap<String, LogLevel>(rootLogLevels); + Map<String, LogLevel> copyLogLevels = new HashMap<>(rootLogLevels); copyLogLevels.put(Logger.ROOT_LOGGER_NAME, LogLevel.TRACE); rootLoggerContext.setLogLevels(copyLogLevels); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/ExtendedLogServiceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/ExtendedLogServiceTest.java index fbed87798..08b8508ee 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/ExtendedLogServiceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/ExtendedLogServiceTest.java @@ -62,7 +62,7 @@ public class ExtendedLogServiceTest extends TestCase { rootLoggerContext = loggerAdmin.getLoggerContext(null); rootLogLevels = rootLoggerContext.getLogLevels(); - Map<String, LogLevel> copyLogLevels = new HashMap<String, LogLevel>(rootLogLevels); + Map<String, LogLevel> copyLogLevels = new HashMap<>(rootLogLevels); copyLogLevels.put(Logger.ROOT_LOGGER_NAME, LogLevel.TRACE); rootLoggerContext.setLogLevels(copyLogLevels); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java index fdf426e66..ae1aba7ec 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java @@ -76,7 +76,7 @@ public class LogReaderServiceTest extends AbstractBundleTests { rootLoggerContext = loggerAdmin.getLoggerContext(null); rootLogLevels = rootLoggerContext.getLogLevels(); - Map<String, LogLevel> copyLogLevels = new HashMap<String, LogLevel>(rootLogLevels); + Map<String, LogLevel> copyLogLevels = new HashMap<>(rootLogLevels); copyLogLevels.put(Logger.ROOT_LOGGER_NAME, LogLevel.TRACE); rootLoggerContext.setLogLevels(copyLogLevels); } @@ -226,7 +226,7 @@ public class LogReaderServiceTest extends AbstractBundleTests { } public void testLogFrameworkEventType() throws Exception { - final List<LogEntry> events = new CopyOnWriteArrayList<LogEntry>(); + final List<LogEntry> events = new CopyOnWriteArrayList<>(); final CountDownLatch countDown = new CountDownLatch(3); final Bundle b = getContext().getBundle(); LogListener listener = new LogListener() { @@ -257,7 +257,7 @@ public class LogReaderServiceTest extends AbstractBundleTests { public void testLogHistory1() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(EquinoxConfiguration.PROP_LOG_HISTORY_MAX, "10"); Equinox equinox = new Equinox(configuration); @@ -291,7 +291,7 @@ public class LogReaderServiceTest extends AbstractBundleTests { public void testLogHistory2() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.start(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogServiceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogServiceTest.java index 0629f704a..e69d4903b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogServiceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogServiceTest.java @@ -61,7 +61,7 @@ public class LogServiceTest extends TestCase { rootLoggerContext = loggerAdmin.getLoggerContext(null); rootLogLevels = rootLoggerContext.getLogLevels(); - Map<String, LogLevel> copyLogLevels = new HashMap<String, LogLevel>(rootLogLevels); + Map<String, LogLevel> copyLogLevels = new HashMap<>(rootLogLevels); copyLogLevels.put(Logger.ROOT_LOGGER_NAME, LogLevel.TRACE); rootLoggerContext.setLogLevels(copyLogLevels); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java index 35b968f4e..74ad42fc7 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java @@ -257,7 +257,7 @@ public class AbstractBundleTests extends CoreTest { protected Map<String, Object> createConfiguration() { File file = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> result = new HashMap<String, Object>(); + Map<String, Object> result = new HashMap<>(); result.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); return result; } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstallUpdateTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstallUpdateTests.java index eccc62878..de830bc3b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstallUpdateTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstallUpdateTests.java @@ -417,7 +417,7 @@ public class BundleInstallUpdateTests extends AbstractBundleTests { String entryName = "file_with_" + c + "_char"; File bundlesDirectory = OSGiTestsActivator.getContext().getDataFile(getName()); bundlesDirectory.mkdirs(); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); Map<String, String> entry = Collections.singletonMap(entryName, "value"); @@ -444,7 +444,7 @@ public class BundleInstallUpdateTests extends AbstractBundleTests { String nativeCode = "../../lib/nativeCode"; File bundlesDirectory = OSGiTestsActivator.getContext().getDataFile(getName()); bundlesDirectory.mkdirs(); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); headers.put(Constants.BUNDLE_CLASSPATH, "., " + cp1); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/CascadeConfigTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/CascadeConfigTests.java index cd61ab5e0..dc0e78a4d 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/CascadeConfigTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/CascadeConfigTests.java @@ -32,7 +32,7 @@ public class CascadeConfigTests extends AbstractBundleTests { public void testCascadeConfigBundleInstall() throws Exception { // First create a framework with the 'parent' configuration File configParent = OSGiTestsActivator.getContext().getDataFile(getName() + "_parent"); - Map<String, Object> parentMap = new HashMap<String, Object>(); + Map<String, Object> parentMap = new HashMap<>(); parentMap.put(Constants.FRAMEWORK_STORAGE, configParent.getAbsolutePath()); Equinox equinox = new Equinox(parentMap); equinox.init(); @@ -45,7 +45,7 @@ public class CascadeConfigTests extends AbstractBundleTests { // Now create a child framework and make sure test1 bundle is there File configChild = OSGiTestsActivator.getContext().getDataFile(getName() + "_child"); - Map<String, Object> childMap = new HashMap<String, Object>(); + Map<String, Object> childMap = new HashMap<>(); childMap.put(Constants.FRAMEWORK_STORAGE, configChild.getAbsolutePath()); childMap.put("osgi.sharedConfiguration.area", configParent.getCanonicalPath()); @@ -91,7 +91,7 @@ public class CascadeConfigTests extends AbstractBundleTests { public void testCascadeConfigDataArea() throws Exception { // First create a framework with the 'parent' configuration File configParent = OSGiTestsActivator.getContext().getDataFile(getName() + "_parent"); - Map<String, Object> parentMap = new HashMap<String, Object>(); + Map<String, Object> parentMap = new HashMap<>(); parentMap.put(Constants.FRAMEWORK_STORAGE, configParent.getAbsolutePath()); Equinox equinox = new Equinox(parentMap); equinox.init(); @@ -105,7 +105,7 @@ public class CascadeConfigTests extends AbstractBundleTests { // Now create a child framework and make sure bundle is there File configChild = OSGiTestsActivator.getContext().getDataFile(getName() + "_child"); - Map<String, Object> childMap = new HashMap<String, Object>(); + Map<String, Object> childMap = new HashMap<>(); childMap.put(Constants.FRAMEWORK_STORAGE, configChild.getAbsolutePath()); childMap.put("osgi.sharedConfiguration.area", configParent.getCanonicalPath()); @@ -168,7 +168,7 @@ public class CascadeConfigTests extends AbstractBundleTests { childProps.put("parent.child.key", "child"); childProps.put("child.key", "child"); childProps.store(new FileOutputStream(childConfigIni), "Parent config.ini"); - Map<String, Object> childMap = new HashMap<String, Object>(); + Map<String, Object> childMap = new HashMap<>(); childMap.put(Constants.FRAMEWORK_STORAGE, configChild.getAbsolutePath()); childMap.put("osgi.sharedConfiguration.area", configParent.getCanonicalPath()); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java index 1b28ff4fd..2f509b25d 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java @@ -2224,8 +2224,8 @@ public class ClassLoadingBundleTests extends AbstractBundleTests { }; testThread.set(Boolean.TRUE); - final Set<String> weavingHookClasses = new HashSet<String>(); - final List<WovenClass> called = new ArrayList<WovenClass>(); + final Set<String> weavingHookClasses = new HashSet<>(); + final List<WovenClass> called = new ArrayList<>(); final AtomicBoolean loadNewClassInWeave = new AtomicBoolean(false); ServiceFactory<WeavingHook> topFactory = new ServiceFactory<WeavingHook>() { @@ -2296,7 +2296,7 @@ public class ClassLoadingBundleTests extends AbstractBundleTests { public void testLoaderUninstalledBundle() throws BundleException, IOException { String testResourcePath = "testResource"; File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, String> testHeaders = new HashMap<String, String>(); + Map<String, String> testHeaders = new HashMap<>(); testHeaders.put(Constants.BUNDLE_MANIFESTVERSION, "2"); testHeaders.put(Constants.BUNDLE_SYMBOLICNAME, getName()); config.mkdirs(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java index 2de71acac..36d9c8891 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java @@ -59,7 +59,7 @@ public class ImportJavaSEPackagesTests extends AbstractBundleTests { public void testExportPackageCannotContainJavaPackages() throws Exception { File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); headers.put(Constants.EXPORT_PACKAGE, JAVA_LANG); @@ -89,7 +89,7 @@ public class ImportJavaSEPackagesTests extends AbstractBundleTests { public void testImportPackageCanContainJavaPackages() throws Exception { File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); headers.put(Constants.IMPORT_PACKAGE, JAVA_LANG); @@ -120,7 +120,7 @@ public class ImportJavaSEPackagesTests extends AbstractBundleTests { } public void testSystemPackages() throws Exception { - Map<Integer, Integer> packagesPerVersion = new HashMap<Integer, Integer>(); + Map<Integer, Integer> packagesPerVersion = new HashMap<>(); packagesPerVersion.put(7, 56); packagesPerVersion.put(8, 63); if (!originalSpecVersion.startsWith("1.")) { @@ -186,7 +186,7 @@ public class ImportJavaSEPackagesTests extends AbstractBundleTests { } File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); config.mkdirs(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/MultiReleaseJarTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/MultiReleaseJarTests.java index 00956fc3a..81700d000 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/MultiReleaseJarTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/MultiReleaseJarTests.java @@ -85,7 +85,7 @@ public class MultiReleaseJarTests extends AbstractBundleTests { Bundle base = installer.installBundle("mrBundleInputBase"); - Map<String, String> bundleHeaders = new LinkedHashMap<String, String>(); + Map<String, String> bundleHeaders = new LinkedHashMap<>(); bundleHeaders.put(Constants.BUNDLE_MANIFESTVERSION, "2"); bundleHeaders.put(Constants.BUNDLE_SYMBOLICNAME, "mrBundle"); bundleHeaders.put(Constants.BUNDLE_VERSION, "1.0.0"); @@ -95,7 +95,7 @@ public class MultiReleaseJarTests extends AbstractBundleTests { bundleHeaders.put(Constants.PROVIDE_CAPABILITY, "capbase, cap8, cap9, cap10, cap11"); bundleHeaders.put(Constants.BUNDLE_CLASSPATH, "., " + classpathMrJar.getName() + ", classPathDir"); - Map<String, byte[]> bundleEntries = new LinkedHashMap<String, byte[]>(); + Map<String, byte[]> bundleEntries = new LinkedHashMap<>(); bundleEntries.put("multi/", null); bundleEntries.put("multi/release/", null); bundleEntries.put("multi/release/test/", null); @@ -165,7 +165,7 @@ public class MultiReleaseJarTests extends AbstractBundleTests { bundleEntries.put("META-INF/versions/11/OSGI-INF/", null); bundleEntries.put("META-INF/versions/11/OSGI-INF/MANIFEST.MF", getBytes("manifests/manifest11.mf", base)); - Map<String, byte[]> classPathJarEntries = new LinkedHashMap<String, byte[]>(); + Map<String, byte[]> classPathJarEntries = new LinkedHashMap<>(); classPathJarEntries.put("multi/", null); classPathJarEntries.put("multi/release/", null); classPathJarEntries.put("multi/release/test/", null); @@ -633,8 +633,8 @@ public class MultiReleaseJarTests extends AbstractBundleTests { System.setProperty("java.specification.version", Integer.toString(rv)); } - Collection<String> expected = new ArrayList<String>(); - Collection<String> expectedRecurse = new ArrayList<String>(); + Collection<String> expected = new ArrayList<>(); + Collection<String> expectedRecurse = new ArrayList<>(); expected.add("multi/release/test/testResourceBase.txt"); expected.add("multi/release/test/testResource8.txt"); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java index e298be7a7..7c8b01682 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java @@ -19,9 +19,18 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import junit.framework.Test; import junit.framework.TestSuite; -import org.eclipse.osgi.service.resolver.*; +import org.eclipse.osgi.service.resolver.BundleDescription; +import org.eclipse.osgi.service.resolver.ExportPackageDescription; +import org.eclipse.osgi.service.resolver.ImportPackageSpecification; +import org.eclipse.osgi.service.resolver.PlatformAdmin; +import org.eclipse.osgi.service.resolver.State; +import org.eclipse.osgi.service.resolver.VersionConstraint; import org.eclipse.osgi.tests.OSGiTestsActivator; -import org.osgi.framework.*; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; +import org.osgi.framework.FrameworkEvent; +import org.osgi.framework.FrameworkListener; +import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.startlevel.BundleStartLevel; import org.osgi.framework.wiring.FrameworkWiring; @@ -140,7 +149,7 @@ public class PlatformAdminBundleTests extends AbstractBundleTests { } public void testNativeCodeFilterWithSpecialChars() throws BundleException, InterruptedException { - final AtomicReference<FrameworkEvent> error = new AtomicReference<FrameworkEvent>(); + final AtomicReference<FrameworkEvent> error = new AtomicReference<>(); final CountDownLatch errorCnt = new CountDownLatch(1); FrameworkListener errorListener = new FrameworkListener() { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java index f09cc596e..19f819ff4 100755 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java @@ -133,7 +133,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle01() { // simple test to create an embedded framework File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle01"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -174,7 +174,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle02() { // create/start/stop/start/stop test File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle02"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); @@ -219,7 +219,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle03() { // create/stop/ test File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle03"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -251,7 +251,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle04() { // create/start/stop/start/stop test File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle04"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -300,7 +300,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle05_1() { // create/install/start/stop test File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle05_1"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -350,7 +350,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle05_2() { // create/install/start/stop/start/stop test File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle05_2"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -430,7 +430,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle06() { // create multiple instances test File config1 = OSGiTestsActivator.getContext().getDataFile("testSystemBundle06_1"); //$NON-NLS-1$ - Map<String, Object> configuration1 = new HashMap<String, Object>(); + Map<String, Object> configuration1 = new HashMap<>(); configuration1.put(Constants.FRAMEWORK_STORAGE, config1.getAbsolutePath()); Equinox equinox1 = new Equinox(configuration1); try { @@ -442,7 +442,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox1.getState()); //$NON-NLS-1$ File config2 = OSGiTestsActivator.getContext().getDataFile("testSystemBundle06_2"); //$NON-NLS-1$ - Map<String, Object> configuration2 = new HashMap<String, Object>(); + Map<String, Object> configuration2 = new HashMap<>(); configuration2.put(Constants.FRAMEWORK_STORAGE, config2.getAbsolutePath()); Equinox equinox2 = new Equinox(configuration2); try { @@ -505,7 +505,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle07() { // test init twice File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle07_01"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -562,7 +562,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle08() { // create/start/stop/start/stop test File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle08_1"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -585,7 +585,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$ config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle08_2"); //$NON-NLS-1$ - configuration = new HashMap<String, Object>(); + configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); equinox = new Equinox(configuration); try { @@ -624,7 +624,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle09() { // test FrameworkUtil.createFilter File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle09"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -661,7 +661,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle10() { // create/start/update/stop test File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle10"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); final Equinox equinox = new Equinox(configuration); try { @@ -727,7 +727,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle11() { // test extra packages property File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle11"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "test.pkg1, test.pkg2"); //$NON-NLS-1$ Equinox equinox = new Equinox(configuration); @@ -767,7 +767,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle12() { // Test stop FrameworkEvent File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle12"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); @@ -805,7 +805,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle13() { // create/install/start/stop clean test File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle13"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -852,7 +852,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$ // initialize the framework again to the same configuration - configuration = new HashMap<String, Object>(); + configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); equinox = new Equinox(configuration); try { @@ -878,7 +878,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$ // initialize the framework again to the same configuration but use clean option - configuration = new HashMap<String, Object>(); + configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); equinox = new Equinox(configuration); @@ -907,7 +907,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle14() { // Test startlevel property File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle14"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_BEGINNING_STARTLEVEL, "10"); //$NON-NLS-1$ Equinox equinox = new Equinox(configuration); @@ -942,7 +942,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle16() { // test parent boot File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_BUNDLE_PARENT, Constants.FRAMEWORK_BUNDLE_PARENT_BOOT); checkParentClassLoader(configuration); @@ -951,7 +951,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle17() { // test parent app File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_BUNDLE_PARENT, Constants.FRAMEWORK_BUNDLE_PARENT_APP); checkParentClassLoader(configuration); @@ -960,7 +960,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle18() { // test parent ext File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_BUNDLE_PARENT, Constants.FRAMEWORK_BUNDLE_PARENT_EXT); checkParentClassLoader(configuration); @@ -969,7 +969,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundle19() { // test parent framework File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_BUNDLE_PARENT, Constants.FRAMEWORK_BUNDLE_PARENT_FRAMEWORK); checkParentClassLoader(configuration); @@ -1027,7 +1027,7 @@ public class SystemBundleTests extends AbstractBundleTests { // configure equinox for javaSE 8 File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.java.profile", javaSE8Profile.toExternalForm()); //$NON-NLS-1$ @@ -1037,7 +1037,7 @@ public class SystemBundleTests extends AbstractBundleTests { // install a bundle that requires java 8 BundleContext systemContext = equinox.getBundleContext(); assertNotNull("System context is null", systemContext); //$NON-NLS-1$ - Map<String, String> testHeaders = new HashMap<String, String>(); + Map<String, String> testHeaders = new HashMap<>(); testHeaders.put(Constants.BUNDLE_MANIFESTVERSION, "2"); testHeaders.put(Constants.BUNDLE_SYMBOLICNAME, getName()); testHeaders.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-1.8"); @@ -1108,7 +1108,7 @@ public class SystemBundleTests extends AbstractBundleTests { private void doMRUBundleFileList(int limit) { // create/start/stop/start/stop test File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.bundlefile.limit", Integer.toString(limit)); //$NON-NLS-1$//$NON-NLS-2$ @@ -1234,7 +1234,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testURLExternalFormat01() { // create multiple instances test File config1 = OSGiTestsActivator.getContext().getDataFile("testURLExternalFormat01_1"); //$NON-NLS-1$ - Map<String, Object> configuration1 = new HashMap<String, Object>(); + Map<String, Object> configuration1 = new HashMap<>(); configuration1.put(Constants.FRAMEWORK_STORAGE, config1.getAbsolutePath()); Equinox equinox1 = new Equinox(configuration1); try { @@ -1246,7 +1246,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox1.getState()); //$NON-NLS-1$ File config2 = OSGiTestsActivator.getContext().getDataFile("testURLExternalFormat01_2"); //$NON-NLS-1$ - Map<String, Object> configuration2 = new HashMap<String, Object>(); + Map<String, Object> configuration2 = new HashMap<>(); configuration2.put(Constants.FRAMEWORK_STORAGE, config2.getAbsolutePath()); Equinox equinox2 = new Equinox(configuration2); try { @@ -1340,7 +1340,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testURLMultiplexing01() throws BundleException { // create multiple instances of Equinox to test File config1 = OSGiTestsActivator.getContext().getDataFile(getName() + "_1"); - Map<String, Object> configuration1 = new HashMap<String, Object>(); + Map<String, Object> configuration1 = new HashMap<>(); configuration1.put(Constants.FRAMEWORK_STORAGE, config1.getAbsolutePath()); Equinox equinox1 = new Equinox(configuration1); try { @@ -1352,7 +1352,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("Wrong state for SystemBundle", Bundle.ACTIVE, equinox1.getState()); //$NON-NLS-1$ File config2 = OSGiTestsActivator.getContext().getDataFile(getName() + "_2"); //$NON-NLS-1$ - Map<String, Object> configuration2 = new HashMap<String, Object>(); + Map<String, Object> configuration2 = new HashMap<>(); configuration2.put(Constants.FRAMEWORK_STORAGE, config2.getAbsolutePath()); Equinox equinox2 = new Equinox(configuration2); try { @@ -1532,7 +1532,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBug304213() { // test installing bundle with empty manifest File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); @@ -1617,7 +1617,7 @@ public class SystemBundleTests extends AbstractBundleTests { try { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.dev", "../devCP"); Equinox equinox = new Equinox(configuration); @@ -1657,7 +1657,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBug352275() { // simple test to create an embedded framework File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, ""); Equinox equinox = new Equinox(configuration); @@ -1696,7 +1696,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testWeavingPersistence() { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -1839,7 +1839,7 @@ public class SystemBundleTests extends AbstractBundleTests { private void doTestBug351519Refresh(Boolean refreshDuplicates) { // Create a framework with equinox.refresh.duplicate.bsn=false configuration File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); if (refreshDuplicates != null) { configuration.put("equinox.refresh.duplicate.bsn", refreshDuplicates.toString()); @@ -1924,7 +1924,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBug375784() { // Create a framework with osgi.context.bootdelegation=true configuration File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.context.bootdelegation", "true"); Equinox equinox = new Equinox(configuration); @@ -1961,7 +1961,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBug258209_1() throws BundleException { // create a framework to test thread context class loaders File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); ClassLoader current = Thread.currentThread().getContextClassLoader(); @@ -2040,7 +2040,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBug413879() { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -2129,7 +2129,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBug414070() throws BundleException, InstantiationException, IllegalAccessException, ClassNotFoundException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.init(); @@ -2166,7 +2166,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("C is not active.", Bundle.ACTIVE, chainTestC.getState()); assertEquals("D is not active.", Bundle.ACTIVE, chainTestD.getState()); // record STOPPING order - final List<Bundle> stoppingOrder = new ArrayList<Bundle>(); + final List<Bundle> stoppingOrder = new ArrayList<>(); systemContext.addBundleListener(new SynchronousBundleListener() { @Override public void bundleChanged(BundleEvent event) { @@ -2189,7 +2189,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBug412228() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.init(); @@ -2225,7 +2225,7 @@ public class SystemBundleTests extends AbstractBundleTests { configIni.store(new FileOutputStream(new File(config, "config.ini")), "Test config.ini"); // Only provide substitution for the first prop System.setProperty("test.prop1", "PASSED"); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.init(); @@ -2250,7 +2250,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertNull("SecurityManager must be null to test.", sm); try { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -2298,7 +2298,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testNullConfigurationValue() throws BundleException { System.setProperty(nullTest, "system"); File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(nullTest, null); Equinox equinox = new Equinox(configuration); @@ -2316,7 +2316,7 @@ public class SystemBundleTests extends AbstractBundleTests { try { System.setProperty(Constants.FRAMEWORK_PROCESSOR, "hyperflux"); File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_PROCESSOR, null); Equinox equinox = new Equinox(configuration); @@ -2362,7 +2362,7 @@ public class SystemBundleTests extends AbstractBundleTests { EclipseStarter.PROP_LOGFILE // ); Properties systemProperties = (Properties) System.getProperties().clone(); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); for (Object key : systemProperties.keySet()) { configuration.put((String) key, null); } @@ -2388,7 +2388,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testNullConfigurationValueSystemProperties() throws BundleException { System.setProperty(nullTest, "system"); File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.framework.useSystemProperties", "true"); configuration.put(nullTest, null); @@ -2411,7 +2411,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBackedBySystemReplaceSystemProperties() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.framework.useSystemProperties", "true"); Equinox equinox = new Equinox(configuration); @@ -2446,7 +2446,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testLocalConfigReplaceSystemProperties() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.start(); @@ -2483,7 +2483,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemNLFragment() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.nl", "zh"); Equinox equinox = new Equinox(configuration); @@ -2518,7 +2518,7 @@ public class SystemBundleTests extends AbstractBundleTests { String originalCheckConfiguration = System.clearProperty(EquinoxConfiguration.PROP_CHECK_CONFIGURATION); try { File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.dev", "true"); Equinox equinox = new Equinox(configuration); @@ -2535,7 +2535,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testProvideOSGiEEandNative() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.equinox.allow.restricted.provides", "true"); @@ -2584,7 +2584,7 @@ public class SystemBundleTests extends AbstractBundleTests { // note that the embedded case the default for this setting is false configIni.setProperty(compatBootDelegate, "true"); configIni.store(new FileWriter(new File(config, "config.ini")), null); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.start(); @@ -2634,7 +2634,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testSystemBundleListener() throws BundleException, InterruptedException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); config.mkdirs(); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.start(); @@ -2671,7 +2671,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testContextBootDelegation() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); config.mkdirs(); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); @@ -2690,7 +2690,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testExtraSystemBundleHeaders() throws BundleException, InterruptedException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); config.mkdirs(); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=JavaSE; version:Version=1.7, something.system"); configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES, "something.system"); @@ -2825,7 +2825,7 @@ public class SystemBundleTests extends AbstractBundleTests { System.setProperty("java.specification.version", javaSpecVersion); // create/stop/ test File config = OSGiTestsActivator.getContext().getDataFile(getName() + javaSpecVersion); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); try { @@ -2931,7 +2931,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBug405919() throws Exception { File config = OSGiTestsActivator.getContext().getDataFile(getName()); config.mkdirs(); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.framework", "boo"); // Initialize and start a framework specifying an invalid osgi.framework configuration value. @@ -2990,7 +2990,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testInitialBundleUpdate() throws IOException { // test installing bundle with empty manifest File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); @@ -3049,7 +3049,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testDaemonActiveThread() throws BundleException, InterruptedException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); config.mkdirs(); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); // test setting to anything other than 'normal' @@ -3082,7 +3082,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testLazyTriggerOnLoadError() throws InterruptedException, BundleException { // create/start/stop/start/stop test File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(EquinoxConfiguration.PROP_COMPATIBILITY_START_LAZY_ON_FAIL_CLASSLOAD, "true"); Equinox equinox = new Equinox(configuration); @@ -3148,7 +3148,7 @@ public class SystemBundleTests extends AbstractBundleTests { configIni.setProperty("test.config", getName()); configIni.store(new FileOutputStream(new File(config, "config.ini")), "Test config.ini"); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.init(); @@ -3287,7 +3287,7 @@ public class SystemBundleTests extends AbstractBundleTests { BundleContext bc = equinox.getBundleContext(); ExtendedLogReaderService logReader = bc.getService(bc.getServiceReference(ExtendedLogReaderService.class)); ExtendedLogService log = bc.getService(bc.getServiceReference(ExtendedLogService.class)); - ArrayList<TestListener2> listeners = new ArrayList<TestListener2>(); + ArrayList<TestListener2> listeners = new ArrayList<>(); CountDownLatch latch = new CountDownLatch(logSize * listenersSize); for (int i = 0; i < listenersSize; i++) { @@ -3387,7 +3387,7 @@ public class SystemBundleTests extends AbstractBundleTests { FrameworkFactory factory = sLoader.iterator().next(); File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, String> configuration = new HashMap<String, String>(); + Map<String, String> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(EquinoxConfiguration.PROP_FRAMEWORK, relativeURL.toExternalForm()); @@ -3478,7 +3478,7 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("Did not finish start level setting.", 0, waitForStartLevel.getCount()); assertEquals("Did not install all the expected bundles.", numBundles, testBundles.size()); - List<Bundle> expectedStartOrder = new ArrayList<Bundle>(); + List<Bundle> expectedStartOrder = new ArrayList<>(); for (int i = 0; i < numBundles / 4; i++) { expectedStartOrder.add(testBundles.get(i)); } @@ -3534,7 +3534,7 @@ public class SystemBundleTests extends AbstractBundleTests { }; equinox.getBundleContext().addBundleListener(shutdownListener); - List<Bundle> expectedStopOrder = new ArrayList<Bundle>(expectedStartOrder); + List<Bundle> expectedStopOrder = new ArrayList<>(expectedStartOrder); Collections.reverse(expectedStopOrder); Collections.reverse(expectedStopOrder.subList(numBundles / 4, 3 * (numBundles / 4))); expectedStopOrder = new ArrayList(expectedStopOrder.subList(0, 3 * (numBundles / 4))); @@ -3807,7 +3807,7 @@ public class SystemBundleTests extends AbstractBundleTests { public void testBundleIDLock() { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(EquinoxConfiguration.PROP_FILE_LIMIT, "10"); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); @@ -3838,7 +3838,7 @@ public class SystemBundleTests extends AbstractBundleTests { } ExecutorService executor = Executors.newFixedThreadPool(50); - final List<Throwable> errors = new CopyOnWriteArrayList<Throwable>(); + final List<Throwable> errors = new CopyOnWriteArrayList<>(); try { for (final File testBundleFile : testBundles) { executor.execute(new Runnable() { @@ -3896,7 +3896,7 @@ public class SystemBundleTests extends AbstractBundleTests { debugProps.store(debugOut, "Equinox Debug Options"); debugOut.close(); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(EquinoxConfiguration.PROP_FILE_LIMIT, "10"); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); //configuration.put(EquinoxConfiguration.PROP_DEBUG, debugOptions.getAbsolutePath()); @@ -3964,7 +3964,7 @@ public class SystemBundleTests extends AbstractBundleTests { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ config.mkdirs(); - Map<String, String> bundleHeaders = new HashMap<String, String>(); + Map<String, String> bundleHeaders = new HashMap<>(); bundleHeaders.put(Constants.BUNDLE_MANIFESTVERSION, "2"); bundleHeaders.put(Constants.BUNDLE_SYMBOLICNAME, getName()); Map<String, String> bundleEntries = new LinkedHashMap<>(); @@ -3976,7 +3976,7 @@ public class SystemBundleTests extends AbstractBundleTests { bundleEntries.put("dirA/dirC/fileC", "fileC"); File testBundleFile = SystemBundleTests.createBundle(config, getName(), bundleHeaders, bundleEntries); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); final Equinox equinox = new Equinox(configuration); @@ -3994,7 +3994,7 @@ public class SystemBundleTests extends AbstractBundleTests { final Bundle testBundle = systemContext.installBundle("file:///" + testBundleFile.getAbsolutePath()); testBundle.start(); - final List<FrameworkEvent> errorsAndWarnings = new CopyOnWriteArrayList<FrameworkEvent>(); + final List<FrameworkEvent> errorsAndWarnings = new CopyOnWriteArrayList<>(); FrameworkListener fwkListener = new FrameworkListener() { @Override public void frameworkEvent(FrameworkEvent event) { @@ -4120,7 +4120,7 @@ public class SystemBundleTests extends AbstractBundleTests { equinox.init(); BundleContext bc = equinox.getBundleContext(); - Map<String, String> h2 = new HashMap<String, String>(); + Map<String, String> h2 = new HashMap<>(); h2.put(Constants.BUNDLE_MANIFESTVERSION, "2"); h2.put(Constants.BUNDLE_SYMBOLICNAME, getName() + ".dynamicimporter"); h2.put(Constants.DYNAMICIMPORT_PACKAGE, "some.system.*; version=1.0"); @@ -4128,7 +4128,7 @@ public class SystemBundleTests extends AbstractBundleTests { Bundle b2 = bc.installBundle("reference:file:///" + f2.getAbsolutePath()); //$NON-NLS-1$ b2.getResource("does/not/exist.txt"); - Map<String, String> h1 = new HashMap<String, String>(); + Map<String, String> h1 = new HashMap<>(); h1.put(Constants.BUNDLE_MANIFESTVERSION, "2"); h1.put(Constants.BUNDLE_SYMBOLICNAME, getName() + ".exporter"); h1.put(Constants.EXPORT_PACKAGE, "some.system.pkg; version=1.0"); @@ -4162,7 +4162,7 @@ public class SystemBundleTests extends AbstractBundleTests { // fail if it takes too long. public void testMassiveParallelInstallStart() { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); final Equinox equinox = new Equinox(configuration); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AbstractTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AbstractTest.java index 731706f21..061c86bc4 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AbstractTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AbstractTest.java @@ -43,7 +43,7 @@ public abstract class AbstractTest { @Before public void setUp() { - serviceRegistrations = new HashSet<ServiceRegistration<?>>(); + serviceRegistrations = new HashSet<>(); } @After diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java index 46e89750f..bb48c72b4 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java @@ -136,7 +136,7 @@ public class TestModuleContainer extends AbstractTest { ModuleRevisionBuilder systembuilder = OSGiManifestBuilderFactory.createBuilder(asMap(systemBundle.getHeaders("")), Constants.SYSTEM_BUNDLE_SYMBOLICNAME, extraPackages, extraCapabilities); container.install(null, systemBundle.getLocation(), systembuilder, null); - final List<Throwable> installErrors = new ArrayList<Throwable>(0); + final List<Throwable> installErrors = new ArrayList<>(0); // just trying to pound the container with a bunch of installs ExecutorService executor = Executors.newFixedThreadPool(10); Bundle[] bundles = context.getBundles(); @@ -180,7 +180,7 @@ public class TestModuleContainer extends AbstractTest { } static <K, V> Map<K, V> asMap(Dictionary<K, V> dictionary) { - Map<K, V> map = new HashMap<K, V>(); + Map<K, V> map = new HashMap<>(); for (Enumeration<K> eKeys = dictionary.keys(); eKeys.hasMoreElements();) { K key = eKeys.nextElement(); V value = dictionary.get(key); @@ -585,7 +585,7 @@ public class TestModuleContainer extends AbstractTest { @Test public void testSingleton04() throws BundleException, IOException { - final Collection<BundleRevision> disabled = new ArrayList<BundleRevision>(); + final Collection<BundleRevision> disabled = new ArrayList<>(); ResolverHookFactory resolverHookFactory = new ResolverHookFactory() { @Override @@ -698,7 +698,7 @@ public class TestModuleContainer extends AbstractTest { container.resolve(Arrays.asList(c1, c2, c3, c4, c5, c6, c7), true); List<DummyModuleEvent> actual = database.getModuleEvents(); - List<DummyModuleEvent> expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED))); + List<DummyModuleEvent> expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED))); assertEvents(expected, actual, false); } @@ -726,7 +726,7 @@ public class TestModuleContainer extends AbstractTest { container.refresh(Arrays.asList(systemBundle)); List<DummyModuleEvent> actual = database.getModuleEvents(); - List<DummyModuleEvent> expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c2, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c3, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c5, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(systemBundle, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), + List<DummyModuleEvent> expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c2, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c3, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c5, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(systemBundle, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED))); assertEvents(expected, actual, false); } @@ -757,7 +757,7 @@ public class TestModuleContainer extends AbstractTest { c7.start(); List<DummyModuleEvent> actual = database.getModuleEvents(); - List<DummyModuleEvent> expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE))); + List<DummyModuleEvent> expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, false); } @@ -783,8 +783,8 @@ public class TestModuleContainer extends AbstractTest { database.getModuleEvents(); container.refresh(Arrays.asList(c4)); List<DummyModuleEvent> actual = database.getModuleEvents(); - List<DummyModuleEvent> expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c5, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED), - new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE))); + List<DummyModuleEvent> expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c5, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, false); } @@ -840,7 +840,7 @@ public class TestModuleContainer extends AbstractTest { Assert.assertEquals("Wrong number of removal pending", 0, removalPending.size()); List<DummyModuleEvent> actual = database.getModuleEvents(); - List<DummyModuleEvent> expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), + List<DummyModuleEvent> expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), @@ -858,7 +858,7 @@ public class TestModuleContainer extends AbstractTest { container.refresh(null); actual = database.getModuleEvents(); - expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UNINSTALLED, State.UNINSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UNINSTALLED, State.UNINSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED))); assertEvents(expected, actual, false); // Test bug 411833 @@ -881,7 +881,7 @@ public class TestModuleContainer extends AbstractTest { container.refresh(Collections.singletonList(c6)); actual = database.getModuleEvents(); - expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UNINSTALLED, State.UNINSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UNINSTALLED, State.UNINSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED))); assertEvents(expected, actual, false); removalPending = container.getRemovalPending(); @@ -942,7 +942,7 @@ public class TestModuleContainer extends AbstractTest { List<ModuleWire> providedWiresA = wiringA.getProvidedModuleWires(PackageNamespace.PACKAGE_NAMESPACE); Assert.assertEquals("Wrong number of provided wires.", 2, providedWiresA.size()); - Collection<ModuleRevision> requirers = new ArrayList<ModuleRevision>(); + Collection<ModuleRevision> requirers = new ArrayList<>(); for (ModuleWire wire : providedWiresA) { requirers.add(wire.getRequirer()); } @@ -994,7 +994,7 @@ public class TestModuleContainer extends AbstractTest { List<ModuleWire> providedWiresE = wiringE.getProvidedModuleWires(PackageNamespace.PACKAGE_NAMESPACE); Assert.assertEquals("Wrong number of provided wires.", 3, providedWiresE.size()); - Collection<ModuleRevision> requirers = new HashSet<ModuleRevision>(); + Collection<ModuleRevision> requirers = new HashSet<>(); for (ModuleWire wire : providedWiresE) { requirers.add(wire.getRequirer()); } @@ -1054,29 +1054,29 @@ public class TestModuleContainer extends AbstractTest { lazy1.start(StartOptions.USE_ACTIVATION_POLICY); List<DummyModuleEvent> actual = database.getModuleEvents(); - List<DummyModuleEvent> expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); + List<DummyModuleEvent> expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); assertEvents(expected, actual, true); lazy1.start(StartOptions.LAZY_TRIGGER); actual = database.getModuleEvents(); - expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(lazy1, ModuleEvent.STARTED, State.ACTIVE))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(lazy1, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, true); container.refresh(Arrays.asList(lazy1)); actual = database.getModuleEvents(); - expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); assertEvents(expected, actual, true); container.update(lazy1, OSGiManifestBuilderFactory.createBuilder(getManifest("lazy1_v1.MF")), null); actual = database.getModuleEvents(); - expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); assertEvents(expected, actual, true); container.refresh(Arrays.asList(lazy1)); actual = database.getModuleEvents(); - expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); assertEvents(expected, actual, true); } @@ -1120,11 +1120,11 @@ public class TestModuleContainer extends AbstractTest { container.getFrameworkStartLevel().setStartLevel(3); List<DummyContainerEvent> actualContainerEvents = database.getContainerEvents(1); - List<DummyContainerEvent> expectedContainerEvents = new ArrayList<DummyContainerEvent>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); + List<DummyContainerEvent> expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); Assert.assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); actual = database.getModuleEvents(3); - List<DummyModuleEvent> expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE))); + List<DummyModuleEvent> expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, true); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -1160,20 +1160,20 @@ public class TestModuleContainer extends AbstractTest { systemBundle.start(); actualContainerEvents = database.getContainerEvents(); - expectedContainerEvents = new ArrayList<DummyContainerEvent>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null), new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); + expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null), new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); actual = database.getModuleEvents(2); - expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, true); container.getFrameworkStartLevel().setStartLevel(3); actualContainerEvents = database.getContainerEvents(1); - expectedContainerEvents = new ArrayList<DummyContainerEvent>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); + expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); Assert.assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); actual = database.getModuleEvents(3); - expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, true); } @@ -1220,7 +1220,7 @@ public class TestModuleContainer extends AbstractTest { } private void doTestEventsStartLevel(int beginningStartLevel) throws BundleException, IOException { - Map<String, String> configuration = new HashMap<String, String>(); + Map<String, String> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_BEGINNING_STARTLEVEL, String.valueOf(beginningStartLevel)); DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), configuration); @@ -1264,41 +1264,41 @@ public class TestModuleContainer extends AbstractTest { if (beginningStartLevel == 1) { actualModuleEvents = database.getModuleEvents(2); - List<DummyModuleEvent> expectedModuleEvents = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); + List<DummyModuleEvent> expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expectedModuleEvents, actualModuleEvents, true); List<DummyContainerEvent> actualContainerEvents = database.getContainerEvents(); - List<DummyContainerEvent> expectedContainerEvents = new ArrayList<DummyContainerEvent>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); + List<DummyContainerEvent> expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); Assert.assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); container.getFrameworkStartLevel().setStartLevel(100); actualModuleEvents = database.getModuleEvents(14); - expectedModuleEvents = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c6, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c6, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c5, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c5, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c3, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c3, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c2, ModuleEvent.STARTING, State.STARTING), + expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c6, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c6, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c5, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c5, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c3, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c3, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c2, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c2, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c1, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c1, ModuleEvent.STARTED, State.ACTIVE))); actualContainerEvents = database.getContainerEvents(1); - expectedContainerEvents = new ArrayList<DummyContainerEvent>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); + expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); Assert.assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); } else { actualModuleEvents = database.getModuleEvents(16); - List<DummyModuleEvent> expectedModuleEvents = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c6, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c6, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c5, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c5, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c3, ModuleEvent.STARTING, State.STARTING), - new DummyModuleEvent(c3, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c2, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c2, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c1, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c1, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); + List<DummyModuleEvent> expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c6, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c6, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c5, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c5, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c3, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c3, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c2, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c2, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c1, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c1, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expectedModuleEvents, actualModuleEvents, true); List<DummyContainerEvent> actualContainerEvents = database.getContainerEvents(); - List<DummyContainerEvent> expectedContainerEvents = new ArrayList<DummyContainerEvent>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); + List<DummyContainerEvent> expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); Assert.assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); } if (beginningStartLevel == 1) { container.getFrameworkStartLevel().setStartLevel(1); actualModuleEvents = database.getModuleEvents(14); - List<DummyModuleEvent> expectedModuleEvents = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c2, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c3, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c4, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c5, ModuleEvent.STOPPED, State.RESOLVED), - new DummyModuleEvent(c6, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c6, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED))); + List<DummyModuleEvent> expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c2, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c3, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c4, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c5, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c6, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED))); assertEvents(expectedModuleEvents, actualModuleEvents, true); List<DummyContainerEvent> actualContainerEvents = database.getContainerEvents(1); - List<DummyContainerEvent> expectedContainerEvents = new ArrayList<DummyContainerEvent>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); + List<DummyContainerEvent> expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); Assert.assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); } @@ -1306,16 +1306,16 @@ public class TestModuleContainer extends AbstractTest { if (beginningStartLevel == 1) { actualModuleEvents = database.getModuleEvents(2); - List<DummyModuleEvent> expectedModuleEvents = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(systemBundle, ModuleEvent.STOPPED, State.RESOLVED))); + List<DummyModuleEvent> expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(systemBundle, ModuleEvent.STOPPED, State.RESOLVED))); assertEvents(expectedModuleEvents, actualModuleEvents, true); } else { actualModuleEvents = database.getModuleEvents(16); - List<DummyModuleEvent> expectedModuleEvents = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c2, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c3, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c4, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.STOPPING, State.STOPPING), - new DummyModuleEvent(c5, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c6, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(systemBundle, ModuleEvent.STOPPED, State.RESOLVED))); + List<DummyModuleEvent> expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c2, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c3, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c4, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c5, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c6, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c6, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(systemBundle, ModuleEvent.STOPPED, State.RESOLVED))); assertEvents(expectedModuleEvents, actualModuleEvents, true); } List<DummyContainerEvent> actualContainerEvents = database.getContainerEvents(); - List<DummyContainerEvent> expectedContainerEvents = new ArrayList<DummyContainerEvent>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STOPPED, systemBundle, null))); + List<DummyContainerEvent> expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STOPPED, systemBundle, null))); Assert.assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); } @@ -1842,7 +1842,7 @@ public class TestModuleContainer extends AbstractTest { // idle timeout; make it short to get rid of threads quickly after resolve int idleTimeout = 5; // use sync queue to force thread creation - BlockingQueue<Runnable> queue = new SynchronousQueue<Runnable>(); + BlockingQueue<Runnable> queue = new SynchronousQueue<>(); // try to name the threads with useful name ThreadFactory threadFactory = new ThreadFactory() { @Override @@ -1862,7 +1862,7 @@ public class TestModuleContainer extends AbstractTest { ExecutorService executor = new ThreadPoolExecutor(coreThreads, maxThreads, idleTimeout, TimeUnit.SECONDS, queue, threadFactory, rejectHandler); ScheduledExecutorService timeoutExecutor = new ScheduledThreadPoolExecutor(1); - Map<String, String> configuration = new HashMap<String, String>(); + Map<String, String> configuration = new HashMap<>(); configuration.put(EquinoxConfiguration.PROP_RESOLVER_BATCH_TIMEOUT, "5000"); Map<String, String> debugOpts = Collections.emptyMap(); DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), configuration, new DummyResolverHookFactory(), new DummyDebugOptions(debugOpts)); @@ -1887,35 +1887,35 @@ public class TestModuleContainer extends AbstractTest { } private List<Map<String, String>> getUsesTimeoutManifests(String prefix) { - List<Map<String, String>> result = new ArrayList<Map<String, String>>(); + List<Map<String, String>> result = new ArrayList<>(); // x1 bundle - Map<String, String> x1Manifest = new HashMap<String, String>(); + Map<String, String> x1Manifest = new HashMap<>(); x1Manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); x1Manifest.put(Constants.BUNDLE_SYMBOLICNAME, prefix + ".x1"); x1Manifest.put(Constants.EXPORT_PACKAGE, prefix + ".a; version=1.0; uses:=" + prefix + ".b"); x1Manifest.put(Constants.IMPORT_PACKAGE, prefix + ".b; version=\"[1.1,1.2)\""); result.add(x1Manifest); // x2 bundle - Map<String, String> x2Manifest = new HashMap<String, String>(); + Map<String, String> x2Manifest = new HashMap<>(); x2Manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); x2Manifest.put(Constants.BUNDLE_SYMBOLICNAME, prefix + ".x2"); x2Manifest.put(Constants.EXPORT_PACKAGE, prefix + ".a; version=1.1; uses:=" + prefix + ".b"); x2Manifest.put(Constants.IMPORT_PACKAGE, prefix + ".b; version=\"[1.0,1.1)\""); result.add(x2Manifest); // y1 bundle - Map<String, String> y1Manifest = new HashMap<String, String>(); + Map<String, String> y1Manifest = new HashMap<>(); y1Manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); y1Manifest.put(Constants.BUNDLE_SYMBOLICNAME, prefix + ".y1"); y1Manifest.put(Constants.EXPORT_PACKAGE, prefix + ".b; version=1.0"); result.add(y1Manifest); // y1 bundle - Map<String, String> y2Manifest = new HashMap<String, String>(); + Map<String, String> y2Manifest = new HashMap<>(); y2Manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); y2Manifest.put(Constants.BUNDLE_SYMBOLICNAME, prefix + ".y2"); y2Manifest.put(Constants.EXPORT_PACKAGE, prefix + ".b; version=1.1"); result.add(y2Manifest); // z1 bundle - Map<String, String> z1Manifest = new HashMap<String, String>(); + Map<String, String> z1Manifest = new HashMap<>(); z1Manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); z1Manifest.put(Constants.BUNDLE_SYMBOLICNAME, prefix + ".z1"); z1Manifest.put(Constants.IMPORT_PACKAGE, prefix + ".a, " + prefix + ".b"); @@ -2175,7 +2175,7 @@ public class TestModuleContainer extends AbstractTest { Assert.assertNull("Failed to resolve system.bundle.", report.getResolutionException()); // install bundle with Bundle-NativeCode - Map<String, String> nativeCodeManifest = new HashMap<String, String>(); + Map<String, String> nativeCodeManifest = new HashMap<>(); nativeCodeManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); nativeCodeManifest.put(Constants.BUNDLE_SYMBOLICNAME, "importer"); nativeCodeManifest.put(Constants.BUNDLE_NATIVECODE, // @@ -2222,7 +2222,7 @@ public class TestModuleContainer extends AbstractTest { Assert.assertNull("Failed to resolve system.bundle.", report.getResolutionException()); // install an importer - Map<String, String> optionalImporterManifest = new HashMap<String, String>(); + Map<String, String> optionalImporterManifest = new HashMap<>(); optionalImporterManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); optionalImporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "importer"); optionalImporterManifest.put(Constants.IMPORT_PACKAGE, "exporter; resolution:=optional"); @@ -2239,7 +2239,7 @@ public class TestModuleContainer extends AbstractTest { assertEquals("Import was not dynamic", PackageNamespace.RESOLUTION_DYNAMIC, importReqsList.get(0).getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)); // install a exporter to satisfy existing optional import - Map<String, String> exporterManifest = new HashMap<String, String>(); + Map<String, String> exporterManifest = new HashMap<>(); exporterManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); exporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "exporter"); exporterManifest.put(Constants.EXPORT_PACKAGE, "exporter"); @@ -2269,7 +2269,7 @@ public class TestModuleContainer extends AbstractTest { Assert.assertNull("Failed to resolve system.bundle.", report.getResolutionException()); // install an importer - Map<String, String> optionalImporterManifest = new HashMap<String, String>(); + Map<String, String> optionalImporterManifest = new HashMap<>(); optionalImporterManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); optionalImporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "importer"); optionalImporterManifest.put(Constants.EXPORT_PACKAGE, "exporter"); @@ -2300,7 +2300,7 @@ public class TestModuleContainer extends AbstractTest { Assert.assertNull("Failed to resolve system.bundle.", report.getResolutionException()); // install an exporter with substitutable export. - Map<String, String> exporterManifest = new HashMap<String, String>(); + Map<String, String> exporterManifest = new HashMap<>(); exporterManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); exporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "exporter"); exporterManifest.put(Constants.EXPORT_PACKAGE, "exporter"); @@ -2313,7 +2313,7 @@ public class TestModuleContainer extends AbstractTest { container.uninstall(moduleSubsExport); - exporterManifest = new HashMap<String, String>(); + exporterManifest = new HashMap<>(); exporterManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); exporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "substitutableExporter"); exporterManifest.put(Constants.EXPORT_PACKAGE, "exporter"); @@ -2321,7 +2321,7 @@ public class TestModuleContainer extends AbstractTest { moduleSubsExport = installDummyModule(exporterManifest, "substitutableExporter", container); - exporterManifest = new HashMap<String, String>(); + exporterManifest = new HashMap<>(); exporterManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); exporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "exporter"); exporterManifest.put(Constants.EXPORT_PACKAGE, "exporter; pickme=true"); @@ -2352,8 +2352,8 @@ public class TestModuleContainer extends AbstractTest { Assert.assertNull("Failed to resolve system.bundle.", report.getResolutionException()); //R3 bundle - Map<String, String> exporterManifest = new HashMap<String, String>(); - exporterManifest = new HashMap<String, String>(); + Map<String, String> exporterManifest = new HashMap<>(); + exporterManifest = new HashMap<>(); exporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "exporter"); exporterManifest.put(Constants.EXPORT_PACKAGE, "exporter; version=\"1.1\""); @@ -2408,7 +2408,7 @@ public class TestModuleContainer extends AbstractTest { // install the system.bundle installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); - Map<String, Object> attrs = new HashMap<String, Object>(); + Map<String, Object> attrs = new HashMap<>(); attrs.put("string", "sValue"); attrs.put("string.list1", Arrays.asList("v1", "v2", "v3")); attrs.put("string.list2", Arrays.asList("v4", "v5", "v6")); @@ -2422,7 +2422,7 @@ public class TestModuleContainer extends AbstractTest { attrs.put("set", Arrays.asList("s1", "s2", "s3")); // provider with all supported types - Map<String, String> providerManifest = new HashMap<String, String>(); + Map<String, String> providerManifest = new HashMap<>(); providerManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); providerManifest.put(Constants.BUNDLE_SYMBOLICNAME, "provider"); providerManifest.put(Constants.EXPORT_PACKAGE, "provider; version=1.1; attr1=attr1; attr2=attr2; dir1:=dir1; dir2:=dir2"); @@ -2442,7 +2442,7 @@ public class TestModuleContainer extends AbstractTest { Map<String, Object> providerAttrs = providerModule.getCurrentRevision().getCapabilities("provider.cap").get(0).getAttributes(); assertEquals("Wrong provider attrs", attrs, providerAttrs); - Map<String, String> requirerManifest = new HashMap<String, String>(); + Map<String, String> requirerManifest = new HashMap<>(); requirerManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); requirerManifest.put(Constants.BUNDLE_SYMBOLICNAME, "requirer"); requirerManifest.put(Constants.IMPORT_PACKAGE, "provider; version=1.1; attr1=attr1; attr2=attr2; dir1:=dir1; dir2:=dir2"); @@ -2507,7 +2507,7 @@ public class TestModuleContainer extends AbstractTest { installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); // provider with all supported types - Map<String, String> invalidAttrManifest = new HashMap<String, String>(); + Map<String, String> invalidAttrManifest = new HashMap<>(); invalidAttrManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); invalidAttrManifest.put(Constants.BUNDLE_SYMBOLICNAME, "invalid"); @@ -2638,7 +2638,7 @@ public class TestModuleContainer extends AbstractTest { systemBundle.start(); // install a module - Map<String, String> manifest = new HashMap<String, String>(); + Map<String, String> manifest = new HashMap<>(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "module.test"); Module module = installDummyModule(manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), container); @@ -2661,14 +2661,14 @@ public class TestModuleContainer extends AbstractTest { Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); // install an equinox fragment - Map<String, String> equinoxFragManifest = new HashMap<String, String>(); + Map<String, String> equinoxFragManifest = new HashMap<>(); equinoxFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); equinoxFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "equinoxFrag"); equinoxFragManifest.put(Constants.FRAGMENT_HOST, "org.eclipse.osgi"); Module equinoxFrag = installDummyModule(equinoxFragManifest, "equinoxFrag", container); // install a system.bundle fragment - Map<String, String> systemFragManifest = new HashMap<String, String>(); + Map<String, String> systemFragManifest = new HashMap<>(); systemFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag"); systemFragManifest.put(Constants.FRAGMENT_HOST, "system.bundle"); @@ -2693,7 +2693,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = adaptor.getContainer(); // install a host - Map<String, String> hostManifest = new HashMap<String, String>(); + Map<String, String> hostManifest = new HashMap<>(); hostManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); hostManifest.put(Constants.BUNDLE_SYMBOLICNAME, "host"); hostManifest.put(Constants.BUNDLE_VERSION, "1.0"); @@ -2708,7 +2708,7 @@ public class TestModuleContainer extends AbstractTest { //installDummyModule(hostManifest, "host13", container); // install a host.impl fragment - Map<String, String> hostImplManifest = new HashMap<String, String>(); + Map<String, String> hostImplManifest = new HashMap<>(); hostImplManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); hostImplManifest.put(Constants.BUNDLE_SYMBOLICNAME, "host.impl"); hostImplManifest.put(Constants.EXPORT_PACKAGE, "host.impl"); @@ -2717,7 +2717,7 @@ public class TestModuleContainer extends AbstractTest { installDummyModule(hostImplManifest, "hostImpl", container); // install an importer of host package - Map<String, String> hostImporterManifest = new HashMap<String, String>(); + Map<String, String> hostImporterManifest = new HashMap<>(); hostImporterManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); hostImporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "host.importer"); hostImporterManifest.put(Constants.IMPORT_PACKAGE, "host"); @@ -2733,7 +2733,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = adaptor.getContainer(); // install an exporter - Map<String, String> exporterManifest = new HashMap<String, String>(); + Map<String, String> exporterManifest = new HashMap<>(); exporterManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); exporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "exporter"); exporterManifest.put(Constants.BUNDLE_VERSION, "1.0"); @@ -2741,7 +2741,7 @@ public class TestModuleContainer extends AbstractTest { installDummyModule(exporterManifest, "exporter", container); // install a fragment to the exporter - Map<String, String> exporterFragManifest = new HashMap<String, String>(); + Map<String, String> exporterFragManifest = new HashMap<>(); exporterFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); exporterFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "exporter.frag"); exporterFragManifest.put(Constants.EXPORT_PACKAGE, "exporter.frag"); @@ -2749,7 +2749,7 @@ public class TestModuleContainer extends AbstractTest { installDummyModule(exporterFragManifest, "exporter.frag", container); // install a host that imports the exporter - Map<String, String> hostManifest = new HashMap<String, String>(); + Map<String, String> hostManifest = new HashMap<>(); hostManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); hostManifest.put(Constants.BUNDLE_SYMBOLICNAME, "host"); hostManifest.put(Constants.BUNDLE_VERSION, "1.0"); @@ -2761,7 +2761,7 @@ public class TestModuleContainer extends AbstractTest { installDummyModule(hostManifest, "host12", container); // install a fragment that also imports the exporter - Map<String, String> hostFragManifest = new HashMap<String, String>(); + Map<String, String> hostFragManifest = new HashMap<>(); hostFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); hostFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "host.frag"); hostFragManifest.put(Constants.FRAGMENT_HOST, "host"); @@ -2778,7 +2778,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = adaptor.getContainer(); // install a test module - Map<String, String> testManifest = new HashMap<String, String>(); + Map<String, String> testManifest = new HashMap<>(); testManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); testManifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.name"); testManifest.put(Constants.BUNDLE_VERSION, "1.0"); @@ -2803,7 +2803,7 @@ public class TestModuleContainer extends AbstractTest { } private void doTestStartOnResolve(boolean enabled) throws BundleException, IOException { - Map<String, String> configuration = new HashMap<String, String>(); + Map<String, String> configuration = new HashMap<>(); if (!enabled) { configuration.put(EquinoxConfiguration.PROP_MODULE_AUTO_START_ON_RESOLVE, Boolean.toString(false)); } @@ -2817,8 +2817,8 @@ public class TestModuleContainer extends AbstractTest { systemBundle.start(); // install a bunch of modules - Map<String, String> manifest = new HashMap<String, String>(); - List<Module> modules = new ArrayList<Module>(); + Map<String, String> manifest = new HashMap<>(); + List<Module> modules = new ArrayList<>(); for (int i = 0; i < 5; i++) { manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -2861,8 +2861,8 @@ public class TestModuleContainer extends AbstractTest { systemBundle.start(); // install a bunch of modules - Map<String, String> manifest = new HashMap<String, String>(); - List<Module> modules = new ArrayList<Module>(); + Map<String, String> manifest = new HashMap<>(); + List<Module> modules = new ArrayList<>(); for (int i = 0; i < 5; i++) { manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -2870,7 +2870,7 @@ public class TestModuleContainer extends AbstractTest { modules.add(installDummyModule(manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), container)); } adaptor.setSlowdownEvents(true); - final ConcurrentLinkedQueue<BundleException> startErrors = new ConcurrentLinkedQueue<BundleException>(); + final ConcurrentLinkedQueue<BundleException> startErrors = new ConcurrentLinkedQueue<>(); final ExecutorService executor = Executors.newFixedThreadPool(5); try { for (final Module module : modules) { @@ -2916,7 +2916,7 @@ public class TestModuleContainer extends AbstractTest { // Don't do this again return; } - Map<String, String> manifest = new HashMap<String, String>(); + Map<String, String> manifest = new HashMap<>(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "module.recurse." + nextId); try { @@ -2974,7 +2974,7 @@ public class TestModuleContainer extends AbstractTest { systemBundle.start(); // install a bundle to do dynamic resolution from - Map<String, String> manifest = new HashMap<String, String>(); + Map<String, String> manifest = new HashMap<>(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "dynamicImport"); manifest.put(Constants.DYNAMICIMPORT_PACKAGE, "*"); @@ -3009,7 +3009,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = systemBundle.getContainer(); // install an system.bundle fragment that imports framework package - Map<String, String> systemFragManifest = new HashMap<String, String>(); + Map<String, String> systemFragManifest = new HashMap<>(); systemFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag"); systemFragManifest.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3035,7 +3035,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = systemBundle.getContainer(); // install an system.bundle fragment that imports framework package - Map<String, String> systemFragManifest = new HashMap<String, String>(); + Map<String, String> systemFragManifest = new HashMap<>(); systemFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag"); systemFragManifest.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3065,7 +3065,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = systemBundle.getContainer(); // install an system.bundle fragment that requires a payload requirement from system.bundle - Map<String, String> systemFragManifest = new HashMap<String, String>(); + Map<String, String> systemFragManifest = new HashMap<>(); systemFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag"); systemFragManifest.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3097,7 +3097,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = systemBundle.getContainer(); // install an system.bundle fragment that provides a capability - Map<String, String> systemFragManifest1 = new HashMap<String, String>(); + Map<String, String> systemFragManifest1 = new HashMap<>(); systemFragManifest1.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest1.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag1"); systemFragManifest1.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3105,7 +3105,7 @@ public class TestModuleContainer extends AbstractTest { Module systemFrag1 = installDummyModule(systemFragManifest1, "systemFrag1", container); // install an system.bundle fragment that requires a fragment capability - Map<String, String> systemFragManifest2 = new HashMap<String, String>(); + Map<String, String> systemFragManifest2 = new HashMap<>(); systemFragManifest2.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest2.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag2"); systemFragManifest2.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3137,7 +3137,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = systemBundle.getContainer(); // install an system.bundle fragment that provides a capability - Map<String, String> systemFragManifest1 = new HashMap<String, String>(); + Map<String, String> systemFragManifest1 = new HashMap<>(); systemFragManifest1.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest1.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag1"); systemFragManifest1.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3145,7 +3145,7 @@ public class TestModuleContainer extends AbstractTest { Module systemFrag1 = installDummyModule(systemFragManifest1, "systemFrag1", container); // install an system.bundle fragment that requires a fragment capability, but fails to match - Map<String, String> systemFragManifest2 = new HashMap<String, String>(); + Map<String, String> systemFragManifest2 = new HashMap<>(); systemFragManifest2.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest2.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag2"); systemFragManifest2.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3154,7 +3154,7 @@ public class TestModuleContainer extends AbstractTest { Module systemFrag2 = installDummyModule(systemFragManifest2, "systemFrag2", container); // install an system.bundle fragment that requires a fragment capability from a fragment that fails to resolve - Map<String, String> systemFragManifest3 = new HashMap<String, String>(); + Map<String, String> systemFragManifest3 = new HashMap<>(); systemFragManifest3.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest3.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag3"); systemFragManifest3.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3171,7 +3171,7 @@ public class TestModuleContainer extends AbstractTest { assertWires(systemFrag1HostWires, hostWires); // install a bundle that can satisfy the failed requirement, but it should not be allowed since it is not a fragment - Map<String, String> provideCapabilityManifest1 = new HashMap<String, String>(); + Map<String, String> provideCapabilityManifest1 = new HashMap<>(); provideCapabilityManifest1.put(Constants.BUNDLE_MANIFESTVERSION, "2"); provideCapabilityManifest1.put(Constants.BUNDLE_SYMBOLICNAME, "provideCapabilityBundle1"); provideCapabilityManifest1.put(Constants.PROVIDE_CAPABILITY, "fragment.capability; fragment.capability=test4"); @@ -3183,7 +3183,7 @@ public class TestModuleContainer extends AbstractTest { assertWires(systemFrag1HostWires, hostWires); // install a fragment that satisfies the failed requirement - Map<String, String> systemFragManifest4 = new HashMap<String, String>(); + Map<String, String> systemFragManifest4 = new HashMap<>(); systemFragManifest4.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest4.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag4"); systemFragManifest4.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); @@ -3207,8 +3207,8 @@ public class TestModuleContainer extends AbstractTest { List<ModuleCapability> fragmentCapabilities = systemBundle.getCurrentRevision().getWiring().getModuleCapabilities("fragment.capability"); assertEquals("Wrong number of fragment capabilities.", 4, fragmentCapabilities.size()); // Use set since the order of required and provided wires will be different - Set<ModuleWire> hostRequiredFragmentCapWires = new HashSet<ModuleWire>(systemBundle.getCurrentRevision().getWiring().getRequiredModuleWires("fragment.capability")); - Set<ModuleWire> hostProvidedFragmentCapWires = new HashSet<ModuleWire>(systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires("fragment.capability")); + Set<ModuleWire> hostRequiredFragmentCapWires = new HashSet<>(systemBundle.getCurrentRevision().getWiring().getRequiredModuleWires("fragment.capability")); + Set<ModuleWire> hostProvidedFragmentCapWires = new HashSet<>(systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires("fragment.capability")); assertEquals("Wrong number of wires.", 2, hostProvidedFragmentCapWires.size()); assertEquals("Wrong wires found from host.", hostRequiredFragmentCapWires, hostProvidedFragmentCapWires); } @@ -3220,7 +3220,7 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = systemBundle.getContainer(); // install multiple versions of the same fragment - Map<String, String> systemFragManifest1 = new HashMap<String, String>(); + Map<String, String> systemFragManifest1 = new HashMap<>(); systemFragManifest1.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest1.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag"); systemFragManifest1.put(Constants.BUNDLE_VERSION, "1.0"); @@ -3236,14 +3236,14 @@ public class TestModuleContainer extends AbstractTest { List<ModuleWire> systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); assertWires(systemFrag1HostWires, hostWires); - Map<String, String> systemFragManifest2 = new HashMap<String, String>(); + Map<String, String> systemFragManifest2 = new HashMap<>(); systemFragManifest2.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest2.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag"); systemFragManifest2.put(Constants.BUNDLE_VERSION, "2.0"); systemFragManifest2.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); Module systemFrag2 = installDummyModule(systemFragManifest2, "systemFrag2", container); - Map<String, String> systemFragManifest3 = new HashMap<String, String>(); + Map<String, String> systemFragManifest3 = new HashMap<>(); systemFragManifest3.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest3.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag"); systemFragManifest3.put(Constants.BUNDLE_VERSION, "3.0"); @@ -3310,28 +3310,28 @@ public class TestModuleContainer extends AbstractTest { ModuleContainer container = adaptor.getContainer(); // install a split exporter core that substitutes - Map<String, String> coreManifest = new HashMap<String, String>(); + Map<String, String> coreManifest = new HashMap<>(); coreManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); coreManifest.put(Constants.BUNDLE_SYMBOLICNAME, "core"); coreManifest.put(Constants.EXPORT_PACKAGE, "pkg1; core=split; mandatory:=core"); coreManifest.put(Constants.IMPORT_PACKAGE, "pkg1; core=split"); // install a split exporter misc that requires core and substitutes - Map<String, String> miscManifest = new HashMap<String, String>(); + Map<String, String> miscManifest = new HashMap<>(); miscManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); miscManifest.put(Constants.BUNDLE_SYMBOLICNAME, "misc"); miscManifest.put(Constants.EXPORT_PACKAGE, "pkg1; misc=split; mandatory:=misc"); miscManifest.put(Constants.REQUIRE_BUNDLE, "core"); // install a bundle that imports core and exports pkg2 that uses pkg1 from core - Map<String, String> importsCoreManifest = new HashMap<String, String>(); + Map<String, String> importsCoreManifest = new HashMap<>(); importsCoreManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); importsCoreManifest.put(Constants.BUNDLE_SYMBOLICNAME, "importsCore"); importsCoreManifest.put(Constants.EXPORT_PACKAGE, "pkg2; uses:=pkg1"); importsCoreManifest.put(Constants.IMPORT_PACKAGE, "pkg1; core=split"); // install a bundle that imports pkg2, but requires misc - Map<String, String> requiresMiscManifest = new HashMap<String, String>(); + Map<String, String> requiresMiscManifest = new HashMap<>(); requiresMiscManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); requiresMiscManifest.put(Constants.BUNDLE_SYMBOLICNAME, "requiresMisc"); requiresMiscManifest.put(Constants.IMPORT_PACKAGE, "pkg2"); @@ -3364,7 +3364,7 @@ public class TestModuleContainer extends AbstractTest { container = adaptor.getContainer(); // install a exporter that substitutes core's export - Map<String, String> substitutesCoreManifest = new HashMap<String, String>(); + Map<String, String> substitutesCoreManifest = new HashMap<>(); substitutesCoreManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); substitutesCoreManifest.put(Constants.BUNDLE_SYMBOLICNAME, "substitutesCore"); substitutesCoreManifest.put(Constants.EXPORT_PACKAGE, "pkg1; substitutesCore=true; mandatory:=substitutesCore"); @@ -3427,7 +3427,7 @@ public class TestModuleContainer extends AbstractTest { ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); Assert.assertNull("Failed to resolve test.", report.getResolutionException()); - List<Module> modules = new ArrayList<Module>(); + List<Module> modules = new ArrayList<>(); for (String manifest : HTTPCOMPS_AND_EATHER) { modules.add(installDummyModule(manifest, manifest, container)); } @@ -3445,10 +3445,10 @@ public class TestModuleContainer extends AbstractTest { ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); Assert.assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - Map<String, String> manifest = new HashMap<String, String>(); + Map<String, String> manifest = new HashMap<>(); // test by installing bundles with decreasing IDs - List<Module> modules = new ArrayList<Module>(); + List<Module> modules = new ArrayList<>(); for (int i = 5; i > 0; i--) { manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -3519,12 +3519,12 @@ public class TestModuleContainer extends AbstractTest { systemBundle.start(); // install a module - Map<String, String> manifest = new HashMap<String, String>(); + Map<String, String> manifest = new HashMap<>(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "lock.test"); final Module module = installDummyModule(manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), container); - final ArrayBlockingQueue<BundleException> startExceptions = new ArrayBlockingQueue<BundleException>(2); + final ArrayBlockingQueue<BundleException> startExceptions = new ArrayBlockingQueue<>(2); Runnable start = new Runnable() { @Override public void run() { @@ -3547,7 +3547,7 @@ public class TestModuleContainer extends AbstractTest { Assert.assertEquals("Wrong cause.", ThreadInfoReport.class, startError.getCause().getCause().getClass()); startError.printStackTrace(); - final ArrayBlockingQueue<BundleException> stopExceptions = new ArrayBlockingQueue<BundleException>(2); + final ArrayBlockingQueue<BundleException> stopExceptions = new ArrayBlockingQueue<>(2); Runnable stop = new Runnable() { @Override public void run() { @@ -3602,7 +3602,7 @@ public class TestModuleContainer extends AbstractTest { } private List<DummyModuleEvent> removeFirstListOfCommonEvents(List<DummyModuleEvent> events) { - List<DummyModuleEvent> result = new ArrayList<DummyModuleDatabase.DummyModuleEvent>(); + List<DummyModuleEvent> result = new ArrayList<>(); if (events.isEmpty()) { return result; } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java index 0d4874503..01b10aafa 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java @@ -41,8 +41,8 @@ public class DummyContainerAdaptor extends ModuleContainerAdaptor { private final ModuleContainer container; private final ResolverHookFactory resolverHookFactory; private final DebugOptions debugOptions; - private final AtomicReference<CountDownLatch> startLatch = new AtomicReference<CountDownLatch>(); - private final AtomicReference<CountDownLatch> stopLatch = new AtomicReference<CountDownLatch>(); + private final AtomicReference<CountDownLatch> startLatch = new AtomicReference<>(); + private final AtomicReference<CountDownLatch> stopLatch = new AtomicReference<>(); private volatile Executor resolverExecutor; private volatile ScheduledExecutorService timeoutExecutor; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModuleDatabase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModuleDatabase.java index 398f802b2..faf66c737 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModuleDatabase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModuleDatabase.java @@ -29,8 +29,8 @@ public class DummyModuleDatabase extends ModuleDatabase { super(adaptor); } - private List<DummyModuleEvent> moduleEvents = new ArrayList<DummyModuleEvent>(); - private List<DummyContainerEvent> containerEvents = new ArrayList<DummyContainerEvent>(); + private List<DummyModuleEvent> moduleEvents = new ArrayList<>(); + private List<DummyContainerEvent> containerEvents = new ArrayList<>(); void addEvent(DummyModuleEvent event) { synchronized (moduleEvents) { @@ -56,7 +56,7 @@ public class DummyModuleDatabase extends ModuleDatabase { private static <E> List<E> getEvents(List<E> events) { synchronized (events) { - List<E> result = new ArrayList<E>(events); + List<E> result = new ArrayList<>(events); events.clear(); return result; } @@ -82,7 +82,7 @@ public class DummyModuleDatabase extends ModuleDatabase { } timeout = timeout - (System.currentTimeMillis() - startTime); } - List<E> result = new ArrayList<E>(events); + List<E> result = new ArrayList<>(events); events.clear(); return result; } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyResolverHook.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyResolverHook.java index 29035e60c..5d114f88e 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyResolverHook.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyResolverHook.java @@ -1,12 +1,16 @@ package org.eclipse.osgi.tests.container.dummys; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.eclipse.osgi.report.resolution.ResolutionReport; import org.osgi.framework.hooks.resolver.ResolverHook; -import org.osgi.framework.wiring.*; +import org.osgi.framework.wiring.BundleCapability; +import org.osgi.framework.wiring.BundleRequirement; +import org.osgi.framework.wiring.BundleRevision; public class DummyResolverHook implements ResolutionReport.Listener, ResolverHook { - private final List<ResolutionReport> reports = new ArrayList<ResolutionReport>(); + private final List<ResolutionReport> reports = new ArrayList<>(); @Override public void filterResolvable(Collection<BundleRevision> candidates) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/UnresolvedProviderEntryBuilder.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/UnresolvedProviderEntryBuilder.java index a59368c2c..f58e2fdca 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/UnresolvedProviderEntryBuilder.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/UnresolvedProviderEntryBuilder.java @@ -13,17 +13,20 @@ *******************************************************************************/ package org.eclipse.osgi.tests.container.dummys; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.osgi.resource.Capability; import org.osgi.resource.Requirement; public class UnresolvedProviderEntryBuilder { - private final Map<Requirement, List<Capability>> data = new HashMap<Requirement, List<Capability>>(); + private final Map<Requirement, List<Capability>> data = new HashMap<>(); private Requirement lastRequirement; public Map<Requirement, List<Capability>> build() { - return new HashMap<Requirement, List<Capability>>(data); + return new HashMap<>(data); } public UnresolvedProviderEntryBuilder capability(Capability value) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/debugoptions/DebugOptionsTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/debugoptions/DebugOptionsTestCase.java index 32ce68e01..e2af36bc5 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/debugoptions/DebugOptionsTestCase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/debugoptions/DebugOptionsTestCase.java @@ -987,7 +987,7 @@ public class DebugOptionsTestCase extends CoreTest { PrintStream old = System.out; File traceFile = OSGiTestsActivator.getContext().getDataFile(getName() + ".trace"); //$NON-NLS-1$ OutputStream out = new FileOutputStream(traceFile); - final AtomicReference<Boolean> closed = new AtomicReference<Boolean>(Boolean.FALSE); + final AtomicReference<Boolean> closed = new AtomicReference<>(Boolean.FALSE); out = new FilterOutputStream(out) { @Override diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java index 366d5bb18..0fc2c8b44 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java @@ -360,7 +360,7 @@ public abstract class FilterTests extends TestCase { } public void testNullValueMatch() throws InvalidSyntaxException { - Dictionary<String, Object> nullProps = new MapDictionary<String, Object>(); + Dictionary<String, Object> nullProps = new MapDictionary<>(); nullProps.put("test.null", null); nullProps.put("test.non.null", "v1"); assertFalse(createFilter("(test.null=*)").match(nullProps)); @@ -368,7 +368,7 @@ public abstract class FilterTests extends TestCase { } public void testNullKeyMatch() throws InvalidSyntaxException { - Dictionary<String, Object> nullProps = new MapDictionary<String, Object>(); + Dictionary<String, Object> nullProps = new MapDictionary<>(); nullProps.put(null, "null.v1"); nullProps.put("test.non.null", "v1"); assertTrue(createFilter("(test.non.null=v1)").match(nullProps)); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/BundleFileWrapperFactoryHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/BundleFileWrapperFactoryHookTests.java index e5f4cbb76..e9d66024d 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/BundleFileWrapperFactoryHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/BundleFileWrapperFactoryHookTests.java @@ -40,7 +40,7 @@ public class BundleFileWrapperFactoryHookTests extends AbstractFrameworkHookTest classLoader.addURL(new URL(loc)); location = bundleInstaller.getBundleLocation(TEST_BUNDLE); File file = OSGiTestsActivator.getContext().getDataFile(getName()); - configuration = new HashMap<String, String>(); + configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); configuration.put(HookRegistry.PROP_HOOK_CONFIGURATORS_INCLUDE, HOOK_CONFIGURATOR_CLASS); framework = createFramework(configuration); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ClassLoaderHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ClassLoaderHookTests.java index 4d8719e83..e05aea285 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ClassLoaderHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ClassLoaderHookTests.java @@ -67,7 +67,7 @@ public class ClassLoaderHookTests extends AbstractFrameworkHookTests { classLoader.addURL(new URL(loc)); location = bundleInstaller.getBundleLocation(TEST_BUNDLE); File file = OSGiTestsActivator.getContext().getDataFile(getName()); - configuration = new HashMap<String, String>(); + configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); configuration.put(HookRegistry.PROP_HOOK_CONFIGURATORS_INCLUDE, HOOK_CONFIGURATOR_CLASS); framework = createFramework(configuration); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ContextFinderTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ContextFinderTests.java index c3c43d137..1f175fc30 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ContextFinderTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ContextFinderTests.java @@ -34,7 +34,7 @@ public class ContextFinderTests extends AbstractFrameworkHookTests { protected void setUp() throws Exception { super.setUp(); File file = OSGiTestsActivator.getContext().getDataFile(getName()); - configuration = new HashMap<String, String>(); + configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); framework = createFramework(configuration); initAndStart(framework); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/DevClassPathWithExtensionTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/DevClassPathWithExtensionTests.java index 2aa869ebd..3794b9ca9 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/DevClassPathWithExtensionTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/DevClassPathWithExtensionTests.java @@ -37,7 +37,7 @@ public class DevClassPathWithExtensionTests extends AbstractFrameworkHookTests { super.setUp(); location = bundleInstaller.getBundleLocation(TEST_BUNDLE); File file = OSGiTestsActivator.getContext().getDataFile(getName()); - configuration = new HashMap<String, String>(); + configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); configuration.put(EquinoxConfiguration.PROP_DEV, "bin/"); framework = createFramework(configuration); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/EmbeddedEquinoxWithURLInClassLoadTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/EmbeddedEquinoxWithURLInClassLoadTests.java index c7c1c8ca8..9ae57c0ce 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/EmbeddedEquinoxWithURLInClassLoadTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/EmbeddedEquinoxWithURLInClassLoadTests.java @@ -33,7 +33,7 @@ public class EmbeddedEquinoxWithURLInClassLoadTests extends AbstractFrameworkHoo testURL = myManifest.toExternalForm(); super.setUp(); File file = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, String> configuration = new HashMap<String, String>(); + Map<String, String> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); framework = createFramework(configuration); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java index b776cfb76..15d5b49c9 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java @@ -317,7 +317,7 @@ public class StorageHookTests extends AbstractFrameworkHookTests { classLoader.addURL(new URL(loc)); location = bundleInstaller.getBundleLocation(TEST_BUNDLE); File file = OSGiTestsActivator.getContext().getDataFile(getName()); - configuration = new HashMap<String, String>(); + configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); configuration.put(HookRegistry.PROP_HOOK_CONFIGURATORS_INCLUDE, HOOK_CONFIGURATOR_CLASS); framework = createFramework(configuration); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/CaseMapPerformanceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/CaseMapPerformanceTest.java index 20bc21e79..378be6498 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/CaseMapPerformanceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/CaseMapPerformanceTest.java @@ -43,62 +43,62 @@ public class CaseMapPerformanceTest extends OSGiTest { } public void testHeaders004() { - final Map<String, Object> headers = new Headers<String, Object>(4); + final Map<String, Object> headers = new Headers<>(4); doTestMap(headers, 4); } public void testHeaders005() { - final Map<String, Object> headers = new Headers<String, Object>(5); + final Map<String, Object> headers = new Headers<>(5); doTestMap(headers, 5); } public void testHeaders006() { - final Map<String, Object> headers = new Headers<String, Object>(6); + final Map<String, Object> headers = new Headers<>(6); doTestMap(headers, 6); } public void testHeaders010() { - final Map<String, Object> headers = new Headers<String, Object>(10); + final Map<String, Object> headers = new Headers<>(10); doTestMap(headers, 10); } public void testHeaders020() { - final Map<String, Object> headers = new Headers<String, Object>(20); + final Map<String, Object> headers = new Headers<>(20); doTestMap(headers, 20); } public void testHeaders100() { - final Map<String, Object> headers = new Headers<String, Object>(100); + final Map<String, Object> headers = new Headers<>(100); doTestMap(headers, 100); } public void testXCaseMap004() { - final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<String, Object>(4); + final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<>(4); doTestMap(headers, 4); } public void testXCaseMap005() { - final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<String, Object>(5); + final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<>(5); doTestMap(headers, 5); } public void testXCaseMap006() { - final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<String, Object>(6); + final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<>(6); doTestMap(headers, 6); } public void testXCaseMap010() { - final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<String, Object>(10); + final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<>(10); doTestMap(headers, 10); } public void testXCaseMap034() { - final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<String, Object>(34); + final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<>(34); doTestMap(headers, 34); } public void testXCaseMap100() { - final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<String, Object>(100); + final Map<String, Object> headers = new CaseInsensitiveDictionaryMap<>(100); doTestMap(headers, 100); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java index 43df19076..1f4122b3e 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java @@ -16,8 +16,12 @@ package org.eclipse.osgi.tests.security; import java.util.ArrayList; import java.util.Collection; import junit.framework.TestSuite; -import org.osgi.framework.*; -import org.osgi.service.condpermadmin.*; +import org.osgi.framework.AdminPermission; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; +import org.osgi.service.condpermadmin.BundleSignerCondition; +import org.osgi.service.condpermadmin.Condition; +import org.osgi.service.condpermadmin.ConditionInfo; public class OSGiAPICertificateTest extends BaseSecurityTest { private static String dn1 = "CN=CA1 LeafA, O=CA1, L=Boston, ST=Massachusetts, C=US"; //$NON-NLS-1$ @@ -57,7 +61,7 @@ public class OSGiAPICertificateTest extends BaseSecurityTest { private static ConditionInfo info09True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain07True}); private static ConditionInfo info10True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain08True}); - private Collection<Bundle> installedBundles = new ArrayList<Bundle>(); + private Collection<Bundle> installedBundles = new ArrayList<>(); public static TestSuite suite() { return new TestSuite(OSGiAPICertificateTest.class); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityAdminUnitTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityAdminUnitTests.java index 58a6fe975..447c80c95 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityAdminUnitTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityAdminUnitTests.java @@ -140,7 +140,7 @@ public class SecurityAdminUnitTests extends AbstractBundleTests { }); File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); equinox = new Equinox(configuration); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java index 829bf1bc2..6d217656b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java @@ -112,7 +112,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testEnableSecurityManager01() { File config = OSGiTestsActivator.getContext().getDataFile("testEnableSecurityManager01"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -148,7 +148,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testEnableSecurityManager02() throws BundleException { // create/start/stop/start/stop test File config = OSGiTestsActivator.getContext().getDataFile("testEnableSecurityManager02"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -199,7 +199,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testEnableSecurityManager03() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile("testEnableSecurityManager03"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -268,7 +268,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testEnableSecurityManager04() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile("testEnableSecurityManager04"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -338,7 +338,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testEnableSecurityManager05() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -388,7 +388,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testLocalization01() throws BundleException { // create/start/stop/start/stop test File config = OSGiTestsActivator.getContext().getDataFile("testLocalization01"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -445,7 +445,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testBug254600() { File config = OSGiTestsActivator.getContext().getDataFile("testBug254600"); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -532,7 +532,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testBug287750() { File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -591,7 +591,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testBug367614() { File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); @@ -678,7 +678,7 @@ public class SecurityManagerTests extends AbstractBundleTests { public void testDynamicImportWithSecurity() throws BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Map<String, Object> configuration = new HashMap<String, Object>(); + Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); Equinox equinox = new Equinox(configuration); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceRegistryTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceRegistryTests.java index ab801cf2e..04940a559 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceRegistryTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceRegistryTests.java @@ -538,7 +538,7 @@ public class ServiceRegistryTests extends AbstractBundleTests { public void testNullValue() throws InvalidSyntaxException { ServiceRegistration reg = null; try { - Dictionary<String, Object> nullProps = new MapDictionary<String, Object>(); + Dictionary<String, Object> nullProps = new MapDictionary<>(); nullProps.put("test.null", null); nullProps.put("test.non.null", "v1"); reg = OSGiTestsActivator.getContext().registerService(Object.class, new Object(), nullProps); @@ -555,7 +555,7 @@ public class ServiceRegistryTests extends AbstractBundleTests { public void testNullKey() throws InvalidSyntaxException { ServiceRegistration reg = null; try { - Dictionary<String, Object> nullProps = new MapDictionary<String, Object>(); + Dictionary<String, Object> nullProps = new MapDictionary<>(); nullProps.put(null, "null.v1"); nullProps.put("test.non.null", "v1"); reg = OSGiTestsActivator.getContext().registerService(Object.class, new Object(), nullProps); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java index 2bc8315f8..a655f7ca5 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java @@ -13,9 +13,16 @@ *******************************************************************************/ package org.eclipse.osgi.tests.services.datalocation; -import java.io.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.core.runtime.Platform; @@ -26,8 +33,13 @@ import org.eclipse.osgi.internal.location.EquinoxLocations; import org.eclipse.osgi.launch.Equinox; import org.eclipse.osgi.service.datalocation.Location; import org.eclipse.osgi.tests.OSGiTestsActivator; -import org.osgi.framework.*; -import org.osgi.service.log.*; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogEntry; +import org.osgi.service.log.LogListener; +import org.osgi.service.log.LogReaderService; import org.osgi.util.tracker.ServiceTracker; public class BasicLocationTests extends CoreTest { @@ -50,8 +62,8 @@ public class BasicLocationTests extends CoreTest { prefix = windows ? "c:" : ""; - configLocationTracker = new ServiceTracker<Location, Location>(OSGiTestsActivator.getContext(), OSGiTestsActivator.getContext().createFilter(Location.CONFIGURATION_FILTER), null); - instanceLocationTracker = new ServiceTracker<Location, Location>(OSGiTestsActivator.getContext(), OSGiTestsActivator.getContext().createFilter(Location.INSTANCE_FILTER), null); + configLocationTracker = new ServiceTracker<>(OSGiTestsActivator.getContext(), OSGiTestsActivator.getContext().createFilter(Location.CONFIGURATION_FILTER), null); + instanceLocationTracker = new ServiceTracker<>(OSGiTestsActivator.getContext(), OSGiTestsActivator.getContext().createFilter(Location.INSTANCE_FILTER), null); configLocationTracker.open(); instanceLocationTracker.open(); @@ -294,7 +306,7 @@ public class BasicLocationTests extends CoreTest { } public void testSlashes() throws BundleException, InvalidSyntaxException { - Map<String, String> fwkConfig = new HashMap<String, String>(); + Map<String, String> fwkConfig = new HashMap<>(); fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); fwkConfig.put(EquinoxLocations.PROP_USER_AREA, prefix + "/a"); fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, prefix + "/c/d"); @@ -312,7 +324,7 @@ public class BasicLocationTests extends CoreTest { } private static Map<String, Location> getLocations(Equinox equinox) throws InvalidSyntaxException { - Map<String, Location> locations = new HashMap<String, Location>(); + Map<String, Location> locations = new HashMap<>(); BundleContext context = equinox.getBundleContext(); addLocation(context, Location.CONFIGURATION_FILTER, locations); addLocation(context, Location.INSTALL_FILTER, locations); @@ -329,7 +341,7 @@ public class BasicLocationTests extends CoreTest { } public void testSchemes() throws Exception { - Map<String, String> fwkConfig = new HashMap<String, String>(); + Map<String, String> fwkConfig = new HashMap<>(); fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); fwkConfig.put(EquinoxLocations.PROP_USER_AREA, "http://example.com/a"); fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "ftp://example.com/c/d"); @@ -351,7 +363,7 @@ public class BasicLocationTests extends CoreTest { } public void testNone() throws Exception { - Map<String, String> fwkConfig = new HashMap<String, String>(); + Map<String, String> fwkConfig = new HashMap<>(); fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); fwkConfig.put(EquinoxLocations.PROP_USER_AREA, "@none"); fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "@none"); @@ -372,7 +384,7 @@ public class BasicLocationTests extends CoreTest { } public void testNoDefault() throws Exception { - Map<String, String> fwkConfig = new HashMap<String, String>(); + Map<String, String> fwkConfig = new HashMap<>(); fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); fwkConfig.put(EquinoxLocations.PROP_INSTALL_AREA, "file:" + prefix + "/g"); fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "@noDefault"); @@ -392,7 +404,7 @@ public class BasicLocationTests extends CoreTest { } public void testUserDir() throws Exception { - Map<String, String> fwkConfig = new HashMap<String, String>(); + Map<String, String> fwkConfig = new HashMap<>(); fwkConfig.put(EquinoxLocations.PROP_USER_AREA, "@user.dir"); fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "@user.dir"); @@ -413,7 +425,7 @@ public class BasicLocationTests extends CoreTest { } public void testUserHome() throws Exception { - Map<String, String> fwkConfig = new HashMap<String, String>(); + Map<String, String> fwkConfig = new HashMap<>(); fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); fwkConfig.put(EquinoxLocations.PROP_USER_AREA, "@user.home"); fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "@user.home"); @@ -437,7 +449,7 @@ public class BasicLocationTests extends CoreTest { public void testUNC() throws Exception { if (!windows) return; - Map<String, String> fwkConfig = new HashMap<String, String>(); + Map<String, String> fwkConfig = new HashMap<>(); fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); fwkConfig.put(EquinoxLocations.PROP_USER_AREA, "//server/share/a"); fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "//server/share/b"); @@ -462,7 +474,7 @@ public class BasicLocationTests extends CoreTest { debugOptions.put("org.eclipse.osgi/debug/location", "true"); File debugOptionsFile = OSGiTestsActivator.getContext().getDataFile(getName() + ".options"); debugOptions.store(new FileOutputStream(debugOptionsFile), getName()); - Map<String, String> fwkConfig = new HashMap<String, String>(); + Map<String, String> fwkConfig = new HashMap<>(); fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); fwkConfig.put(EquinoxLocations.PROP_INSTALL_AREA, "file:" + prefix + "/g"); fwkConfig.put(EquinoxConfiguration.PROP_DEBUG, debugOptionsFile.getAbsolutePath()); @@ -471,7 +483,7 @@ public class BasicLocationTests extends CoreTest { Equinox equinox = new Equinox(fwkConfig); equinox.init(); try { - final List<LogEntry> logEntries = new ArrayList<LogEntry>(); + final List<LogEntry> logEntries = new ArrayList<>(); LogReaderService logReaderService = getLogReaderService(equinox); LogListener logListener = new SynchronousLogListener() { @Override diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java index 1f553df18..c58438767 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java @@ -53,7 +53,7 @@ public class OSGiCapabilityTest extends AbstractStateTest { private Dictionary loadManifest(String manifest) { URL url = getContext().getBundle().getEntry(MANIFEST_ROOT + manifest); try { - CaseInsensitiveDictionaryMap<String, String> headers = new CaseInsensitiveDictionaryMap<String, String>(); + CaseInsensitiveDictionaryMap<String, String> headers = new CaseInsensitiveDictionaryMap<>(); ManifestElement.parseBundleManifest(url.openStream(), headers); return headers.asUnmodifiableDictionary(); } catch (IOException e) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java index 5b6c147ec..3715242c6 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java @@ -3806,7 +3806,7 @@ public class StateResolverTest extends AbstractStateTest { private Dictionary loadManifest(String manifest) { URL url = getContext().getBundle().getEntry(MANIFEST_ROOT + manifest); try { - CaseInsensitiveDictionaryMap<String, String> headers = new CaseInsensitiveDictionaryMap<String, String>(); + CaseInsensitiveDictionaryMap<String, String> headers = new CaseInsensitiveDictionaryMap<>(); ManifestElement.parseBundleManifest(url.openStream(), headers); return headers.asUnmodifiableDictionary(); } catch (IOException e) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/MapDictionary.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/MapDictionary.java index 97f602194..e555ae269 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/MapDictionary.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/MapDictionary.java @@ -13,10 +13,14 @@ ******************************************************************************/ package org.eclipse.osgi.tests.util; -import java.util.*; +import java.util.Collections; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; public class MapDictionary<K, V> extends Dictionary<K, V> { - Map<K, V> map = new HashMap<K, V>(); + Map<K, V> map = new HashMap<>(); @Override public int size() { |