New Upstream Snapshot - equinox-bundles
Ready changes
Summary
Merged new upstream version: 200904302341+git20220310.1.fd2f4fb+ds (was: 4.22).
Resulting package
Built on 2023-01-21T22:33 (took 10m44s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots libequinox-app-javaapt install -t fresh-snapshots libequinox-bidi-javaapt install -t fresh-snapshots libequinox-cm-javaapt install -t fresh-snapshots libequinox-common-javaapt install -t fresh-snapshots libequinox-concurrent-javaapt install -t fresh-snapshots libequinox-console-javaapt install -t fresh-snapshots libequinox-coordinator-javaapt install -t fresh-snapshots libequinox-device-javaapt install -t fresh-snapshots libequinox-event-javaapt install -t fresh-snapshots libequinox-http-jetty-javaapt install -t fresh-snapshots libequinox-http-jetty-starter-javaapt install -t fresh-snapshots libequinox-http-registry-javaapt install -t fresh-snapshots libequinox-http-servlet-javaapt install -t fresh-snapshots libequinox-http-servletbridge-javaapt install -t fresh-snapshots libequinox-io-javaapt install -t fresh-snapshots libequinox-ip-javaapt install -t fresh-snapshots libequinox-jsp-jasper-javaapt install -t fresh-snapshots libequinox-jsp-jasper-registry-javaapt install -t fresh-snapshots libequinox-metatype-javaapt install -t fresh-snapshots libequinox-preferences-javaapt install -t fresh-snapshots libequinox-region-javaapt install -t fresh-snapshots libequinox-registry-javaapt install -t fresh-snapshots libequinox-security-javaapt install -t fresh-snapshots libequinox-security-ui-javaapt install -t fresh-snapshots libequinox-servletbridge-javaapt install -t fresh-snapshots libequinox-transforms-hook-javaapt install -t fresh-snapshots libequinox-transforms-xslt-javaapt install -t fresh-snapshots libequinox-useradmin-javaapt install -t fresh-snapshots libequinox-util-javaapt install -t fresh-snapshots libequinox-weaving-caching-javaapt install -t fresh-snapshots libequinox-weaving-hook-javaapt install -t fresh-snapshots libequinox-wireadmin-java
Diff
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 0a6421b..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,60 +0,0 @@
-# Text files with LF eol
-*.awk crlf=input
-*.bnd crlf=input
-*.c crlf=input ident
-*.conf crlf=input
-*.cpp crlf=input ident
-*.css crlf=input
-*.groovy crlf=input
-*.h crlf=input ident
-*.html crlf=input ident
-*.java crlf=input ident
-*.js crlf=input
-*.MF crlf=input
-*.php crlf=input
-*.pl crlf=input
-*.prefs crlf=input
-*.properties crlf=input
-*.py crlf=input
-*.schema crlf=input
-*.sh crlf=input
-*.tcl crlf=input
-*.txt crlf=input
-*.xml crlf=input
-*.xsd crlf=input ident
-*.xsl crlf=input
-*.xslt crlf=input
-.classpath crlf=input
-.project crlf=input
-packageinfo crlf=input
-Makefile crlf=input
-
-# No EOL translation
-*.bat -crlf
-
-# Binary. No EOL translation, no diff
-*.ico binary
-*.jpeg binary
-*.jpg binary
-*.png binary
-*.crt binary
-*.pdf binary
-*.dll binary
-*.jar binary
-*.jnilib binary
-*.so binary
-*.zip binary
-*.doc binary
-*.ppt binary
-*.xls binary
-*.odg binary
-*.odp binary
-*.ods binary
-*.odt binary
-*.otg binary
-*.otp binary
-*.ots binary
-*.ott binary
-*.key binary
-*.numbers binary
-*.pages binary
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 540aa14..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-/*/*/bin/
-/bundles/archived/*/bin/
-.DS_Store
-
-# maven
-/*/*/target/
-
diff --git a/Jenkinsfile b/Jenkinsfile
index 18ee486..1aae084 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -46,7 +46,7 @@ pipeline {
}
}
steps {
- sh "wget https://git.eclipse.org/c/platform/eclipse.platform.releng.aggregator.git/plain/scripts/verifyFreezePeriod.sh"
+ sh "wget https://raw.githubusercontent.com/eclipse-platform/eclipse.platform.releng.aggregator/master/scripts/verifyFreezePeriod.sh"
sh "chmod +x verifyFreezePeriod.sh"
withCredentials([string(credentialsId: 'google-api-key', variable: 'GOOGLE_API_KEY')]) {
sh './verifyFreezePeriod.sh'
diff --git a/bundles/org.eclipse.equinox.app/pom.xml b/bundles/org.eclipse.equinox.app/pom.xml
index 51440f7..e257453 100644
--- a/bundles/org.eclipse.equinox.app/pom.xml
+++ b/bundles/org.eclipse.equinox.app/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.bidi.tests/pom.xml b/bundles/org.eclipse.equinox.bidi.tests/pom.xml
index c5973cb..0902ed3 100644
--- a/bundles/org.eclipse.equinox.bidi.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.bidi.tests/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.bidi/pom.xml b/bundles/org.eclipse.equinox.bidi/pom.xml
index b6508ee..9d55917 100644
--- a/bundles/org.eclipse.equinox.bidi/pom.xml
+++ b/bundles/org.eclipse.equinox.bidi/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.cm.test/pom.xml b/bundles/org.eclipse.equinox.cm.test/pom.xml
index f3a970d..180db7b 100644
--- a/bundles/org.eclipse.equinox.cm.test/pom.xml
+++ b/bundles/org.eclipse.equinox.cm.test/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
diff --git a/bundles/org.eclipse.equinox.cm/pom.xml b/bundles/org.eclipse.equinox.cm/pom.xml
index 1829968..119936f 100644
--- a/bundles/org.eclipse.equinox.cm/pom.xml
+++ b/bundles/org.eclipse.equinox.cm/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF
index 5ab8017..483f108 100644
--- a/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Common Eclipse Runtime Tests
Bundle-Vendor: Eclipse.org - Equinox
Bundle-SymbolicName: org.eclipse.equinox.common.tests;singleton:=true
-Bundle-Version: 3.15.100.qualifier
+Bundle-Version: 3.15.200.qualifier
Automatic-Module-Name: org.eclipse.equinox.common.tests
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..074ef97
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: fileLocator test NL Fragment
+Bundle-SymbolicName: fileLocatorTest.nl
+Bundle-Version: 1.0.0
+Fragment-Host: fileLocatorTest;bundle-version="1.0.0"
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/build.properties b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/BB/intro/messages.properties
similarity index 64%
rename from bundles/org.eclipse.equinox.security.linux.x86_64/build.properties
rename to bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/BB/intro/messages.properties
index 2ed0af8..6947455 100644
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/build.properties
+++ b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/BB/intro/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2005, 2021 IBM Corporation and others.
+# Copyright (c) 2012 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -7,12 +7,7 @@
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
-#
+#
# Contributors:
-# Julien HENRY - Linux implementation
+# IBM Corporation - initial API and implementation
###############################################################################
-bin.includes = META-INF/,\
- .,\
- fragment.properties,\
- about.html
-src.includes = about.html
diff --git a/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/intro/messages.properties b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/intro/messages.properties
new file mode 100644
index 0000000..6947455
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator.nl/nl/aa/intro/messages.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2012 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
diff --git a/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..65ae065
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: fileLocator test
+Bundle-SymbolicName: fileLocatorTest
+Bundle-Version: 1.0.0
diff --git a/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/intro/messages.properties b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/intro/messages.properties
new file mode 100644
index 0000000..6947455
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/intro/messages.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2012 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
diff --git a/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/nl/aa/BB/intro/messages.properties b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/nl/aa/BB/intro/messages.properties
new file mode 100644
index 0000000..6947455
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/nl/aa/BB/intro/messages.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2012 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
diff --git a/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/nl/aa/intro/messages.properties b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/nl/aa/intro/messages.properties
new file mode 100644
index 0000000..6947455
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocator/nl/aa/intro/messages.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2012 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
diff --git a/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocatorGetRootFile/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocatorGetRootFile/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2505a83
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/Plugin_Testing/fileLocator/testFileLocatorGetRootFile/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: fileLocator test
+Bundle-SymbolicName: fileLocatorTestGetRootFile
+Bundle-Version: 1.0.0
diff --git a/bundles/org.eclipse.equinox.common.tests/pom.xml b/bundles/org.eclipse.equinox.common.tests/pom.xml
index aee8c7f..b7a165d 100644
--- a/bundles/org.eclipse.equinox.common.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.common.tests/pom.xml
@@ -14,12 +14,12 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common.tests</artifactId>
- <version>3.15.100-SNAPSHOT</version>
+ <version>3.15.200-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<testClass>org.eclipse.equinox.common.tests.AllTests</testClass>
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/core/runtime/tests/FileLocatorTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/core/runtime/tests/FileLocatorTest.java
new file mode 100644
index 0000000..d0f3830
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/core/runtime/tests/FileLocatorTest.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Hannes Wellmann - Bug 578702 - Move FileLocatorTest to rt.equinox.bundles repository
+ *******************************************************************************/
+package org.eclipse.core.runtime.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.tests.harness.BundleTestingHelper;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.FrameworkUtil;
+
+public class FileLocatorTest {
+
+ private final static String searchLocation = "$nl$/intro/messages.properties";
+
+ private final static String nl = "aa_BB"; // make sure we have a stable NL value
+
+ private final static String mostSpecificPath = "/nl/aa/BB/intro/messages.properties";
+ private final static String lessSpecificPath = "/nl/aa/intro/messages.properties";
+ private final static String nonSpecificPath = "/intro/messages.properties";
+
+ @Test
+ public void testFileLocatorFind() throws IOException, BundleException {
+ Bundle bundle = BundleTestingHelper.installBundle("Plugin", getContext(),
+ "Plugin_Testing/fileLocator/testFileLocator");
+ BundleTestingHelper.refreshPackages(getContext(), new Bundle[] { bundle });
+ Bundle fragment = BundleTestingHelper.installBundle("Fragment", getContext(),
+ "Plugin_Testing/fileLocator/testFileLocator.nl");
+ BundleTestingHelper.refreshPackages(getContext(), new Bundle[] { fragment });
+
+ IPath path = new Path(searchLocation);
+ Map<String, String> map = new HashMap<>(1);
+ map.put("$nl$", nl);
+
+ URL oneSolution = FileLocator.find(bundle, path, map);
+ assertNotNull(oneSolution);
+ assertEquals(mostSpecificPath, oneSolution.getPath());
+ assertBundleURL(oneSolution);
+
+ URL[] solutions = FileLocator.findEntries(bundle, path, map);
+
+ // expected:
+ // Bundle/nl/aa/BB/intro/messages.properties,
+ // Fragment/nl/aa/BB/intro/messages.properties,
+ // Bundle/nl/aa/intro/messages.properties,
+ // Fragment/nl/aa/intro/messages.properties,
+ // Bundle/121/intro/messages.properties
+
+ assertEquals(5, solutions.length);
+
+ assertEquals(mostSpecificPath, solutions[0].getPath());
+ assertBundleURL(solutions[0]);
+ assertEquals(mostSpecificPath, solutions[1].getPath());
+ assertFragmentURL(solutions[1]);
+
+ assertEquals(lessSpecificPath, solutions[2].getPath());
+ assertBundleURL(solutions[2]);
+ assertEquals(lessSpecificPath, solutions[3].getPath());
+ assertFragmentURL(solutions[3]);
+
+ assertEquals(nonSpecificPath, solutions[4].getPath());
+ assertBundleURL(solutions[4]);
+
+ // remove the first bundle
+ fragment.uninstall();
+ BundleTestingHelper.refreshPackages(getContext(), new Bundle[] { fragment });
+ bundle.uninstall();
+ BundleTestingHelper.refreshPackages(getContext(), new Bundle[] { bundle });
+ }
+
+ @Test
+ public void testFileLocatorGetBundleFile01() throws BundleException, IOException {
+ // test for bug 198447
+ // install the bundle via reference
+ BundleContext context = getContext();
+ URL url = context.getBundle().getEntry("Plugin_Testing/fileLocator/testFileLocatorGetRootFile");
+ Bundle bundle = context.installBundle("reference:" + FileLocator.toFileURL(url).toExternalForm());
+ BundleTestingHelper.refreshPackages(context, new Bundle[] { bundle });
+
+ File file1 = FileLocator.getBundleFileLocation(bundle).get();
+ assertNotNull(file1);
+ assertSame(file1, FileLocator.getBundleFile(bundle));
+
+ URL fileURL = FileLocator
+ .toFileURL(context.getBundle().getEntry("Plugin_Testing/fileLocator/testFileLocatorGetRootFile"));
+ assertEquals(file1, new File(fileURL.getFile()));
+
+ // remove the bundle
+ bundle.uninstall();
+ BundleTestingHelper.refreshPackages(context, new Bundle[] { bundle });
+ }
+
+ @Test
+ public void testFileLocatorGetBundleFile02() throws BundleException, IOException, URISyntaxException {
+ // install the bundle via reference
+ BundleContext context = getContext();
+ URL url = context.getBundle().getEntry("Plugin_Testing/fileLocator/testFileLocatorGetRootFile.jar");
+ Bundle bundle = context.installBundle("reference:" + FileLocator.toFileURL(url).toExternalForm());
+ BundleTestingHelper.refreshPackages(context, new Bundle[] { bundle });
+
+ File file1 = FileLocator.getBundleFileLocation(bundle).get();
+ assertNotNull(file1);
+ assertSame(file1, FileLocator.getBundleFile(bundle));
+
+ URL fileURL = FileLocator
+ .toFileURL(context.getBundle().getEntry("Plugin_Testing/fileLocator/testFileLocatorGetRootFile.jar"));
+ assertEquals(file1, new File(fileURL.getFile()));
+
+ URL manifest = bundle.getEntry("META-INF/MANIFEST.MF");
+ manifest = FileLocator.resolve(manifest);
+ assertEquals("Expection jar protocol: " + manifest.toExternalForm(), "jar", manifest.getProtocol());
+
+ String manifestExternal = manifest.toExternalForm();
+ int index = manifestExternal.lastIndexOf('!');
+ assertTrue("No ! found", index >= 0);
+ String fileExternal = manifestExternal.substring(4, index);
+
+ URL fileExternalURL = new URL(fileExternal);
+ new File(fileExternalURL.toURI());
+
+ // remove the bundle
+ bundle.uninstall();
+ BundleTestingHelper.refreshPackages(context, new Bundle[] { bundle });
+ }
+
+ private BundleContext getContext() {
+ return FrameworkUtil.getBundle(FileLocatorTest.class).getBundleContext();
+ }
+
+ private Bundle getHostBundle(URL url) {
+ String host = url.getHost();
+ int dot = host.indexOf('.');
+ Long hostId = Long.decode(dot < 0 ? host : host.substring(0, dot));
+ assertNotNull(hostId);
+ return getContext().getBundle(hostId.longValue());
+ }
+
+ private void assertBundleURL(URL url) {
+ Bundle hostBundle = getHostBundle(url);
+ assertNotNull(hostBundle);
+ assertEquals("fileLocatorTest", hostBundle.getSymbolicName());
+ }
+
+ private void assertFragmentURL(URL url) {
+ Bundle hostBundle = getHostBundle(url);
+ assertNotNull(hostBundle);
+ assertEquals("fileLocatorTest.nl", hostBundle.getSymbolicName());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/AllTests.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/AllTests.java
index 9780832..e55f05c 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/AllTests.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/AllTests.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.equinox.common.tests;
+import org.eclipse.core.runtime.tests.FileLocatorTest;
import org.eclipse.equinox.common.tests.adaptable.AdaptableTests;
import org.eclipse.equinox.common.tests.registry.RegistryTests;
import org.eclipse.equinox.common.tests.registry.simple.SimpleRegistryTests;
@@ -27,7 +28,8 @@ import org.junit.runners.Suite.SuiteClasses;
RuntimeTests.class,
AdaptableTests.class,
RegistryTests.class,
- SimpleRegistryTests.class
+ SimpleRegistryTests.class,
+ FileLocatorTest.class
})
public class AllTests {
// intentionally left blank
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptableTests.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptableTests.java
index 92d59d9..28dc096 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptableTests.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptableTests.java
@@ -21,7 +21,8 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses({
AdapterManagerDynamicTest.class,
IAdapterManagerServiceTest.class,
- IAdapterManagerTest.class
+ IAdapterManagerTest.class,
+ AdaptersTest.class
})
public class AdaptableTests {
// intentionally left blank
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptersTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptersTest.java
new file mode 100644
index 0000000..fd30dca
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptersTest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Christoph Läubrich and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Christoph Läubrich - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.common.tests.adaptable;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.Optional;
+
+import org.eclipse.core.runtime.Adapters;
+import org.junit.Test;
+
+public class AdaptersTest {
+
+ @Test
+ public void testOptionalObjectIsNull() {
+ Optional<?> optional = Adapters.of(null, Object.class);
+ assertTrue(optional.isEmpty());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testOptionalAdapterTypeIsNull() {
+ Adapters.of(new Object(), null);
+ }
+
+ @Test
+ public void testOptionalOfNotAdaptableIsEmpty() {
+ Optional<?> optional = Adapters.of(new ThisWillNotAdapt(), Runnable.class);
+ assertTrue(optional.isEmpty());
+ }
+
+ @Test
+ public void testOptionalOfAdaptable() {
+ Optional<?> optional = Adapters.of(new ThisWillAdaptToRunnable(), Runnable.class);
+ assertTrue(optional.isPresent());
+ }
+
+ private static final class ThisWillNotAdapt {
+
+ }
+
+ private static final class ThisWillAdaptToRunnable implements Runnable {
+
+ @Override
+ public void run() {
+
+ }
+
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.common/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.common/.settings/org.eclipse.jdt.ui.prefs
index 5d17c29..e1f7d14 100644
--- a/bundles/org.eclipse.equinox.common/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.equinox.common/.settings/org.eclipse.jdt.ui.prefs
@@ -3,6 +3,7 @@ editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
formatter_settings_version=21
internal.default.compliance=user
+sp_cleanup.format_source_code_changes_only=true
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=;
org.eclipse.jdt.ui.ondemandthreshold=3
diff --git a/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
index 9be3d5b..41003de 100644
--- a/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.common; singleton:=true
-Bundle-Version: 3.15.100.qualifier
+Bundle-Version: 3.16.0.qualifier
Bundle-Localization: plugin
Export-Package: org.eclipse.core.internal.boot;x-friends:="org.eclipse.core.resources,org.eclipse.pde.build",
org.eclipse.core.internal.runtime;common=split;mandatory:=common;
@@ -19,18 +19,7 @@ Export-Package: org.eclipse.core.internal.boot;x-friends:="org.eclipse.core.reso
org.eclipse.equinox.events;version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.core.internal.runtime.Activator
-Import-Package: org.eclipse.equinox.log;version="[1.0,2.0)",
- org.eclipse.osgi.framework.log;version="[1.1, 2.0)",
- org.eclipse.osgi.service.datalocation,
- org.eclipse.osgi.service.debug,
- org.eclipse.osgi.service.localization,
- org.eclipse.osgi.service.urlconversion,
- org.eclipse.osgi.util,
- org.osgi.framework,
- org.osgi.service.log;version="[1.3.0, 2.0)",
- org.osgi.service.packageadmin,
- org.osgi.service.url,
- org.osgi.util.tracker
+Require-Bundle: org.eclipse.osgi;bundle-version="[3.17.200,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: org.eclipse.equinox.common
diff --git a/bundles/org.eclipse.equinox.common/pom.xml b/bundles/org.eclipse.equinox.common/pom.xml
index aedb61e..f3fc6aa 100644
--- a/bundles/org.eclipse.equinox.common/pom.xml
+++ b/bundles/org.eclipse.equinox.common/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
- <version>3.15.100-SNAPSHOT</version>
+ <version>3.16.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/CommonMessages.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/CommonMessages.java
index 7cc4adc..6bf9a0f 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/CommonMessages.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/CommonMessages.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM - Initial API and implementation
+ * Christoph Läubrich - Bug 577645 - [Adapters] provide a method that returns an Optional for an adapted type
**********************************************************************/
package org.eclipse.core.internal.runtime;
@@ -57,6 +58,8 @@ public class CommonMessages extends NLS {
public static String activator_resourceBundleNotFound;
public static String activator_resourceBundleNotStarted;
+ public static String adapters_internal_error_of;
+
static {
// load message values from bundle file
reloadMessages();
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/commonMessages.properties b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/commonMessages.properties
index 5458297..75b9b37 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/commonMessages.properties
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/commonMessages.properties
@@ -49,3 +49,5 @@ url_resolvePlugin = Unable to resolve plug-in \"{0}\".
activator_not_available = The bundle activator for the org.eclipse.equinox.common bundle is not available.
activator_resourceBundleNotFound=Resource bundle not found for locale: {0}
activator_resourceBundleNotStarted=ResourceTranslator called before plugin is started
+
+adapters_internal_error_of=Internal error while adapting {0} -> {1}: {2}
\ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java
index 24637ce..d2d7778 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 IBM Corporation and others.
+ * Copyright (c) 2015, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,10 +11,14 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Lars Vogel <Lars.Vogel@vogella.com> - Bug 478685, 478864, 479849
+ * Christoph Läubrich - Bug 577645 - [Adapters] provide a method that returns an Optional for an adapted type
*******************************************************************************/
package org.eclipse.core.runtime;
-import org.eclipse.core.internal.runtime.AdapterManager;
+import java.util.Objects;
+import java.util.Optional;
+import org.eclipse.core.internal.runtime.*;
+import org.eclipse.osgi.util.NLS;
/**
* Provides a standard way to request adapters from adaptable objects
@@ -112,6 +116,35 @@ public class Adapters {
return adapt(sourceObject, adapter, true);
}
+ /**
+ * If it is possible to adapt the given object to the given type, this returns
+ * an optional holding the adapter, in all other cases it returns an empty
+ * optional.
+ *
+ * @param sourceObject object to adapt, if <code>null</code> then
+ * {@link Optional#empty()} is returned
+ * @param adapter type to adapt to, must not be <code>null</code>
+ * @param <T> type to adapt to
+ * @return an Optional representation of sourceObject that is assignable to the
+ * adapter type, or an empty Optional otherwise
+ * @since 3.16
+ */
+ public static <T> Optional<T> of(Object sourceObject, Class<T> adapter) {
+ if (sourceObject == null) {
+ return Optional.empty();
+ }
+ Objects.requireNonNull(adapter);
+ try {
+ return Optional.ofNullable(adapt(sourceObject, adapter));
+ } catch (AssertionFailedException e) {
+ RuntimeLog.log(Status.error(
+ NLS.bind(CommonMessages.adapters_internal_error_of, new Object[] {
+ sourceObject.getClass().getName(), adapter.getClass().getName(), e.getLocalizedMessage() }),
+ e));
+ return Optional.empty();
+ }
+ }
+
private static Object queryAdapterManager(Object sourceObject, String adapterId, boolean allowActivation) {
Object result;
if (allowActivation) {
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/FileLocator.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/FileLocator.java
index 9d7795e..bb2cacb 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/FileLocator.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/FileLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2018 IBM Corporation and others.
+ * Copyright (c) 2006, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,12 +12,14 @@
* IBM Corporation - initial API and implementation
* Sergey Prigogin (Google) - use parameterized types (bug 442021)
* Lars Vogel <Lars.Vogel@vogella.com> - Bug 483464
+ * Hannes Wellmann - Bug 577574 - Speed-up and simplify getBundleFile() and add getBundleFileLocation
*******************************************************************************/
package org.eclipse.core.runtime;
import java.io.*;
import java.net.URL;
import java.util.Map;
+import java.util.Optional;
import org.eclipse.core.internal.runtime.Activator;
import org.eclipse.core.internal.runtime.FindSupport;
import org.eclipse.osgi.service.urlconversion.URLConverter;
@@ -284,9 +286,9 @@ public final class FileLocator {
}
/**
- * Returns a file for the contents of the specified bundle. Depending
- * on how the bundle is installed the returned file may be a directory or a jar file
- * containing the bundle content.
+ * Returns a file for the contents of the specified bundle. Depending on how the
+ * bundle is installed the returned file may be a directory or a jar file
+ * containing the bundle content.
*
* @param bundle the bundle
* @return a file with the contents of the bundle
@@ -295,19 +297,26 @@ public final class FileLocator {
* @since org.eclipse.equinox.common 3.4
*/
public static File getBundleFile(Bundle bundle) throws IOException {
- URL rootEntry = bundle.getEntry("/"); //$NON-NLS-1$
- rootEntry = resolve(rootEntry);
- if ("file".equals(rootEntry.getProtocol())) //$NON-NLS-1$
- return new File(rootEntry.getPath());
- if ("jar".equals(rootEntry.getProtocol())) { //$NON-NLS-1$
- String path = rootEntry.getPath();
- if (path.startsWith("file:")) { //$NON-NLS-1$
- // strip off the file: and the !/
- path = path.substring(5, path.length() - 2);
- return new File(path);
- }
- }
- throw new IOException("Unknown protocol"); //$NON-NLS-1$
+ return getBundleFileLocation(bundle)
+ .orElseThrow(() -> new IOException("Unable to locate the bundle file: " + bundle)); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns an {@code Optional} {@link File}, that (if present) describes the
+ * bundle's root location on the file system.
+ * <p>
+ * Depending on how the bundle is installed the returned file may be a directory
+ * or a jar file containing the bundle content. In case the location cannot be
+ * determined the returned {@code Optional} is empty, which is for example
+ * usually the case for {@code CONNECT} bundles.
+ * <p>
+ *
+ * @param bundle the bundle
+ * @return the optional file to the location of the bundle's root
+ * @since 3.16
+ */
+ public static Optional<File> getBundleFileLocation(Bundle bundle) {
+ return Optional.ofNullable(bundle.adapt(File.class));
}
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java
index 85adad9..e343b0f 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java
@@ -216,7 +216,7 @@ public class Status implements IStatus {
}
private String interpolateMessage(String msg, Throwable e) {
- if (msg == null && e != null) {
+ if ((msg == null || msg.isEmpty()) && e != null) {
msg = e.getLocalizedMessage();
if (msg == null || msg.isEmpty()) { // null was the old NPE msg Style
msg = e.getClass().getSimpleName();
diff --git a/bundles/org.eclipse.equinox.compendium.tests/pom.xml b/bundles/org.eclipse.equinox.compendium.tests/pom.xml
index 3833b33..f4645b5 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.compendium.tests/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.concurrent/pom.xml b/bundles/org.eclipse.equinox.concurrent/pom.xml
index 4440366..7af7729 100644
--- a/bundles/org.eclipse.equinox.concurrent/pom.xml
+++ b/bundles/org.eclipse.equinox.concurrent/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.console.jaas.fragment/pom.xml b/bundles/org.eclipse.equinox.console.jaas.fragment/pom.xml
index 242c287..ad2988a 100644
--- a/bundles/org.eclipse.equinox.console.jaas.fragment/pom.xml
+++ b/bundles/org.eclipse.equinox.console.jaas.fragment/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF
index 2baaadb..9fc400f 100755
--- a/bundles/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.console.ssh.tests/META-INF/MANIFEST.MF
@@ -3,14 +3,16 @@ Bundle-ManifestVersion: 2
Bundle-Name: Ssh Tests
Bundle-Vendor: Eclipse.org - Equinox
Bundle-SymbolicName: org.eclipse.equinox.console.ssh.tests
-Bundle-Version: 1.1.100.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.sshd.client.future,
- org.apache.sshd.client,
- org.apache.sshd.client.session,
+Import-Package: org.apache.sshd.client,
org.apache.sshd.client.channel,
- org.easymock;version="2.4.0",
- org.junit;version="4.8.1"
+ org.apache.sshd.client.future,
+ org.apache.sshd.client.session,
+ org.junit;version="4.8.1",
+ org.mockito,
+ org.mockito.stubbing,
+ org.mockito.invocation
Fragment-Host: org.eclipse.equinox.console.ssh, org.eclipse.equinox.console
Automatic-Module-Name: org.eclipse.equinox.console.ssh.tests
diff --git a/bundles/org.eclipse.equinox.console.ssh.tests/pom.xml b/bundles/org.eclipse.equinox.console.ssh.tests/pom.xml
index e4ea8c0..3cddad7 100644
--- a/bundles/org.eclipse.equinox.console.ssh.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.console.ssh.tests/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<properties>
@@ -23,6 +23,6 @@
</properties>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.console.ssh.tests</artifactId>
- <version>1.1.100-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java b/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java
index 923b0c5..af78e93 100755
--- a/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java
+++ b/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2018 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,10 @@
package org.eclipse.equinox.console.ssh;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -32,7 +36,6 @@ import org.apache.sshd.client.future.ConnectFuture;
import org.apache.sshd.client.future.DefaultConnectFuture;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.server.Environment;
-import org.easymock.EasyMock;
import org.eclipse.equinox.console.common.ConsoleInputStream;
import org.eclipse.equinox.console.storage.DigestUtil;
import org.eclipse.equinox.console.storage.SecureUserStore;
@@ -74,32 +77,24 @@ public class SshCommandTests {
@SuppressWarnings("unchecked")
@Test
public void testSshCommand() throws Exception {
- try (CommandSession session = EasyMock.createMock(CommandSession.class)) {
- EasyMock.makeThreadSafe(session, true);
- EasyMock.expect(session.put((String) EasyMock.anyObject(), EasyMock.anyObject())).andReturn(new Object());
- EasyMock.expect(session.execute(GOGO_SHELL_COMMAND)).andReturn(null);
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
-
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream) EasyMock.anyObject(),
- (PrintStream) EasyMock.anyObject(), (PrintStream) EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
- BundleContext context = EasyMock.createMock(BundleContext.class);
- EasyMock.makeThreadSafe(context, true);
- EasyMock.expect(context.getProperty(USE_CONFIG_ADMIN_PROP)).andReturn(FALSE);
- EasyMock.expect(context.getProperty(DEFAULT_USER_STORAGE)).andReturn(TRUE).anyTimes();
- EasyMock.expect(context.getProperty(SSH_PORT_PROP_NAME)).andReturn(Integer.toString(SSH_PORT));
- EasyMock.expect(context.registerService((String) EasyMock.anyObject(), EasyMock.anyObject(),
- (Dictionary<String, ?>) EasyMock.anyObject())).andReturn(null);
- EasyMock.replay(context);
+ try (CommandSession session = mock(CommandSession.class)) {
+ when(session.put(any(String.class), any())).thenReturn(new Object());
+ when(session.execute(GOGO_SHELL_COMMAND)).thenReturn(null);
+
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class),
+ any(PrintStream.class), any(PrintStream.class))).thenReturn(session);
+ BundleContext context = mock(BundleContext.class);
+ when(context.getProperty(USE_CONFIG_ADMIN_PROP)).thenReturn(FALSE);
+ when(context.getProperty(DEFAULT_USER_STORAGE)).thenReturn(TRUE);
+ when(context.getProperty(SSH_PORT_PROP_NAME)).thenReturn(Integer.toString(SSH_PORT));
+ when(context.registerService(any(String.class), any(),
+ any(Dictionary.class))).thenReturn(null);
Map<String, String> environment = new HashMap<>();
environment.put(TERM_PROPERTY, XTERM);
- Environment env = EasyMock.createMock(Environment.class);
- EasyMock.expect(env.getEnv()).andReturn(environment);
- EasyMock.replay(env);
+ Environment env = mock(Environment.class);
+ when(env.getEnv()).thenReturn(environment);
SshCommand command = new SshCommand(processor, context);
command.ssh(new String[] { START_COMMAND });
@@ -137,7 +132,6 @@ public class SshCommandTests {
}
command.ssh(new String[] { STOP_COMMAND });
- return;
}
}
diff --git a/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java b/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java
index c72c30f..ec03736 100755
--- a/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java
+++ b/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshCommandWithConfigAdminTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2018 SAP AG and others
+ * Copyright (c) 2011, 2021 SAP AG and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.equinox.console.ssh;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -33,8 +37,6 @@ import org.apache.sshd.client.future.DefaultConnectFuture;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.common.RuntimeSshException;
import org.apache.sshd.server.Environment;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
import org.eclipse.equinox.console.common.ConsoleInputStream;
import org.eclipse.equinox.console.storage.DigestUtil;
import org.eclipse.equinox.console.storage.SecureUserStore;
@@ -78,43 +80,29 @@ public class SshCommandWithConfigAdminTests {
@Test
public void testSshCommandWithConfigAdmin() throws Exception {
- try (CommandSession session = EasyMock.createMock(CommandSession.class)) {
- EasyMock.makeThreadSafe(session, true);
- EasyMock.expect(session.put((String) EasyMock.anyObject(), EasyMock.anyObject()))
- .andReturn(EasyMock.anyObject()).times(5);
- EasyMock.expect(session.execute(GOGO_SHELL_COMMAND)).andReturn(null);
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
-
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream) EasyMock.anyObject(),
- (PrintStream) EasyMock.anyObject(), (PrintStream) EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
-
- final ServiceRegistration<?> registration = EasyMock.createMock(ServiceRegistration.class);
- registration.setProperties((Dictionary<String, ?>) EasyMock.anyObject());
- EasyMock.expectLastCall();
- EasyMock.replay(registration);
-
- BundleContext context = EasyMock.createMock(BundleContext.class);
- EasyMock.makeThreadSafe(context, true);
- EasyMock.expect(context.getProperty(USE_CONFIG_ADMIN_PROP)).andReturn(TRUE);
- EasyMock.expect(context.getProperty(DEFAULT_USER_STORAGE)).andReturn(TRUE).anyTimes();
- EasyMock.expect((ServiceRegistration) context.registerService((String) EasyMock.anyObject(),
- (ManagedService) EasyMock.anyObject(), (Dictionary<String, ?>) EasyMock.anyObject()))
- .andAnswer((IAnswer<ServiceRegistration<?>>) () -> {
- configurator = (ManagedService) EasyMock.getCurrentArguments()[1];
- return registration;
- });
- EasyMock.expect(context.registerService((String) EasyMock.anyObject(), (SshCommand) EasyMock.anyObject(),
- (Dictionary<String, ?>) EasyMock.anyObject())).andReturn(null);
- EasyMock.replay(context);
+ try (CommandSession session = mock(CommandSession.class)) {
+ when(session.put(any(String.class), any())).thenReturn(any());
+ when(session.execute(GOGO_SHELL_COMMAND)).thenReturn(null);
+
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class), any(PrintStream.class)))
+ .thenReturn(session);
+
+ final ServiceRegistration<?> registration = mock(ServiceRegistration.class);
+ registration.setProperties(any(Dictionary.class));
+
+ BundleContext context = mock(BundleContext.class);
+ when(context.getProperty(USE_CONFIG_ADMIN_PROP)).thenReturn(TRUE);
+ when(context.getProperty(DEFAULT_USER_STORAGE)).thenReturn(TRUE);
+ when(context.registerService(any(String.class), any(ManagedService.class), any(Dictionary.class)))
+ .thenAnswer(invocation -> (ManagedService) invocation.getArguments()[1]);
+
+ when(context.registerService(any(String.class), any(SshCommand.class), any(Dictionary.class)))
+ .thenReturn(null);
Map<String, String> environment = new HashMap<>();
environment.put(TERM_PROPERTY, XTERM);
- Environment env = EasyMock.createMock(Environment.class);
- EasyMock.expect(env.getEnv()).andReturn(environment);
- EasyMock.replay(env);
+ Environment env = mock(Environment.class);
+ when(env.getEnv()).thenReturn(environment);
SshCommand command = new SshCommand(processor, context);
Dictionary<String, Object> props = new Hashtable<>();
@@ -158,6 +146,7 @@ public class SshCommandWithConfigAdminTests {
command.ssh(new String[] { STOP_COMMAND });
}
+
}
@Test
@@ -172,41 +161,30 @@ public class SshCommandWithConfigAdminTests {
@SuppressWarnings("unchecked")
private void testDisabled(boolean isDefault) throws Exception {
- try (CommandSession session = EasyMock.createMock(CommandSession.class)) {
- EasyMock.expect(session.put((String) EasyMock.anyObject(), EasyMock.anyObject()))
- .andReturn(EasyMock.anyObject()).times(4);
- EasyMock.expect(session.execute(GOGO_SHELL_COMMAND)).andReturn(null);
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream) EasyMock.anyObject(),
- (PrintStream) EasyMock.anyObject(), (PrintStream) EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
-
- final ServiceRegistration<?> registration = EasyMock.createMock(ServiceRegistration.class);
- registration.setProperties((Dictionary<String, ?>) EasyMock.anyObject());
- EasyMock.expectLastCall();
- EasyMock.replay(registration);
-
- BundleContext context = EasyMock.createMock(BundleContext.class);
- EasyMock.expect(context.getProperty(USE_CONFIG_ADMIN_PROP)).andReturn(TRUE);
- EasyMock.expect(context.getProperty(DEFAULT_USER_STORAGE)).andReturn(TRUE).anyTimes();
- EasyMock.expect((ServiceRegistration) context.registerService((String) EasyMock.anyObject(),
- (ManagedService) EasyMock.anyObject(), (Dictionary<String, ?>) EasyMock.anyObject()))
- .andAnswer((IAnswer<ServiceRegistration<?>>) () -> {
- configurator = (ManagedService) EasyMock.getCurrentArguments()[1];
- return registration;
- });
- EasyMock.expect(context.registerService((String) EasyMock.anyObject(), (SshCommand) EasyMock.anyObject(),
- (Dictionary<String, ?>) EasyMock.anyObject())).andReturn(null);
- EasyMock.replay(context);
+ try (CommandSession session = mock(CommandSession.class)) {
+ when(session.put(any(String.class), any())).thenReturn(any());
+ when(session.execute(GOGO_SHELL_COMMAND)).thenReturn(null);
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class), any(PrintStream.class)))
+ .thenReturn(session);
+
+ final ServiceRegistration<?> registration = mock(ServiceRegistration.class);
+ registration.setProperties(any(Dictionary.class));
+
+ BundleContext context = mock(BundleContext.class);
+ when(context.getProperty(USE_CONFIG_ADMIN_PROP)).thenReturn(TRUE);
+ when(context.getProperty(DEFAULT_USER_STORAGE)).thenReturn(TRUE);
+ when(context.registerService(any(String.class), any(), any(Dictionary.class))).thenAnswer(invocation -> {
+ configurator = (ManagedService) invocation.getArguments()[1];
+ return registration;
+ });
+ when(context.registerService(any(String.class), any(SshCommand.class), any(Dictionary.class)))
+ .thenReturn(null);
Map<String, String> environment = new HashMap<>();
environment.put(TERM_PROPERTY, XTERM);
- Environment env = EasyMock.createMock(Environment.class);
- EasyMock.expect(env.getEnv()).andReturn(environment);
- EasyMock.replay(env);
+ Environment env = mock(Environment.class);
+ when(env.getEnv()).thenReturn(environment);
SshCommand command = new SshCommand(processor, context);
Dictionary<String, Object> props = new Hashtable<>();
diff --git a/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java b/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java
index 8e3a84c..fc11901 100755
--- a/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java
+++ b/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshShellTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2020 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,10 @@
package org.eclipse.equinox.console.ssh;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
@@ -29,7 +33,6 @@ import org.apache.felix.service.command.CommandProcessor;
import org.apache.felix.service.command.CommandSession;
import org.apache.sshd.server.Environment;
import org.apache.sshd.server.channel.ChannelSession;
-import org.easymock.EasyMock;
import org.eclipse.equinox.console.common.ConsoleInputStream;
import org.eclipse.equinox.console.storage.DigestUtil;
import org.eclipse.equinox.console.storage.SecureUserStore;
@@ -66,29 +69,20 @@ public class SshShellTests {
try (ServerSocket servSocket = new ServerSocket(0);
Socket socketClient = new Socket(HOST, servSocket.getLocalPort());
Socket socketServer = servSocket.accept()) {
- try (CommandSession session = EasyMock.createMock(CommandSession.class)) {
- EasyMock.makeThreadSafe(session, true);
- EasyMock.expect(session.put((String) EasyMock.anyObject(), EasyMock.anyObject()))
- .andReturn(EasyMock.anyObject());
- EasyMock.expect(session.execute(GOGO_SHELL_COMMAND)).andReturn(null);
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream) EasyMock.anyObject(),
- (PrintStream) EasyMock.anyObject(), (PrintStream) EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
-
- BundleContext context = EasyMock.createMock(BundleContext.class);
- EasyMock.makeThreadSafe(context, true);
- EasyMock.expect(context.getProperty(DEFAULT_USER_STORAGE)).andReturn(TRUE);
- EasyMock.replay(context);
+ try (CommandSession session = mock(CommandSession.class)) {
+ when(session.put(any(String.class), any())).thenReturn(any());
+ when(session.execute(GOGO_SHELL_COMMAND)).thenReturn(null);
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class),
+ any(PrintStream.class))).thenReturn(session);
+
+ BundleContext context = mock(BundleContext.class);
+ when(context.getProperty(DEFAULT_USER_STORAGE)).thenReturn(TRUE);
Map<String, String> environment = new HashMap<>();
environment.put(TERM_PROPERTY, XTERM);
- Environment env = EasyMock.createMock(Environment.class);
- EasyMock.expect(env.getEnv()).andReturn(environment);
- EasyMock.replay(env);
+ Environment env = mock(Environment.class);
+ when(env.getEnv()).thenReturn(environment);
List<CommandProcessor> processors = new ArrayList<>();
processors.add(processor);
@@ -104,9 +98,9 @@ public class SshShellTests {
outClient.flush();
try (InputStream input = socketClient.getInputStream()) {
int in = input.read();
- Assert.assertTrue(
+ Assert.assertEquals(
"Server received [" + in + "] instead of " + TEST_CONTENT + " from the ssh client.",
- in == TEST_CONTENT);
+ TEST_CONTENT, in);
}
}
}
diff --git a/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java b/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java
index 5ee7327..d59e0d9 100755
--- a/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java
+++ b/bundles/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/UserAdminCommandTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SAP AG
+ * Copyright (c) 2011, 2021 SAP AG and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Lazar Kirchev, SAP AG - initial API and implementation
*******************************************************************************/
@@ -18,17 +18,18 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import org.apache.felix.service.command.CommandSession;
-import org.easymock.EasyMock;
import org.eclipse.equinox.console.storage.DigestUtil;
import org.eclipse.equinox.console.storage.SecureUserStore;
import org.junit.After;
import org.junit.Test;
+import org.mockito.Mockito;
public class UserAdminCommandTests {
@@ -37,7 +38,7 @@ public class UserAdminCommandTests {
private static final String USER_STORE_FILE_NAME = UserAdminCommandTests.class.getName() + "_store";
private static final String USERNAME_OPTION = "-username";
private static final String PASSWORD_OPTION = "-password";
- private static final String ROLES_OPTION = "-roles";
+ private static final String ROLES_OPTION = "-roles";
private static final String USERNAME1 = "username1";
private static final String USERNAME2 = "username2";
private static final String PASSWORD1 = "password1";
@@ -46,55 +47,54 @@ public class UserAdminCommandTests {
private static final String ROLES2 = "role3,role4";
private static final String ROLES_TO_REMOVE = "role2";
private static final String REMAINING_ROLES = "role1";
-
+
@Test
public void testCommand() throws Exception {
cleanUp();
-
+
System.setProperty(USER_STORE_FILE_NAME_PROPERTY, USER_STORE_FILE_NAME);
SecureUserStore.initStorage();
-
- CommandSession session = EasyMock.createMock(CommandSession.class);
- EasyMock.expect(session.put((String)EasyMock.anyObject(), EasyMock.anyObject())).andReturn(new Object()).times(3);
- EasyMock.replay(session);
-
+
+ CommandSession session = Mockito.mock(CommandSession.class);
+ Mockito.when(session.put(any(String.class), any())).thenReturn(new Object());
+
UserAdminCommand command = new UserAdminCommand();
command.addUser(new String[] {USERNAME_OPTION, USERNAME1, PASSWORD_OPTION, PASSWORD1});
command.addUser(new String[] {USERNAME_OPTION, USERNAME2, PASSWORD_OPTION, PASSWORD2, ROLES_OPTION, ROLES2});
-
+
String[] usernames = SecureUserStore.getUserNames();
boolean arePresent = (usernames[0].equals(USERNAME1) || usernames[0].equals(USERNAME2)) && (usernames[1].equals(USERNAME1) || usernames[1].equals(USERNAME2)) && (!usernames[0].equals(usernames[1]));
assertTrue("Usernames not correctly saved", arePresent);
-
+
String pass1 = SecureUserStore.getPassword(USERNAME1);
String pass2 = SecureUserStore.getPassword(USERNAME2);
assertTrue("Passwords not correctly saved", pass1.equals(DigestUtil.encrypt(PASSWORD1)) && pass2.equals(DigestUtil.encrypt(PASSWORD2)));
-
+
String roles = SecureUserStore.getRoles(USERNAME2);
assertEquals("Roles for the second user are not as expected", ROLES2, roles);
-
+
command.addRoles(new String[] {USERNAME_OPTION, USERNAME1, ROLES_OPTION, ROLES1});
roles = SecureUserStore.getRoles(USERNAME1);
boolean areRolesEqual = compareRoles(ROLES1, roles);
assertTrue("Roles for the first user are not as expected", areRolesEqual);
-
+
command.removeRoles(new String[] {USERNAME_OPTION, USERNAME1, ROLES_OPTION, ROLES_TO_REMOVE});
roles = SecureUserStore.getRoles(USERNAME1);
areRolesEqual = compareRoles(REMAINING_ROLES, roles);
assertTrue("Roles for the first user are not as expected", areRolesEqual);
-
+
command.resetPassword(USERNAME1);
String pass = SecureUserStore.getPassword(USERNAME1);
assertNull("Password should be null", pass);
-
+
command.setPassword(new String[] {USERNAME_OPTION, USERNAME1, PASSWORD_OPTION, PASSWORD1});
pass = SecureUserStore.getPassword(USERNAME1);
assertEquals("Password should be null", DigestUtil.encrypt(PASSWORD1), pass);
-
+
command.deleteUser(USERNAME2);
assertFalse("User2 should not exist", SecureUserStore.existsUser(USERNAME2));
}
-
+
@After
public void cleanUp() {
System.setProperty(USER_STORE_FILE_NAME_PROPERTY, "");
@@ -103,19 +103,19 @@ public class UserAdminCommandTests {
file.delete();
}
}
-
+
private boolean compareRoles(String expectedRoles, String actualRoles) {
Set<String> expectedRolesSet = new HashSet<>();
for(String role : expectedRoles.split(",")) {
expectedRolesSet.add(role);
}
-
+
Set<String> actualRolesSet = new HashSet<>();
for(String role : actualRoles.split(",")) {
actualRolesSet.add(role);
}
-
+
return expectedRolesSet.equals(actualRolesSet);
}
-
+
}
diff --git a/bundles/org.eclipse.equinox.console.ssh/pom.xml b/bundles/org.eclipse.equinox.console.ssh/pom.xml
index 92b70bc..b21fb28 100644
--- a/bundles/org.eclipse.equinox.console.ssh/pom.xml
+++ b/bundles/org.eclipse.equinox.console.ssh/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.console.tests/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.console.tests/.settings/org.eclipse.jdt.ui.prefs
index 9e213f6..52baf43 100644
--- a/bundles/org.eclipse.equinox.console.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.equinox.console.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -1,3 +1,143 @@
+cleanup_settings_version=2
eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
formatter_settings_version=21
+sp_cleanup.add_all=false
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.array_with_curly=false
+sp_cleanup.arrays_fill=false
+sp_cleanup.bitwise_conditional_expression=false
+sp_cleanup.boolean_literal=false
+sp_cleanup.boolean_value_rather_than_comparison=false
+sp_cleanup.break_loop=false
+sp_cleanup.collection_cloning=false
+sp_cleanup.comparing_on_criteria=false
+sp_cleanup.comparison_statement=false
+sp_cleanup.controlflow_merge=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
+sp_cleanup.convert_to_switch_expressions=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.do_while_rather_than_while=false
+sp_cleanup.double_negation=false
+sp_cleanup.else_if=false
+sp_cleanup.embedded_if=false
+sp_cleanup.evaluate_nullable=false
+sp_cleanup.extract_increment=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.hash=false
+sp_cleanup.if_condition=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.instanceof=false
+sp_cleanup.instanceof_keyword=false
+sp_cleanup.invert_equals=false
+sp_cleanup.join=false
+sp_cleanup.lazy_logical_operator=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.map_cloning=false
+sp_cleanup.merge_conditional_blocks=false
+sp_cleanup.multi_catch=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.no_string_creation=false
+sp_cleanup.no_super=false
+sp_cleanup.number_suffix=false
+sp_cleanup.objects_equals=false
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=false
+sp_cleanup.operand_factorization=false
+sp_cleanup.organize_imports=true
+sp_cleanup.overridden_assignment=false
+sp_cleanup.plain_replacement=false
+sp_cleanup.precompile_regex=false
+sp_cleanup.primitive_comparison=false
+sp_cleanup.primitive_parsing=false
+sp_cleanup.primitive_rather_than_wrapper=false
+sp_cleanup.primitive_serialization=false
+sp_cleanup.pull_out_if_from_if_else=false
+sp_cleanup.pull_up_assignment=false
+sp_cleanup.push_down_negation=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.reduce_indentation=false
+sp_cleanup.redundant_comparator=false
+sp_cleanup.redundant_falling_through_block_end=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=false
+sp_cleanup.remove_redundant_semicolons=false
+sp_cleanup.remove_redundant_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_array_creation=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.return_expression=false
+sp_cleanup.simplify_lambda_expression_and_method_ref=false
+sp_cleanup.single_used_field=false
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.standard_comparison=false
+sp_cleanup.static_inner_class=false
+sp_cleanup.strictly_equal_or_different=false
+sp_cleanup.stringbuffer_to_stringbuilder=false
+sp_cleanup.stringbuilder=false
+sp_cleanup.stringbuilder_for_local_vars=true
+sp_cleanup.stringconcat_to_textblock=false
+sp_cleanup.substring=false
+sp_cleanup.switch=false
+sp_cleanup.system_property=false
+sp_cleanup.system_property_boolean=false
+sp_cleanup.system_property_file_encoding=false
+sp_cleanup.system_property_file_separator=false
+sp_cleanup.system_property_line_separator=false
+sp_cleanup.system_property_path_separator=false
+sp_cleanup.ternary_operator=false
+sp_cleanup.try_with_resource=false
+sp_cleanup.unlooped_while=false
+sp_cleanup.unreachable_block=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_autoboxing=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_directly_map_method=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_string_is_blank=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_unboxing=false
+sp_cleanup.use_var=false
+sp_cleanup.useless_continue=false
+sp_cleanup.useless_return=false
+sp_cleanup.valueof_rather_than_instantiation=false
diff --git a/bundles/org.eclipse.equinox.console.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.console.tests/META-INF/MANIFEST.MF
index 9c465f3..965fb32 100755
--- a/bundles/org.eclipse.equinox.console.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.console.tests/META-INF/MANIFEST.MF
@@ -3,11 +3,13 @@ Bundle-ManifestVersion: 2
Bundle-Name: Console tests
Bundle-Vendor: Eclipse.org - Equinox
Bundle-SymbolicName: org.eclipse.equinox.console.tests
-Bundle-Version: 1.1.100.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.sshd.client.future,
- org.easymock;version="2.4.0",
- org.junit;version="4.8.1"
+ org.junit;version="4.8.1",
+ org.mockito,
+ org.mockito.stubbing,
+ org.mockito.invocation
Fragment-Host: org.eclipse.equinox.console
Automatic-Module-Name: org.eclipse.equinox.console.tests
diff --git a/bundles/org.eclipse.equinox.console.tests/pom.xml b/bundles/org.eclipse.equinox.console.tests/pom.xml
index 1b0601d..d26f1ec 100644
--- a/bundles/org.eclipse.equinox.console.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.console.tests/pom.xml
@@ -14,12 +14,12 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.console.tests</artifactId>
- <version>1.1.100-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<skipTests>true</skipTests>
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/command/adapter/CommandProviderAdapterTest.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/command/adapter/CommandProviderAdapterTest.java
index e0928c9..aae006d 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/command/adapter/CommandProviderAdapterTest.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/command/adapter/CommandProviderAdapterTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,6 +15,7 @@
package org.eclipse.equinox.console.command.adapter;
import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
import java.lang.reflect.Method;
import java.util.HashSet;
@@ -24,7 +25,6 @@ import org.apache.felix.service.command.CommandSession;
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
import org.junit.Test;
-import org.easymock.EasyMock;
public class CommandProviderAdapterTest {
@@ -39,7 +39,7 @@ public class CommandProviderAdapterTest {
}
}
CommandProviderAdapter providerAdapter = new CommandProviderAdapter(provider, m.toArray(new Method[0]));
- CommandSession session = EasyMock.createMock(CommandSession.class);
+ CommandSession session = mock(CommandSession.class);
String result = (String) providerAdapter.main(session, new Object[] {"test"});
assertEquals("Result should be test", "test", result);
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/CommandNamesCompleterTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/CommandNamesCompleterTests.java
index 28b0cb0..e8041a4 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/CommandNamesCompleterTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/CommandNamesCompleterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,7 +15,7 @@
package org.eclipse.equinox.console.completion;
import static org.junit.Assert.*;
-import static org.easymock.EasyMock.*;
+import static org.mockito.Mockito.*;
import java.util.HashSet;
import java.util.Map;
@@ -42,19 +42,15 @@ public class CommandNamesCompleterTests {
commands.add("gogo:echo");
commands.add("gogo:set");
- CommandSession session = createMock(CommandSession.class);
- expect(session.get(COMMANDS)).andReturn(commands).times(4);
- replay(session);
+ CommandSession session = mock(CommandSession.class);
+ when(session.get(COMMANDS)).thenReturn(commands);
- Filter filter = createMock(Filter.class);
- replay(filter);
+ Filter filter = mock(Filter.class);
- BundleContext context = createMock(BundleContext.class);
-// expect(context.createFilter(String.format("(&(%s=*)(%s=*))", CommandProcessor.COMMAND_SCOPE, CommandProcessor.COMMAND_FUNCTION))).andReturn(filter);
- expect(context.createFilter("(objectClass=org.eclipse.equinox.console.commands.CommandsTracker)")).andReturn(filter);
+ BundleContext context = mock(BundleContext.class);
+ when(context.createFilter("(objectClass=org.eclipse.equinox.console.commands.CommandsTracker)")).thenReturn(filter);
context.addServiceListener(isA(ServiceListener.class), isA(String.class));
- expect(context.getServiceReferences("org.eclipse.equinox.console.commands.CommandsTracker", null)).andReturn(new ServiceReference[]{});
- replay(context);
+ when(context.getServiceReferences("org.eclipse.equinox.console.commands.CommandsTracker", null)).thenReturn(new ServiceReference[]{});
CommandNamesCompleter completer = new CommandNamesCompleter(context, session);
Map<String, Integer> candidates;
@@ -78,8 +74,6 @@ public class CommandNamesCompleterTests {
candidates = completer.getCandidates("head", 4);
assertNotNull("Candidates null", candidates);
assertEquals("Candidates not as expected", 0, candidates.size());
-
- verify(session);
}
}
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/CompletionHandlerTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/CompletionHandlerTests.java
index 9c610b5..9c6ef00 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/CompletionHandlerTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/CompletionHandlerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,7 +15,7 @@
package org.eclipse.equinox.console.completion;
import static org.junit.Assert.*;
-import static org.easymock.EasyMock.*;
+import static org.mockito.Mockito.*;
import java.io.File;
import java.io.FileOutputStream;
@@ -64,16 +64,13 @@ public class CompletionHandlerTests {
@Test
public void testGetCandidates() throws Exception {
- Filter filter = createMock(Filter.class);
- replay(filter);
-
- BundleContext context = createMock(BundleContext.class);
- expect(context.getServiceReferences(Completer.class.getName(), null)).andReturn(null).anyTimes();
- expect(context.createFilter("(objectClass=org.eclipse.equinox.console.commands.CommandsTracker)")).andReturn(filter).anyTimes();
+ Filter filter = mock(Filter.class);
+
+ BundleContext context = mock(BundleContext.class);
+ when(context.getServiceReferences(Completer.class.getName(), null)).thenReturn(null);
+ when(context.createFilter("(objectClass=org.eclipse.equinox.console.commands.CommandsTracker)")).thenReturn(filter);
context.addServiceListener(isA(ServiceListener.class), isA(String.class));
- expectLastCall().anyTimes();
- expect(context.getServiceReferences("org.eclipse.equinox.console.commands.CommandsTracker", null)).andReturn(new ServiceReference[]{}).anyTimes();
- replay(context);
+ when(context.getServiceReferences("org.eclipse.equinox.console.commands.CommandsTracker", null)).thenReturn(new ServiceReference[]{});
Set<String> variables = new HashSet<>();
variables.add("SCOPE");
@@ -89,10 +86,9 @@ public class CompletionHandlerTests {
commands.add("gogo:echo");
commands.add("gogo:set");
- CommandSession session = createMock(CommandSession.class);
- expect(session.get(null)).andReturn(variables).anyTimes();
- expect(session.get(COMMANDS)).andReturn(commands).anyTimes();
- replay(session);
+ CommandSession session = mock(CommandSession.class);
+ when(session.get(null)).thenReturn(variables);
+ when(session.get(COMMANDS)).thenReturn(commands);
CompletionHandler completer = new CompletionHandler(context, session);
Map<String, Integer> candidates;
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/VariableNamesCompleterTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/VariableNamesCompleterTests.java
index 4875877..93ee49f 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/VariableNamesCompleterTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/completion/VariableNamesCompleterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,7 +14,7 @@
package org.eclipse.equinox.console.completion;
-import static org.easymock.EasyMock.*;
+import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
import java.util.HashSet;
@@ -34,9 +34,8 @@ public class VariableNamesCompleterTests {
variables.add("ECHO_ON");
variables.add("ECHO");
- CommandSession session = createMock(CommandSession.class);
- expect(session.get(null)).andReturn(variables).times(3);
- replay(session);
+ CommandSession session = mock(CommandSession.class);
+ when(session.get(null)).thenReturn(variables);
VariableNamesCompleter completer = new VariableNamesCompleter(session);
Map<String, Integer> candidates;
@@ -55,8 +54,5 @@ public class VariableNamesCompleterTests {
candidates = completer.getCandidates("AB", 2);
assertNotNull("Candidates null", candidates);
assertEquals("Candidates not as expected", 0, candidates.size());
-
- verify(session);
}
-
}
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/supportability/ConsoleInputScannerTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/supportability/ConsoleInputScannerTests.java
index 3020358..e87b92e 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/supportability/ConsoleInputScannerTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/supportability/ConsoleInputScannerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,10 +14,7 @@
package org.eclipse.equinox.console.supportability;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
+import static org.mockito.Mockito.*;
import org.apache.felix.service.command.CommandSession;
import org.eclipse.equinox.console.common.ConsoleInputScanner;
@@ -187,15 +184,13 @@ public class ConsoleInputScannerTests {
res = byteOut.toString();
Assert.assertTrue("Error processing Ins; expected las, actual " + res.substring(res.length() - 4), res.endsWith("lasa"));
- Filter filter = createMock(Filter.class);
- replay(filter);
+ Filter filter = mock(Filter.class);
- BundleContext context = createMock(BundleContext.class);
- expect(context.getServiceReferences(Completer.class.getName(), null)).andReturn(null).anyTimes();
- expect(context.createFilter("(objectClass=org.eclipse.equinox.console.commands.CommandsTracker)")).andReturn(filter);
+ BundleContext context = mock(BundleContext.class);
+ when(context.getServiceReferences(Completer.class.getName(), null)).thenReturn(null);
+ when(context.createFilter("(objectClass=org.eclipse.equinox.console.commands.CommandsTracker)")).thenReturn(filter);
context.addServiceListener(isA(ServiceListener.class), isA(String.class));
- expect(context.getServiceReferences("org.eclipse.equinox.console.commands.CommandsTracker", null)).andReturn(new ServiceReference[]{});
- replay(context);
+ when(context.getServiceReferences("org.eclipse.equinox.console.commands.CommandsTracker", null)).thenReturn(new ServiceReference[]{});
Set<String> commands = new HashSet<>();
commands.add("equinox:bundles");
@@ -204,9 +199,8 @@ public class ConsoleInputScannerTests {
commands.add("gogo:bundlelevel");
commands.add("equinox:headers");
- CommandSession session = createMock(CommandSession.class);
- expect(session.get(COMMANDS)).andReturn(commands).anyTimes();
- replay(session);
+ CommandSession session = mock(CommandSession.class);
+ when(session.get(COMMANDS)).thenReturn(commands);
scanner.setContext(context);
scanner.setSession(session);
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetCommandTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetCommandTests.java
index 21fc84a..d02ec2a 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetCommandTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetCommandTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 SAP AG
+ * Copyright (c) 2011, 2021 SAP AG and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,10 @@
package org.eclipse.equinox.console.telnet;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.Socket;
@@ -21,12 +25,10 @@ import java.util.Dictionary;
import org.apache.felix.service.command.CommandProcessor;
import org.apache.felix.service.command.CommandSession;
-import org.easymock.EasyMock;
import org.eclipse.equinox.console.common.ConsoleInputStream;
import org.junit.Test;
import org.osgi.framework.BundleContext;
-
public class TelnetCommandTests {
private static final int TEST_CONTENT = 100;
@@ -40,23 +42,16 @@ public class TelnetCommandTests {
@Test
public void testTelnetCommand() throws Exception {
- try (CommandSession session = EasyMock.createMock(CommandSession.class)) {
- session.put((String)EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(3);
- EasyMock.expect(session.execute((String)EasyMock.anyObject())).andReturn(new Object());
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
+ try (CommandSession session = mock(CommandSession.class)) {
+ when(session.execute(any(String.class))).thenReturn(new Object());
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream)EasyMock.anyObject(), (PrintStream)EasyMock.anyObject(), (PrintStream)EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class), any(PrintStream.class))).thenReturn(session);
- BundleContext context = EasyMock.createMock(BundleContext.class);
- EasyMock.expect(context.getProperty(USE_CONFIG_ADMIN_PROP)).andReturn(FALSE);
- EasyMock.expect(context.getProperty(TELNET_PORT_PROP_NAME)).andReturn(Integer.toString(TELNET_PORT));
- EasyMock.expect(context.registerService((String)EasyMock.anyObject(), EasyMock.anyObject(), (Dictionary<String, ?>)EasyMock.anyObject())).andReturn(null);
- EasyMock.replay(context);
+ BundleContext context = mock(BundleContext.class);
+ when(context.getProperty(USE_CONFIG_ADMIN_PROP)).thenReturn(FALSE);
+ when(context.getProperty(TELNET_PORT_PROP_NAME)).thenReturn(Integer.toString(TELNET_PORT));
+ when(context.registerService(any(String.class), any(), any(Dictionary.class))).thenReturn(null);
TelnetCommand command = new TelnetCommand(processor, context);
command.startService();
@@ -76,7 +71,6 @@ public class TelnetCommandTests {
} finally {
command.telnet(new String[] {STOP_COMMAND});
}
- EasyMock.verify(context);
}
}
}
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetCommandWithConfigAdminTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetCommandWithConfigAdminTests.java
index 1d71aea..c8443f8 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetCommandWithConfigAdminTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetCommandWithConfigAdminTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,9 @@
package org.eclipse.equinox.console.telnet;
import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.io.IOException;
import java.io.OutputStream;
@@ -24,7 +27,6 @@ import java.util.Hashtable;
import org.apache.felix.service.command.CommandProcessor;
import org.apache.felix.service.command.CommandSession;
-import org.easymock.EasyMock;
import org.eclipse.equinox.console.common.ConsoleInputStream;
import org.junit.Test;
import org.osgi.framework.BundleContext;
@@ -45,42 +47,25 @@ public class TelnetCommandWithConfigAdminTests {
@Test
public void testTelnetCommandWithConfigAdminEnabledTelnet() throws Exception {
- CommandSession session = EasyMock.createMock(CommandSession.class);
- session.put((String)EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(3);
- EasyMock.expect(session.execute((String)EasyMock.anyObject())).andReturn(new Object());
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
+ CommandSession session = mock(CommandSession.class);
+ when(session.execute(any(String.class))).thenReturn(new Object());
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream)EasyMock.anyObject(), (PrintStream)EasyMock.anyObject(), (PrintStream)EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class), any(PrintStream.class))).thenReturn(session);
- final ServiceRegistration<?> registration = EasyMock.createMock(ServiceRegistration.class);
- registration.setProperties((Dictionary<String, ?>)EasyMock.anyObject());
+ final ServiceRegistration<?> registration = mock(ServiceRegistration.class);
- EasyMock.expectLastCall();
- EasyMock.replay(registration);
- BundleContext context = EasyMock.createMock(BundleContext.class);
- EasyMock.expect(context.getProperty(USE_CONFIG_ADMIN_PROP)).andReturn(TRUE);
- EasyMock.expect(
- (ServiceRegistration) context.registerService(
- (String)EasyMock.anyObject(),
- (ManagedService)EasyMock.anyObject(),
- (Dictionary<String, ?>)EasyMock.anyObject())
- ).andAnswer(() -> {
- configurator = (ManagedService) EasyMock.getCurrentArguments()[1];
- return registration;
- });
- EasyMock.expect(
- context.registerService(
- (String)EasyMock.anyObject(),
- (TelnetCommand)EasyMock.anyObject(),
- (Dictionary<String, ?>)EasyMock.anyObject())).andReturn(null);
- EasyMock.replay(context);
-
+ BundleContext context =mock(BundleContext.class);
+ when(context.getProperty(USE_CONFIG_ADMIN_PROP)).thenReturn(TRUE);
+ when(context.registerService(any(String.class), any(ManagedService.class), any(Dictionary.class)))
+ .thenAnswer(invocation -> {
+ configurator = (ManagedService) invocation.getArguments()[1];
+ return registration;
+ });
+ when(context.registerService(any(String.class), any(TelnetCommand.class), any(Dictionary.class)))
+ .thenReturn(null);
+
TelnetCommand command = new TelnetCommand(processor, context);
command.startService();
Dictionary<String, String> props = new Hashtable<>();
@@ -104,7 +89,6 @@ public class TelnetCommandWithConfigAdminTests {
} finally {
command.telnet(new String[] {STOP_COMMAND});
}
- EasyMock.verify(context);
}
@Test
@@ -118,42 +102,25 @@ public class TelnetCommandWithConfigAdminTests {
}
private void disabledTelnet(boolean isDefault) throws Exception {
- CommandSession session = EasyMock.createMock(CommandSession.class);
- session.put((String)EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(4);
- EasyMock.expect(session.execute((String)EasyMock.anyObject())).andReturn(new Object());
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
+ CommandSession session = mock(CommandSession.class);
+ when(session.execute(any(String.class))).thenReturn(new Object());
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream)EasyMock.anyObject(), (PrintStream)EasyMock.anyObject(), (PrintStream)EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class),
+ any(PrintStream.class))).thenReturn(session);
- final ServiceRegistration<?> registration = EasyMock.createMock(ServiceRegistration.class);
- registration.setProperties((Dictionary<String, ?>)EasyMock.anyObject());
+ final ServiceRegistration<?> registration = mock(ServiceRegistration.class);
- EasyMock.expectLastCall();
- EasyMock.replay(registration);
+ BundleContext context = mock(BundleContext.class);
+ when(context.getProperty(USE_CONFIG_ADMIN_PROP)).thenReturn(TRUE);
+ when(context.registerService(any(String.class), any(ManagedService.class), any(Dictionary.class)))
+ .thenAnswer(invocation -> {
+ configurator = (ManagedService) invocation.getArguments()[1];
+ return registration;
+ });
+ when(context.registerService(any(String.class), any(TelnetCommand.class), any(Dictionary.class)))
+ .thenReturn(null);
- BundleContext context = EasyMock.createMock(BundleContext.class);
- EasyMock.expect(context.getProperty(USE_CONFIG_ADMIN_PROP)).andReturn(TRUE);
- EasyMock.expect(
- (ServiceRegistration) context.registerService(
- (String)EasyMock.anyObject(),
- (ManagedService)EasyMock.anyObject(),
- (Dictionary<String, ?>)EasyMock.anyObject())
- ).andAnswer(() -> {
- configurator = (ManagedService) EasyMock.getCurrentArguments()[1];
- return registration;
- });
- EasyMock.expect(
- context.registerService(
- (String)EasyMock.anyObject(),
- (TelnetCommand)EasyMock.anyObject(),
- (Dictionary<String, ?>)EasyMock.anyObject())).andReturn(null);
- EasyMock.replay(context);
-
TelnetCommand command = new TelnetCommand(processor, context);
command.startService();
Dictionary<String, String> props = new Hashtable<>();
@@ -176,7 +143,6 @@ public class TelnetCommandWithConfigAdminTests {
//this is expected
}
}
- EasyMock.verify(context);
}
}
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetConnectionTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetConnectionTests.java
index acbf5bb..2ea267e 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetConnectionTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetConnectionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,12 +14,10 @@
package org.eclipse.equinox.console.telnet;
-import org.apache.felix.service.command.CommandProcessor;
-import org.apache.felix.service.command.CommandSession;
-import org.junit.Assert;
-import org.junit.Test;
-import org.easymock.EasyMock;
-import org.eclipse.equinox.console.common.ConsoleInputStream;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.io.InputStream;
import java.io.OutputStream;
@@ -27,6 +25,11 @@ import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
+import org.apache.felix.service.command.CommandProcessor;
+import org.apache.felix.service.command.CommandSession;
+import org.eclipse.equinox.console.common.ConsoleInputStream;
+import org.junit.Test;
+
public class TelnetConnectionTests {
private static final String HOST = "localhost";
@@ -39,19 +42,14 @@ public class TelnetConnectionTests {
try (ServerSocket servSocket = new ServerSocket(0);
Socket socketClient = new Socket(HOST, servSocket.getLocalPort());
Socket socketServer = servSocket.accept();
- CommandSession session = EasyMock.createMock(CommandSession.class)) {
+ CommandSession session = mock(CommandSession.class)) {
- session.put((String) EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(3);
- EasyMock.expect(session.execute((String) EasyMock.anyObject())).andReturn(null);
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
+ when(session.execute(any(String.class))).thenReturn(null);
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream) EasyMock.anyObject(),
- (PrintStream) EasyMock.anyObject(), (PrintStream) EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class),
+ any(PrintStream.class)))
+ .thenReturn(session);
try (TelnetConnection connection = new TelnetConnection(socketServer, processor, null)) {
connection.start();
@@ -63,20 +61,18 @@ public class TelnetConnectionTests {
InputStream input = socketServer.getInputStream();
int in = input.read();
- Assert.assertTrue(
- "Server received [" + in + "] instead of " + TEST_CONTENT + " from the telnet client.",
- in == TEST_CONTENT);
+ assertEquals("Server received [" + in + "] instead of " + TEST_CONTENT + " from the telnet client.",
+ TEST_CONTENT, in);
input = socketClient.getInputStream();
in = input.read();
// here IAC is expected, since when the output stream in TelnetConsoleSession is
// created, several telnet
// commands are written to it, each of them starting with IAC
- Assert.assertTrue("Client receive telnet responses from the server unexpected value [" + in
- + "] instead of " + IAC + ".", in == IAC);
+ assertEquals("Client receive telnet responses from the server unexpected value [" + in
+ + "] instead of " + IAC + ".", IAC, in);
connection.telnetNegotiationFinished();
Thread.sleep(5000);
- EasyMock.verify(session, processor);
}
}
}
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetDisconnectionTest.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetDisconnectionTest.java
index 84f25cb..7ee0fc1 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetDisconnectionTest.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetDisconnectionTest.java
@@ -1,5 +1,10 @@
package org.eclipse.equinox.console.telnet;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
@@ -9,10 +14,8 @@ import java.net.Socket;
import org.apache.felix.service.command.CommandProcessor;
import org.apache.felix.service.command.CommandSession;
-import org.easymock.EasyMock;
import org.eclipse.equinox.console.commands.DisconnectCommand;
import org.eclipse.equinox.console.common.ConsoleInputStream;
-import org.junit.Assert;
import org.junit.Test;
import org.osgi.framework.BundleContext;
@@ -21,34 +24,27 @@ public class TelnetDisconnectionTest {
private InputStream in;
@Test
- public void testTelneConnection() throws Exception {
+ public void testTelnetConnection() throws Exception {
TelnetConnection connection = null;
try (ServerSocket servSocket = new ServerSocket(0);
Socket socketClient = new Socket(HOST, servSocket.getLocalPort());
Socket socketServer = servSocket.accept();
- CommandSession session = EasyMock.createMock(CommandSession.class)) {
+ CommandSession session = mock(CommandSession.class)) {
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
+ CommandProcessor processor = mock(CommandProcessor.class);
connection = new TelnetConnection(socketServer, processor, null);
- EasyMock.makeThreadSafe(session, true);
- session.put((String) EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(3);
- EasyMock.expect(session.get("CLOSEABLE")).andReturn(connection);
- EasyMock.expect(session.execute((String) EasyMock.anyObject())).andReturn(null);
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
+ when(session.get("CLOSEABLE")).thenReturn(connection);
+ when(session.execute(any(String.class))).thenReturn(null);
- EasyMock.expect(processor.createSession((ConsoleInputStream) EasyMock.anyObject(),
- (PrintStream) EasyMock.anyObject(), (PrintStream) EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class), any(PrintStream.class)))
+ .thenReturn(session);
connection.start();
Thread.sleep(60000);
- BundleContext context = EasyMock.createMock(BundleContext.class);
+ BundleContext context = mock(BundleContext.class);
final DisconnectCommand command = new DisconnectCommand(context);
PipedOutputStream outputStream = new PipedOutputStream();
@@ -69,13 +65,11 @@ public class TelnetDisconnectionTest {
outputStream.flush();
Thread.sleep(3000);
- Assert.assertTrue("Socket is not closed!", socketServer.isClosed());
+ assertTrue("Socket is not closed!", socketServer.isClosed());
connection.telnetNegotiationFinished();
Thread.sleep(5000);
- EasyMock.verify(session, processor);
} finally {
-
System.setIn(in);
}
}
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetInputHandlerTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetInputHandlerTests.java
index a4708ee..9308073 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetInputHandlerTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetInputHandlerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,14 +14,14 @@
package org.eclipse.equinox.console.telnet;
-import static org.easymock.EasyMock.createMock;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import org.eclipse.equinox.console.common.ConsoleInputStream;
import org.eclipse.equinox.console.common.ConsoleOutputStream;
-import org.junit.Assert;
import org.junit.Test;
public class TelnetInputHandlerTests {
@@ -34,7 +34,7 @@ public class TelnetInputHandlerTests {
ConsoleInputStream in = new ConsoleInputStream();
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ConsoleOutputStream out = new ConsoleOutputStream(byteOut);
- Callback callback = createMock(Callback.class);
+ Callback callback = mock(Callback.class);
TelnetInputHandler handler = new TelnetInputHandler(input, in, out, callback);
handler.start();
@@ -46,7 +46,7 @@ public class TelnetInputHandlerTests {
}
String res = byteOut.toString();
- Assert.assertTrue("Wrong input. Expected abcde, read " + res, res.equals("abcde"));
+ assertEquals("Wrong input. Expected abcde, read " + res, "abcde", res);
}
}
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetInputScannerTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetInputScannerTests.java
index 5a5251d..bc630df 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetInputScannerTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetInputScannerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,17 @@
package org.eclipse.equinox.console.telnet;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.equinox.console.common.ConsoleInputStream;
import org.eclipse.equinox.console.common.ConsoleOutputStream;
import org.eclipse.equinox.console.common.KEYS;
@@ -23,18 +34,8 @@ import org.eclipse.equinox.console.common.terminal.TerminalTypeMappings;
import org.eclipse.equinox.console.common.terminal.VT100TerminalTypeMappings;
import org.eclipse.equinox.console.common.terminal.VT220TerminalTypeMappings;
import org.eclipse.equinox.console.common.terminal.VT320TerminalTypeMappings;
-import org.junit.Assert;
import org.junit.Test;
-import static org.easymock.EasyMock.*;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.HashMap;
-import java.util.Map;
-
public class TelnetInputScannerTests {
private static final int IAC = 255;
@@ -66,7 +67,7 @@ public class TelnetInputScannerTests {
ConsoleInputStream in = new ConsoleInputStream();
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ConsoleOutputStream out = new ConsoleOutputStream(byteOut);
- Callback callback = createMock(Callback.class);
+ Callback callback = mock(Callback.class);
TelnetInputScanner scanner = new TelnetInputScanner(in, out, callback);
try {
scanner.scan((byte) SE);
@@ -86,7 +87,7 @@ public class TelnetInputScannerTests {
}
String output = byteOut.toString();
- Assert.assertTrue("Output incorrect. Expected abc, but read " + output, output.equals("abc"));
+ assertEquals("Output incorrect. Expected abc, but read " + output, "abc", output);
}
@Test
@@ -94,7 +95,7 @@ public class TelnetInputScannerTests {
ConsoleInputStream in = new ConsoleInputStream();
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ConsoleOutputStream out = new ConsoleOutputStream(byteOut);
- Callback callback = createMock(Callback.class);
+ Callback callback = mock(Callback.class);
TelnetInputScanner scanner = new TelnetInputScanner(in, out, callback);
try {
@@ -108,7 +109,7 @@ public class TelnetInputScannerTests {
}
String output = byteOut.toString();
- Assert.assertTrue("Output incorrect. Expected ab, but read " + output, output.equals("ab"));
+ assertTrue("Output incorrect. Expected ab, but read " + output, output.equals("ab"));
}
@Test
@@ -139,28 +140,28 @@ public class TelnetInputScannerTests {
out.flush();
int read = clientIn.read();
- Assert.assertEquals("Unexpected input ", IAC, read);
+ assertEquals("Unexpected input ", IAC, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", DO, read);
+ assertEquals("Unexpected input ", DO, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", TTYPE, read);
+ assertEquals("Unexpected input ", TTYPE, read);
scanner.scan(IAC);
scanner.scan(WILL);
scanner.scan(TTYPE);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", IAC, read);
+ assertEquals("Unexpected input ", IAC, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", SB, read);
+ assertEquals("Unexpected input ", SB, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", TTYPE, read);
+ assertEquals("Unexpected input ", TTYPE, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", SEND, read);
+ assertEquals("Unexpected input ", SEND, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", IAC, read);
+ assertEquals("Unexpected input ", IAC, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", SE, read);
+ assertEquals("Unexpected input ", SE, read);
scanner.scan(IAC);
scanner.scan(SB);
@@ -175,17 +176,17 @@ public class TelnetInputScannerTests {
scanner.scan(SE);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", IAC, read);
+ assertEquals("Unexpected input ", IAC, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", SB, read);
+ assertEquals("Unexpected input ", SB, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", TTYPE, read);
+ assertEquals("Unexpected input ", TTYPE, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", SEND, read);
+ assertEquals("Unexpected input ", SEND, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", IAC, read);
+ assertEquals("Unexpected input ", IAC, read);
read = clientIn.read();
- Assert.assertEquals("Unexpected input ", SE, read);
+ assertEquals("Unexpected input ", SE, read);
scanner.scan(IAC);
scanner.scan(SB);
@@ -197,17 +198,17 @@ public class TelnetInputScannerTests {
scanner.scan(IAC);
scanner.scan(SE);
- Assert.assertEquals("Incorrect BACKSPACE: ", mappings.getBackspace(), scanner.getBackspace());
- Assert.assertEquals("Incorrect DELL: ", mappings.getDel(), scanner.getDel());
+ assertEquals("Incorrect BACKSPACE: ", mappings.getBackspace(), scanner.getBackspace());
+ assertEquals("Incorrect DELL: ", mappings.getDel(), scanner.getDel());
Map<String, KEYS> currentEscapesToKey = scanner.getCurrentEscapesToKey();
Map<String, KEYS> expectedEscapesToKey = mappings.getEscapesToKey();
for (String escape : expectedEscapesToKey.keySet()) {
KEYS key = expectedEscapesToKey.get(escape);
- Assert.assertEquals("Incorrect " + key.name(), key, currentEscapesToKey.get(escape));
+ assertEquals("Incorrect " + key.name(), key, currentEscapesToKey.get(escape));
}
- Assert.assertTrue("Callback not called ", testCallback.getState());
+ assertTrue("Callback not called ", testCallback.getState());
}
class TestCallback implements Callback {
diff --git a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetServerTests.java b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetServerTests.java
index ce471cd..9f965d7 100755
--- a/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetServerTests.java
+++ b/bundles/org.eclipse.equinox.console.tests/src/org/eclipse/equinox/console/telnet/TelnetServerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2017 SAP AG and others.
+ * Copyright (c) 2011, 2021 SAP AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,12 +14,11 @@
package org.eclipse.equinox.console.telnet;
-import org.apache.felix.service.command.CommandProcessor;
-import org.apache.felix.service.command.CommandSession;
-import org.easymock.EasyMock;
-import org.eclipse.equinox.console.common.ConsoleInputStream;
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -28,7 +27,11 @@ import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
-import static org.easymock.EasyMock.*;
+import org.apache.felix.service.command.CommandProcessor;
+import org.apache.felix.service.command.CommandSession;
+import org.eclipse.equinox.console.common.ConsoleInputStream;
+import org.junit.Test;
+
public class TelnetServerTests {
@@ -39,18 +42,12 @@ public class TelnetServerTests {
@Test
public void testTelnetServer() throws Exception {
- try (CommandSession session = EasyMock.createMock(CommandSession.class)) {
- session.put((String) EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(3);
- EasyMock.expect(session.execute((String) EasyMock.anyObject())).andReturn(new Object());
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
-
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream) EasyMock.anyObject(),
- (PrintStream) EasyMock.anyObject(), (PrintStream) EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
+ try (CommandSession session = mock(CommandSession.class)) {
+ when(session.execute(anyString())).thenReturn(new Object());
+
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class), any(PrintStream.class), any(PrintStream.class)))
+ .thenReturn(session);
List<CommandProcessor> processors = new ArrayList<>();
processors.add(processor);
@@ -69,9 +66,8 @@ public class TelnetServerTests {
} catch (InterruptedException ie) {
// do nothing
}
- verify();
} catch (ConnectException e) {
- Assert.fail("Telnet port not open");
+ fail("Telnet port not open");
} finally {
telnetServer.stopTelnetServer();
}
@@ -80,18 +76,12 @@ public class TelnetServerTests {
@Test
public void testTelnetServerWithoutHost() throws Exception {
- try (CommandSession session = EasyMock.createMock(CommandSession.class)) {
- session.put((String) EasyMock.anyObject(), EasyMock.anyObject());
- EasyMock.expectLastCall().times(4);
- EasyMock.expect(session.execute((String) EasyMock.anyObject())).andReturn(new Object());
- session.close();
- EasyMock.expectLastCall();
- EasyMock.replay(session);
-
- CommandProcessor processor = EasyMock.createMock(CommandProcessor.class);
- EasyMock.expect(processor.createSession((ConsoleInputStream) EasyMock.anyObject(),
- (PrintStream) EasyMock.anyObject(), (PrintStream) EasyMock.anyObject())).andReturn(session);
- EasyMock.replay(processor);
+ try (CommandSession session = mock(CommandSession.class)) {
+ when(session.execute(anyString())).thenReturn(new Object());
+
+ CommandProcessor processor = mock(CommandProcessor.class);
+ when(processor.createSession(any(ConsoleInputStream.class),
+ any(PrintStream.class), any(PrintStream.class))).thenReturn(session);
List<CommandProcessor> processors = new ArrayList<>();
processors.add(processor);
@@ -111,7 +101,7 @@ public class TelnetServerTests {
// do nothing
}
} catch (ConnectException e) {
- Assert.fail("Telnet port not open");
+ fail("Telnet port not open");
} finally {
telnetServer.stopTelnetServer();
}
diff --git a/bundles/org.eclipse.equinox.console/pom.xml b/bundles/org.eclipse.equinox.console/pom.xml
index cc2f873..90d4df0 100644
--- a/bundles/org.eclipse.equinox.console/pom.xml
+++ b/bundles/org.eclipse.equinox.console/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.coordinator/pom.xml b/bundles/org.eclipse.equinox.coordinator/pom.xml
index 62cbed6..cd159b9 100644
--- a/bundles/org.eclipse.equinox.coordinator/pom.xml
+++ b/bundles/org.eclipse.equinox.coordinator/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.device/pom.xml b/bundles/org.eclipse.equinox.device/pom.xml
index 22408a2..243f71e 100644
--- a/bundles/org.eclipse.equinox.device/pom.xml
+++ b/bundles/org.eclipse.equinox.device/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.ds.tests/pom.xml b/bundles/org.eclipse.equinox.ds.tests/pom.xml
index 6fa7dab..edfa768 100644
--- a/bundles/org.eclipse.equinox.ds.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.ds.tests/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.event/pom.xml b/bundles/org.eclipse.equinox.event/pom.xml
index 0f335b5..9d33058 100644
--- a/bundles/org.eclipse.equinox.event/pom.xml
+++ b/bundles/org.eclipse.equinox.event/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.http.jetty.starter/pom.xml b/bundles/org.eclipse.equinox.http.jetty.starter/pom.xml
index 89f1763..10d21ea 100644
--- a/bundles/org.eclipse.equinox.http.jetty.starter/pom.xml
+++ b/bundles/org.eclipse.equinox.http.jetty.starter/pom.xml
@@ -15,7 +15,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.http.jetty/pom.xml b/bundles/org.eclipse.equinox.http.jetty/pom.xml
index 788a63f..063cfed 100644
--- a/bundles/org.eclipse.equinox.http.jetty/pom.xml
+++ b/bundles/org.eclipse.equinox.http.jetty/pom.xml
@@ -16,7 +16,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.http.registry/pom.xml b/bundles/org.eclipse.equinox.http.registry/pom.xml
index 78a999a..1523d01 100644
--- a/bundles/org.eclipse.equinox.http.registry/pom.xml
+++ b/bundles/org.eclipse.equinox.http.registry/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/pom.xml b/bundles/org.eclipse.equinox.http.servlet.tests/pom.xml
index ae4ea78..0a345e8 100644
--- a/bundles/org.eclipse.equinox.http.servlet.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.http.servlet.tests/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.http.servlet/pom.xml b/bundles/org.eclipse.equinox.http.servlet/pom.xml
index c938833..1f4bbb9 100644
--- a/bundles/org.eclipse.equinox.http.servlet/pom.xml
+++ b/bundles/org.eclipse.equinox.http.servlet/pom.xml
@@ -15,7 +15,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/pom.xml b/bundles/org.eclipse.equinox.http.servletbridge/pom.xml
index 5593e14..6e04658 100644
--- a/bundles/org.eclipse.equinox.http.servletbridge/pom.xml
+++ b/bundles/org.eclipse.equinox.http.servletbridge/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.io/pom.xml b/bundles/org.eclipse.equinox.io/pom.xml
index 5fde523..d54d3d5 100644
--- a/bundles/org.eclipse.equinox.io/pom.xml
+++ b/bundles/org.eclipse.equinox.io/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.ip/pom.xml b/bundles/org.eclipse.equinox.ip/pom.xml
index 18dbc60..c2a6a85 100644
--- a/bundles/org.eclipse.equinox.ip/pom.xml
+++ b/bundles/org.eclipse.equinox.ip/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.jsp.jasper.registry/pom.xml b/bundles/org.eclipse.equinox.jsp.jasper.registry/pom.xml
index c8088c3..6ff680f 100644
--- a/bundles/org.eclipse.equinox.jsp.jasper.registry/pom.xml
+++ b/bundles/org.eclipse.equinox.jsp.jasper.registry/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.jsp.jasper/pom.xml b/bundles/org.eclipse.equinox.jsp.jasper/pom.xml
index e8e1be1..417b1d4 100644
--- a/bundles/org.eclipse.equinox.jsp.jasper/pom.xml
+++ b/bundles/org.eclipse.equinox.jsp.jasper/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.log.stream/pom.xml b/bundles/org.eclipse.equinox.log.stream/pom.xml
index e196bed..8ac4479 100644
--- a/bundles/org.eclipse.equinox.log.stream/pom.xml
+++ b/bundles/org.eclipse.equinox.log.stream/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.metatype/pom.xml b/bundles/org.eclipse.equinox.metatype/pom.xml
index 4672dd5..20bb547 100644
--- a/bundles/org.eclipse.equinox.metatype/pom.xml
+++ b/bundles/org.eclipse.equinox.metatype/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.preferences.tests/pom.xml b/bundles/org.eclipse.equinox.preferences.tests/pom.xml
index 8d81fb2..96c671d 100644
--- a/bundles/org.eclipse.equinox.preferences.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.preferences.tests/pom.xml
@@ -16,7 +16,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.preferences/pom.xml b/bundles/org.eclipse.equinox.preferences/pom.xml
index 70cfd57..4c81e7a 100644
--- a/bundles/org.eclipse.equinox.preferences/pom.xml
+++ b/bundles/org.eclipse.equinox.preferences/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.region.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.region.tests/META-INF/MANIFEST.MF
index ec77ab2..dbd9cfe 100644
--- a/bundles/org.eclipse.equinox.region.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.region.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Equinox Region Tests
Bundle-SymbolicName: org.eclipse.equinox.region.tests
-Bundle-Version: 1.5.100.qualifier
+Bundle-Version: 1.6.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: junit.framework;version="4.8.1",
org.aspectj.internal.lang.annotation;version="[1.6.3,2.0.0)";resolution:=optional,
@@ -11,7 +11,6 @@ Import-Package: junit.framework;version="4.8.1",
org.aspectj.lang.reflect;version="[1.6.3,2.0.0)";resolution:=optional,
org.aspectj.runtime.internal;version="[1.6.3,2.0.0)";resolution:=optional,
org.aspectj.runtime.reflect;version="[1.6.3,2.0.0)";resolution:=optional,
- org.easymock;version="2.4.0",
org.eclipse.core.tests.harness;resolution:=optional,
org.eclipse.equinox.region;version="1.1.0",
org.eclipse.osgi.service.urlconversion;version="1.0.0",
@@ -19,6 +18,8 @@ Import-Package: junit.framework;version="4.8.1",
org.junit.rules;version="4.12.0",
org.junit.runner;version="4.12.0",
org.junit.runners;version="4.12.0",
+ org.mockito,
+ org.mockito.stubbing,
org.osgi.framework;version="1.8.0",
org.osgi.framework.hooks.bundle;version="1.1.0",
org.osgi.framework.hooks.resolver;version="1.0.0",
diff --git a/bundles/org.eclipse.equinox.region.tests/pom.xml b/bundles/org.eclipse.equinox.region.tests/pom.xml
index 5c671f6..fa6db56 100644
--- a/bundles/org.eclipse.equinox.region.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.region.tests/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.region.tests</artifactId>
- <version>1.5.100-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.region.tests/regionTestTarget.target b/bundles/org.eclipse.equinox.region.tests/regionTestTarget.target
deleted file mode 100644
index c71fd9b..0000000
--- a/bundles/org.eclipse.equinox.region.tests/regionTestTarget.target
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.6"?>
-
-<target name="Region Test Target" sequenceNumber="6">
-<locations>
-<location path="${eclipse_home}" type="Profile"/>
-<location includeAllPlatforms="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
-<unit id="org.easymock" version="2.4.0.v20090202-0900"/>
-<unit id="org.easymock.source" version="2.4.0.v20090202-0900"/>
-<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20100519200754/repository/"/>
-</location>
-<location includeAllPlatforms="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
-<unit id="org.aspectj.feature.group" version="1.6.7.20091231194938"/>
-<repository location="http://download.eclipse.org/tools/ajdt/aspectj/update"/>
-</location>
-</locations>
-<environment>
-<os>macosx</os>
-<ws>cocoa</ws>
-<arch>x86_64</arch>
-<nl>en_US</nl>
-</environment>
-<launcherArgs>
-<vmArgs>-Declipse.p2.mirrors=false -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Xms40m -Xmx384m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgs>
-</launcherArgs>
-</target>
diff --git a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/BundleIdBasedRegionTests.java b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/BundleIdBasedRegionTests.java
index 842629d..92b7059 100644
--- a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/BundleIdBasedRegionTests.java
+++ b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/BundleIdBasedRegionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2020 VMware Inc.
+ * Copyright (c) 2011, 2021 VMware Inc. and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,15 +16,20 @@ package org.eclipse.equinox.region.internal.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.util.HashSet;
import java.util.Iterator;
-import org.easymock.EasyMock;
import org.eclipse.equinox.region.*;
import org.eclipse.equinox.region.RegionDigraph.FilteredRegion;
-import org.junit.*;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.framework.*;
public class BundleIdBasedRegionTests {
@@ -66,18 +71,18 @@ public class BundleIdBasedRegionTests {
@Before
public void setUp() throws Exception {
this.threadLocal = new ThreadLocal<Region>();
- this.mockBundle = EasyMock.createMock(Bundle.class);
- EasyMock.expect(this.mockBundle.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME).anyTimes();
- EasyMock.expect(this.mockBundle.getVersion()).andReturn(BUNDLE_VERSION).anyTimes();
- EasyMock.expect(this.mockBundle.getBundleId()).andReturn(BUNDLE_ID).anyTimes();
+ this.mockBundle = mock(Bundle.class);
+ when(this.mockBundle.getSymbolicName()).thenReturn(BUNDLE_SYMBOLIC_NAME);
+ when(this.mockBundle.getVersion()).thenReturn(BUNDLE_VERSION);
+ when(this.mockBundle.getBundleId()).thenReturn(BUNDLE_ID);
- this.mockBundleContext = EasyMock.createMock(BundleContext.class);
- EasyMock.expect(this.mockBundleContext.getBundle(BUNDLE_ID)).andReturn(this.mockBundle).anyTimes();
+ this.mockBundleContext = mock(BundleContext.class);
+ when(this.mockBundleContext.getBundle(BUNDLE_ID)).thenReturn(this.mockBundle);
- this.mockRegion = EasyMock.createMock(Region.class);
- this.mockRegion2 = EasyMock.createMock(Region.class);
+ this.mockRegion = mock(Region.class);
+ this.mockRegion2 = mock(Region.class);
- this.mockRegionFilter = EasyMock.createMock(RegionFilter.class);
+ this.mockRegionFilter = mock(RegionFilter.class);
this.regionIterator = new Iterator<Region>() {
@@ -96,21 +101,11 @@ public class BundleIdBasedRegionTests {
// nothing
}
};
- this.mockGraph = EasyMock.createMock(RegionDigraph.class);
- this.mockGraph.connect(EasyMock.isA(Region.class), EasyMock.eq(this.mockRegionFilter), EasyMock.eq(this.mockRegion));
- EasyMock.expectLastCall().anyTimes();
+ this.mockGraph = mock(RegionDigraph.class);
+ this.mockGraph.connect(isA(Region.class), eq(this.mockRegionFilter), eq(this.mockRegion));
this.bundleIdToRegionMapping = RegionReflectionUtils.newStandardBundleIdToRegionMapping();
}
- private void replayMocks() {
- EasyMock.replay(this.mockBundleContext, this.mockBundle, this.mockRegion, this.mockRegion2, this.mockRegionFilter, this.mockGraph);
- }
-
- @After
- public void tearDown() throws Exception {
- EasyMock.verify(this.mockBundleContext, this.mockBundle, this.mockRegion, this.mockRegion2, this.mockRegionFilter, this.mockGraph);
- }
-
@Test
public void testGetName() {
defaultSetUp();
@@ -124,18 +119,18 @@ public class BundleIdBasedRegionTests {
}
private Region createBundleIdBasedRegion(String regionName) {
- return RegionReflectionUtils.newBundleIdBasedRegion(regionName, this.mockGraph, this.bundleIdToRegionMapping, this.mockBundleContext, this.threadLocal);
+ return RegionReflectionUtils.newBundleIdBasedRegion(regionName, this.mockGraph, this.bundleIdToRegionMapping,
+ this.mockBundleContext, this.threadLocal);
}
private void defaultSetUp() {
- EasyMock.expect(this.mockGraph.iterator()).andReturn(this.regionIterator).anyTimes();
- EasyMock.expect(this.mockGraph.getEdges(EasyMock.isA(Region.class))).andReturn(new HashSet<FilteredRegion>()).anyTimes();
- replayMocks();
+ when(this.mockGraph.iterator()).thenReturn(this.regionIterator);
+ when(this.mockGraph.getEdges(isA(Region.class))).thenReturn(new HashSet<>());
}
@Test
public void testAddBundle() throws BundleException {
- EasyMock.expect(this.mockGraph.iterator()).andReturn(this.regionIterator).anyTimes();
+ when(this.mockGraph.iterator()).thenReturn(this.regionIterator);
HashSet<FilteredRegion> edges = new HashSet<FilteredRegion>();
edges.add(new FilteredRegion() {
@@ -151,8 +146,7 @@ public class BundleIdBasedRegionTests {
return mockRegionFilter;
}
});
- EasyMock.expect(this.mockGraph.getEdges(EasyMock.isA(Region.class))).andReturn(edges).anyTimes();
- replayMocks();
+ when(this.mockGraph.getEdges(isA(Region.class))).thenReturn(edges);
Region r = createDefaultBundleIdBasedRegion();
r.addBundle(this.mockBundle);
@@ -171,11 +165,10 @@ public class BundleIdBasedRegionTests {
public void testAddConflictingBundle() throws BundleException {
defaultSetUp();
- Bundle mockBundle2 = EasyMock.createMock(Bundle.class);
- EasyMock.expect(mockBundle2.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME).anyTimes();
- EasyMock.expect(mockBundle2.getVersion()).andReturn(BUNDLE_VERSION).anyTimes();
- EasyMock.expect(mockBundle2.getBundleId()).andReturn(BUNDLE_ID_2).anyTimes();
- EasyMock.replay(mockBundle2);
+ Bundle mockBundle2 = mock(Bundle.class);
+ when(mockBundle2.getSymbolicName()).thenReturn(BUNDLE_SYMBOLIC_NAME);
+ when(mockBundle2.getVersion()).thenReturn(BUNDLE_VERSION);
+ when(mockBundle2.getBundleId()).thenReturn(BUNDLE_ID_2);
Region r = createDefaultBundleIdBasedRegion();
r.addBundle(this.mockBundle);
@@ -207,10 +200,10 @@ public class BundleIdBasedRegionTests {
@Override
public Region next() {
switch (next--) {
- case 2 :
- return mockRegion;
- default :
- return mockRegion2;
+ case 2:
+ return mockRegion;
+ default:
+ return mockRegion2;
}
}
@@ -219,32 +212,16 @@ public class BundleIdBasedRegionTests {
// nothing
}
};
- EasyMock.expect(this.mockGraph.iterator()).andReturn(this.regionIterator).anyTimes();
- EasyMock.expect(this.mockGraph.getEdges(EasyMock.isA(Region.class))).andReturn(new HashSet<FilteredRegion>()).anyTimes();
- EasyMock.expect(this.mockRegion.contains(EasyMock.eq(BUNDLE_ID))).andReturn(true).anyTimes();
- EasyMock.expect(this.mockRegion2.contains(EasyMock.eq(BUNDLE_ID))).andReturn(false).anyTimes();
+ when(this.mockGraph.iterator()).thenReturn(this.regionIterator);
+ when(this.mockGraph.getEdges(isA(Region.class))).thenReturn(new HashSet<>());
+ when(this.mockRegion.contains(eq(BUNDLE_ID))).thenReturn(true);
+ when(this.mockRegion2.contains(eq(BUNDLE_ID))).thenReturn(false);
RegionReflectionUtils.associateBundleWithRegion(this.bundleIdToRegionMapping, BUNDLE_ID, mockRegion);
- replayMocks();
-
Region r = createDefaultBundleIdBasedRegion();
return r;
}
- @Test
- public void testInstallBundleStringInputStream() {
- defaultSetUp();
-
- // TODO
- }
-
- @Test
- public void testInstallBundleString() {
- defaultSetUp();
-
- // TODO
- }
-
@Test
public void testContains() throws BundleException {
defaultSetUp();
@@ -306,7 +283,7 @@ public class BundleIdBasedRegionTests {
Region r = createDefaultBundleIdBasedRegion();
Region s = createBundleIdBasedRegion(OTHER_REGION_NAME);
assertFalse(r.equals(s));
- assertFalse(r.equals(null));
+ assertNotNull(r);
}
@Test
diff --git a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardBundleIdToRegionMappingTests.java b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardBundleIdToRegionMappingTests.java
index 0b392ed..f503f59 100644
--- a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardBundleIdToRegionMappingTests.java
+++ b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardBundleIdToRegionMappingTests.java
@@ -18,8 +18,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
-import org.easymock.EasyMock;
import org.eclipse.equinox.region.Region;
import org.junit.Before;
import org.junit.Test;
@@ -38,7 +38,7 @@ public class StandardBundleIdToRegionMappingTests {
@Before
public void setUp() throws Exception {
this.bundleIdToRegionMapping = RegionReflectionUtils.newStandardBundleIdToRegionMapping();
- this.mockRegion = EasyMock.createMock(Region.class);
+ this.mockRegion = mock(Region.class);
}
@Test
@@ -57,7 +57,8 @@ public class StandardBundleIdToRegionMappingTests {
@Test(expected = BundleException.class)
public void testAssociateBundleAlreadyAssociatedWithOtherRegion() {
RegionReflectionUtils.associateBundleWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID, mockRegion);
- RegionReflectionUtils.associateBundleWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID, EasyMock.createMock(Region.class));
+ RegionReflectionUtils.associateBundleWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID,
+ mock(Region.class));
}
@Test
@@ -69,9 +70,11 @@ public class StandardBundleIdToRegionMappingTests {
@Test
public void testIsBundleAssociatedWithRegion() {
- assertFalse(RegionReflectionUtils.isBundleAssociatedWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID, mockRegion));
+ assertFalse(RegionReflectionUtils.isBundleAssociatedWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID,
+ mockRegion));
RegionReflectionUtils.associateBundleWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID, mockRegion);
- assertFalse(RegionReflectionUtils.isBundleAssociatedWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID, mockRegion));
+ assertFalse(RegionReflectionUtils.isBundleAssociatedWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID,
+ mockRegion));
}
@Test
@@ -80,8 +83,10 @@ public class StandardBundleIdToRegionMappingTests {
RegionReflectionUtils.associateBundleWithRegion(this.bundleIdToRegionMapping, TEST_BUNDLE_ID, mockRegion);
RegionReflectionUtils.associateBundleWithRegion(this.bundleIdToRegionMapping, OTHER_TEST_BUNDLE_ID, mockRegion);
assertEquals(2, RegionReflectionUtils.getBundleIds(this.bundleIdToRegionMapping, mockRegion).size());
- assertTrue(RegionReflectionUtils.getBundleIds(this.bundleIdToRegionMapping, mockRegion).contains(TEST_BUNDLE_ID));
- assertTrue(RegionReflectionUtils.getBundleIds(this.bundleIdToRegionMapping, mockRegion).contains(OTHER_TEST_BUNDLE_ID));
+ assertTrue(
+ RegionReflectionUtils.getBundleIds(this.bundleIdToRegionMapping, mockRegion).contains(TEST_BUNDLE_ID));
+ assertTrue(RegionReflectionUtils.getBundleIds(this.bundleIdToRegionMapping, mockRegion)
+ .contains(OTHER_TEST_BUNDLE_ID));
}
@Test
diff --git a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardRegionDigraphTests.java b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardRegionDigraphTests.java
index 29abe13..8844540 100644
--- a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardRegionDigraphTests.java
+++ b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardRegionDigraphTests.java
@@ -19,14 +19,16 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.util.*;
-import org.easymock.EasyMock;
import org.eclipse.equinox.region.*;
import org.eclipse.equinox.region.RegionDigraph.FilteredRegion;
import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-import org.junit.*;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.framework.*;
public class StandardRegionDigraphTests {
@@ -43,8 +45,6 @@ public class StandardRegionDigraphTests {
private RegionFilter regionFilter2;
- private Bundle mockBundle;
-
@Before
public void setUp() throws Exception {
StubBundle stubSystemBundle = new StubBundle(0L, "osgi.framework", new Version("0"), "loc");
@@ -52,19 +52,18 @@ public class StandardRegionDigraphTests {
stubBundleContext.addInstalledBundle(stubSystemBundle);
this.digraph = RegionReflectionUtils.newStandardRegionDigraph(stubBundleContext, new ThreadLocal<Region>());
- this.mockRegion1 = EasyMock.createMock(Region.class);
- EasyMock.expect(this.mockRegion1.getName()).andReturn("mockRegion1").anyTimes();
- EasyMock.expect(this.mockRegion1.getRegionDigraph()).andReturn(this.digraph).anyTimes();
+ this.mockRegion1 = mock(Region.class);
+ when(this.mockRegion1.getName()).thenReturn("mockRegion1");
+ when(this.mockRegion1.getRegionDigraph()).thenReturn(this.digraph);
- this.mockRegion2 = EasyMock.createMock(Region.class);
- EasyMock.expect(this.mockRegion2.getName()).andReturn("mockRegion2").anyTimes();
- EasyMock.expect(this.mockRegion2.getRegionDigraph()).andReturn(this.digraph).anyTimes();
+ this.mockRegion2 = mock(Region.class);
+ when(this.mockRegion2.getName()).thenReturn("mockRegion2");
+ when(this.mockRegion2.getRegionDigraph()).thenReturn(this.digraph);
- this.mockRegion3 = EasyMock.createMock(Region.class);
- EasyMock.expect(this.mockRegion3.getName()).andReturn("mockRegion3").anyTimes();
- EasyMock.expect(this.mockRegion3.getRegionDigraph()).andReturn(this.digraph).anyTimes();
+ this.mockRegion3 = mock(Region.class);
+ when(this.mockRegion3.getName()).thenReturn("mockRegion3");
+ when(this.mockRegion3.getRegionDigraph()).thenReturn(this.digraph);
- this.mockBundle = EasyMock.createMock(Bundle.class);
}
private void setDefaultFilters() {
@@ -72,28 +71,23 @@ public class StandardRegionDigraphTests {
this.regionFilter2 = digraph.createRegionFilterBuilder().build();
}
- private void setAllowedFilters(String b1Name, Version b1Version, String b2Name, Version b2Version) throws InvalidSyntaxException {
- String filter1 = "(&(" + RegionFilter.VISIBLE_BUNDLE_NAMESPACE + "=" + b1Name + ")(" + Constants.BUNDLE_VERSION_ATTRIBUTE + "=" + b1Version + "))";
- regionFilter1 = digraph.createRegionFilterBuilder().allow(RegionFilter.VISIBLE_BUNDLE_NAMESPACE, filter1).build();
-
- String filter2 = "(&(" + RegionFilter.VISIBLE_BUNDLE_NAMESPACE + "=" + b2Name + ")(" + Constants.BUNDLE_VERSION_ATTRIBUTE + "=" + b2Version + "))";
- regionFilter2 = digraph.createRegionFilterBuilder().allow(RegionFilter.VISIBLE_BUNDLE_NAMESPACE, filter2).build();
-
- }
+ private void setAllowedFilters(String b1Name, Version b1Version, String b2Name, Version b2Version)
+ throws InvalidSyntaxException {
+ String filter1 = "(&(" + RegionFilter.VISIBLE_BUNDLE_NAMESPACE + "=" + b1Name + ")("
+ + Constants.BUNDLE_VERSION_ATTRIBUTE + "=" + b1Version + "))";
+ regionFilter1 = digraph.createRegionFilterBuilder().allow(RegionFilter.VISIBLE_BUNDLE_NAMESPACE, filter1)
+ .build();
- private void replayMocks() {
- EasyMock.replay(this.mockRegion1, this.mockRegion2, this.mockRegion3, this.mockBundle);
- }
+ String filter2 = "(&(" + RegionFilter.VISIBLE_BUNDLE_NAMESPACE + "=" + b2Name + ")("
+ + Constants.BUNDLE_VERSION_ATTRIBUTE + "=" + b2Version + "))";
+ regionFilter2 = digraph.createRegionFilterBuilder().allow(RegionFilter.VISIBLE_BUNDLE_NAMESPACE, filter2)
+ .build();
- @After
- public void tearDown() throws Exception {
- EasyMock.verify(this.mockRegion1, this.mockRegion2, this.mockRegion3, this.mockBundle);
}
@Test
public void testConnect() throws BundleException {
setDefaultFilters();
- replayMocks();
this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
}
@@ -105,10 +99,8 @@ public class StandardRegionDigraphTests {
String b2Name = "b2";
Version b2Version = new Version("0");
setAllowedFilters(b1Name, b1Version, b2Name, b2Version);
- EasyMock.expect(this.mockRegion1.getBundle(b1Name, b1Version)).andReturn(null).anyTimes();
- EasyMock.expect(this.mockRegion1.getBundle(b2Name, b2Version)).andReturn(null).anyTimes();
-
- replayMocks();
+ when(this.mockRegion1.getBundle(b1Name, b1Version)).thenReturn(null);
+ when(this.mockRegion1.getBundle(b2Name, b2Version)).thenReturn(null);
this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
this.digraph.connect(this.mockRegion1, this.regionFilter2, this.mockRegion3);
@@ -117,7 +109,6 @@ public class StandardRegionDigraphTests {
@Test(expected = BundleException.class)
public void testConnectLoop() throws BundleException {
setDefaultFilters();
- replayMocks();
this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion1);
}
@@ -125,7 +116,6 @@ public class StandardRegionDigraphTests {
@Test(expected = BundleException.class)
public void testDuplicateConnection() throws BundleException {
setDefaultFilters();
- replayMocks();
this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
this.digraph.connect(this.mockRegion1, this.regionFilter2, this.mockRegion2);
@@ -134,7 +124,6 @@ public class StandardRegionDigraphTests {
@Test
public void testReplaceConnection() throws BundleException {
setDefaultFilters();
- replayMocks();
RegionFilter existing;
@@ -154,7 +143,6 @@ public class StandardRegionDigraphTests {
@Test
public void testGetEdges() throws BundleException {
setDefaultFilters();
- replayMocks();
this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
this.digraph.connect(this.mockRegion1, this.regionFilter2, this.mockRegion3);
@@ -193,7 +181,6 @@ public class StandardRegionDigraphTests {
@Test
public void testRemoveRegion() throws BundleException {
setDefaultFilters();
- replayMocks();
this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
this.digraph.connect(this.mockRegion2, this.regionFilter2, this.mockRegion1);
@@ -207,7 +194,6 @@ public class StandardRegionDigraphTests {
@Test
public void testGetRegions() throws BundleException {
setDefaultFilters();
- replayMocks();
this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
Set<Region> regions = this.digraph.getRegions();
@@ -223,7 +209,6 @@ public class StandardRegionDigraphTests {
@Test
public void testCopyRegion() throws BundleException, InvalidSyntaxException {
- replayMocks(); // needed to allow teardown to succeed.
RegionDigraph testDigraph = RegionReflectionUtils.newStandardRegionDigraph();
long bundleId = 1;
Region a = testDigraph.createRegion(REGION_A);
@@ -269,7 +254,8 @@ public class StandardRegionDigraphTests {
testDigraph.replace(testCopy);
StandardRegionDigraphPeristenceTests.assertEquals(testDigraph, testCopy);
- // test that we can continue to use the copy to replace as long as it is upto date with the last replace
+ // test that we can continue to use the copy to replace as long as it is upto
+ // date with the last replace
Region testAdd1 = testCopy.createRegion("testAdd1");
testCopy.connect(testAdd1, testCopy.createRegionFilterBuilder().allow("testAdd1", "(testAdd=x)").build(), a);
try {
@@ -307,7 +293,8 @@ public class StandardRegionDigraphTests {
testCopy = testDigraph.copy();
// add a new region to the original
Region testAdd2 = testDigraph.createRegion("testAdd2");
- testDigraph.connect(testAdd2, testCopy.createRegionFilterBuilder().allow("testAdd2", "(testAdd=x)").build(), origA);
+ testDigraph.connect(testAdd2, testCopy.createRegionFilterBuilder().allow("testAdd2", "(testAdd=x)").build(),
+ origA);
try {
testDigraph.replace(testCopy);
fail("Digraph changed since copy.");
@@ -318,7 +305,8 @@ public class StandardRegionDigraphTests {
testCopy = testDigraph.copy();
// change a connection in the original
testDigraph.removeRegion(testAdd2);
- testDigraph.connect(testAdd2, testCopy.createRegionFilterBuilder().allow("testAdd2", "(testAdd=y)").build(), origA);
+ testDigraph.connect(testAdd2, testCopy.createRegionFilterBuilder().allow("testAdd2", "(testAdd=y)").build(),
+ origA);
try {
testDigraph.replace(testCopy);
fail("Digraph changed since copy.");
@@ -329,7 +317,8 @@ public class StandardRegionDigraphTests {
testCopy = testDigraph.copy();
Region origB = testDigraph.getRegion(REGION_B);
// add a connection in the original
- testDigraph.connect(testAdd2, testCopy.createRegionFilterBuilder().allow("testAdd2", "(testAdd=y)").build(), origB);
+ testDigraph.connect(testAdd2, testCopy.createRegionFilterBuilder().allow("testAdd2", "(testAdd=y)").build(),
+ origB);
try {
testDigraph.replace(testCopy);
fail("Digraph changed since copy.");
@@ -374,15 +363,16 @@ public class StandardRegionDigraphTests {
@Test
public void testVisitRegions() throws BundleException, InvalidSyntaxException {
- replayMocks(); // needed to allow teardown to succeed.
RegionDigraph testDigraph = RegionReflectionUtils.newStandardRegionDigraph();
Region a = testDigraph.createRegion(REGION_A);
Region b = testDigraph.createRegion(REGION_B);
Region c = testDigraph.createRegion(REGION_C);
Region d = testDigraph.createRegion(REGION_D);
- testDigraph.connect(a, testDigraph.createRegionFilterBuilder().allow("b", "(b=x)").allow("c", "(c=x)").allow("d", "(d=x)").build(), b);
- testDigraph.connect(b, testDigraph.createRegionFilterBuilder().allow("c", "(c=x)").allow("d", "(d=x)").build(), c);
+ testDigraph.connect(a, testDigraph.createRegionFilterBuilder().allow("b", "(b=x)").allow("c", "(c=x)")
+ .allow("d", "(d=x)").build(), b);
+ testDigraph.connect(b, testDigraph.createRegionFilterBuilder().allow("c", "(c=x)").allow("d", "(d=x)").build(),
+ c);
testDigraph.connect(c, testDigraph.createRegionFilterBuilder().allow("d", "(d=x)").build(), d);
Map<String, String> attributes = new HashMap<String, String>();
@@ -426,7 +416,6 @@ public class StandardRegionDigraphTests {
@Test
public void testGetHooks() throws BundleException {
setDefaultFilters();
- replayMocks();
assertNotNull("Resolver Hook is null", digraph.getResolverHookFactory());
assertNotNull("Bundle Event Hook is null", digraph.getBundleEventHook());
diff --git a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardRegionFilterTests.java b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardRegionFilterTests.java
index f92a5cf..e5887fd 100644
--- a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardRegionFilterTests.java
+++ b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/StandardRegionFilterTests.java
@@ -18,9 +18,10 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.util.*;
-import org.easymock.EasyMock;
import org.eclipse.equinox.region.RegionFilter;
import org.eclipse.equinox.region.RegionFilterBuilder;
import org.eclipse.virgo.teststubs.osgi.framework.*;
@@ -55,44 +56,44 @@ public class StandardRegionFilterTests {
@Before
public void setUp() throws Exception {
this.stubBundle = new StubBundle(BUNDLE_SYMBOLIC_NAME, BUNDLE_VERSION);
- this.fooService = new StubServiceRegistration<Object>(new StubBundleContext(), "foo.Service");
- this.barService = new StubServiceRegistration<Object>(new StubBundleContext(), "bar.Service");
+ this.fooService = new StubServiceRegistration<>(new StubBundleContext(), "foo.Service");
+ this.barService = new StubServiceRegistration<>(new StubBundleContext(), "bar.Service");
- this.fooPackage = EasyMock.createMock(BundleCapability.class);
- Map<String, Object> fooAttrs = new HashMap<String, Object>();
+ this.fooPackage = mock(BundleCapability.class);
+ Map<String, Object> fooAttrs = new HashMap<>();
fooAttrs.put(BundleRevision.PACKAGE_NAMESPACE, "foo");
- EasyMock.expect(fooPackage.getNamespace()).andReturn(BundleRevision.PACKAGE_NAMESPACE).anyTimes();
- EasyMock.expect(fooPackage.getAttributes()).andReturn(fooAttrs).anyTimes();
- EasyMock.replay(fooPackage);
+ when(fooPackage.getNamespace()).thenReturn(BundleRevision.PACKAGE_NAMESPACE);
+ when(fooPackage.getAttributes()).thenReturn(fooAttrs);
- this.fooServiceCapability = EasyMock.createMock(BundleCapability.class);
- Map<String, Object> fooServiceAttrs = new HashMap<String, Object>();
+ this.fooServiceCapability = mock(BundleCapability.class);
+ Map<String, Object> fooServiceAttrs = new HashMap<>();
fooServiceAttrs.put(Constants.OBJECTCLASS, "foo.Service");
- EasyMock.expect(fooServiceCapability.getNamespace()).andReturn(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE).anyTimes();
- EasyMock.expect(fooServiceCapability.getAttributes()).andReturn(fooServiceAttrs).anyTimes();
- EasyMock.replay(fooServiceCapability);
+ when(fooServiceCapability.getNamespace()).thenReturn(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE);
+ when(fooServiceCapability.getAttributes()).thenReturn(fooServiceAttrs);
- this.barPackage = EasyMock.createMock(BundleCapability.class);
- Map<String, Object> barAttrs = new HashMap<String, Object>();
+ this.barPackage = mock(BundleCapability.class);
+ Map<String, Object> barAttrs = new HashMap<>();
barAttrs.put(BundleRevision.PACKAGE_NAMESPACE, "bar");
- EasyMock.expect(barPackage.getNamespace()).andReturn(BundleRevision.PACKAGE_NAMESPACE).anyTimes();
- EasyMock.expect(barPackage.getAttributes()).andReturn(barAttrs).anyTimes();
- EasyMock.replay(barPackage);
+ when(barPackage.getNamespace()).thenReturn(BundleRevision.PACKAGE_NAMESPACE);
+ when(barPackage.getAttributes()).thenReturn(barAttrs);
- this.barServiceCapability = EasyMock.createMock(BundleCapability.class);
- Map<String, Object> barServiceAttrs = new HashMap<String, Object>();
+ this.barServiceCapability = mock(BundleCapability.class);
+ Map<String, Object> barServiceAttrs = new HashMap<>();
barServiceAttrs.put(Constants.OBJECTCLASS, "bar.Service");
- EasyMock.expect(barServiceCapability.getNamespace()).andReturn(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE).anyTimes();
- EasyMock.expect(barServiceCapability.getAttributes()).andReturn(barServiceAttrs).anyTimes();
- EasyMock.replay(barServiceCapability);
+ when(barServiceCapability.getNamespace()).thenReturn(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE);
+ when(barServiceCapability.getAttributes()).thenReturn(barServiceAttrs);
}
- private RegionFilter createBundleFilter(String bundleSymbolicName, Version bundleVersion) throws InvalidSyntaxException {
- String filter = "(&(" + RegionFilter.VISIBLE_BUNDLE_NAMESPACE + "=" + bundleSymbolicName + ")(" + Constants.BUNDLE_VERSION_ATTRIBUTE + ">=" + bundleVersion + "))";
- return RegionReflectionUtils.newStandardRegionFilterBuilder().allow(RegionFilter.VISIBLE_BUNDLE_NAMESPACE, filter).build();
+ private RegionFilter createBundleFilter(String bundleSymbolicName, Version bundleVersion)
+ throws InvalidSyntaxException {
+ String filter = "(&(" + RegionFilter.VISIBLE_BUNDLE_NAMESPACE + "=" + bundleSymbolicName + ")("
+ + Constants.BUNDLE_VERSION_ATTRIBUTE + ">=" + bundleVersion + "))";
+ return RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allow(RegionFilter.VISIBLE_BUNDLE_NAMESPACE, filter).build();
}
- private RegionFilter createRegionFilter(String namespace, Collection<String> filters) throws InvalidSyntaxException {
+ private RegionFilter createRegionFilter(String namespace, Collection<String> filters)
+ throws InvalidSyntaxException {
RegionFilterBuilder builder = RegionReflectionUtils.newStandardRegionFilterBuilder();
for (String filter : filters) {
builder.allow(namespace, filter);
@@ -114,7 +115,8 @@ public class StandardRegionFilterTests {
@Test
public void testBundleAllAllowed() {
- RegionFilter regionFilter = RegionReflectionUtils.newStandardRegionFilterBuilder().allowAll(RegionFilter.VISIBLE_BUNDLE_NAMESPACE).build();
+ RegionFilter regionFilter = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allowAll(RegionFilter.VISIBLE_BUNDLE_NAMESPACE).build();
assertTrue(regionFilter.isAllowed(stubBundle));
}
@@ -126,9 +128,11 @@ public class StandardRegionFilterTests {
@Test
public void testCapabilityAllowed() throws InvalidSyntaxException {
- RegionFilter regionFilter = createRegionFilter(RegionFilter.VISIBLE_PACKAGE_NAMESPACE, Arrays.asList(packageImportPolicy));
+ RegionFilter regionFilter = createRegionFilter(RegionFilter.VISIBLE_PACKAGE_NAMESPACE,
+ Arrays.asList(packageImportPolicy));
assertTrue(regionFilter.isAllowed(fooPackage));
- assertEquals(Arrays.asList(this.packageImportPolicy), regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_PACKAGE_NAMESPACE));
+ assertEquals(Arrays.asList(this.packageImportPolicy),
+ regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_PACKAGE_NAMESPACE));
}
@Test
@@ -139,30 +143,37 @@ public class StandardRegionFilterTests {
@Test
public void testCapabilityAllAllowed() {
- RegionFilter regionFilter = RegionReflectionUtils.newStandardRegionFilterBuilder().allowAll(RegionFilter.VISIBLE_PACKAGE_NAMESPACE).build();
+ RegionFilter regionFilter = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allowAll(RegionFilter.VISIBLE_PACKAGE_NAMESPACE).build();
assertTrue(regionFilter.isAllowed(barPackage));
}
@Test
public void testCapabilityNotAllowed() throws InvalidSyntaxException {
- RegionFilter regionFilter = createRegionFilter(RegionFilter.VISIBLE_PACKAGE_NAMESPACE, Arrays.asList(packageImportPolicy));
+ RegionFilter regionFilter = createRegionFilter(RegionFilter.VISIBLE_PACKAGE_NAMESPACE,
+ Arrays.asList(packageImportPolicy));
assertFalse(regionFilter.isAllowed(barPackage));
- assertEquals(Arrays.asList(this.packageImportPolicy), regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_PACKAGE_NAMESPACE));
+ assertEquals(Arrays.asList(this.packageImportPolicy),
+ regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_PACKAGE_NAMESPACE));
}
@SuppressWarnings("deprecation")
@Test
public void testServiceAllowed() throws InvalidSyntaxException {
- RegionFilter regionFilter = createRegionFilter(RegionFilter.VISIBLE_SERVICE_NAMESPACE, Arrays.asList(serviceImportPolicy));
+ RegionFilter regionFilter = createRegionFilter(RegionFilter.VISIBLE_SERVICE_NAMESPACE,
+ Arrays.asList(serviceImportPolicy));
assertTrue(regionFilter.isAllowed(fooService.getReference()));
assertTrue(regionFilter.isAllowed(fooServiceCapability));
- assertEquals(Arrays.asList(serviceImportPolicy), regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_SERVICE_NAMESPACE));
+ assertEquals(Arrays.asList(serviceImportPolicy),
+ regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_SERVICE_NAMESPACE));
- regionFilter = createRegionFilter(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE, Arrays.asList(serviceImportPolicy));
+ regionFilter = createRegionFilter(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE,
+ Arrays.asList(serviceImportPolicy));
assertTrue(regionFilter.isAllowed(fooService.getReference()));
assertTrue(regionFilter.isAllowed(fooServiceCapability));
assertNull(regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_SERVICE_NAMESPACE));
- assertEquals(Arrays.asList(serviceImportPolicy), regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE));
+ assertEquals(Arrays.asList(serviceImportPolicy),
+ regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE));
}
@Test
@@ -175,11 +186,13 @@ public class StandardRegionFilterTests {
@Test
public void testServiceAllAllowed() {
@SuppressWarnings("deprecation")
- RegionFilter regionFilter = RegionReflectionUtils.newStandardRegionFilterBuilder().allowAll(RegionFilter.VISIBLE_SERVICE_NAMESPACE).build();
+ RegionFilter regionFilter = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allowAll(RegionFilter.VISIBLE_SERVICE_NAMESPACE).build();
assertTrue(regionFilter.isAllowed(fooService.getReference()));
assertTrue(regionFilter.isAllowed(fooServiceCapability));
- regionFilter = RegionReflectionUtils.newStandardRegionFilterBuilder().allowAll(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE).build();
+ regionFilter = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allowAll(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE).build();
assertTrue(regionFilter.isAllowed(fooService.getReference()));
assertTrue(regionFilter.isAllowed(fooServiceCapability));
}
@@ -187,23 +200,31 @@ public class StandardRegionFilterTests {
@SuppressWarnings("deprecation")
@Test
public void testServiceNotAllowed() throws InvalidSyntaxException {
- RegionFilter regionFilter = createRegionFilter(RegionFilter.VISIBLE_SERVICE_NAMESPACE, Arrays.asList(serviceImportPolicy));
+ RegionFilter regionFilter = createRegionFilter(RegionFilter.VISIBLE_SERVICE_NAMESPACE,
+ Arrays.asList(serviceImportPolicy));
assertFalse(regionFilter.isAllowed(barService.getReference()));
assertFalse(regionFilter.isAllowed(barServiceCapability));
- assertEquals(Arrays.asList(serviceImportPolicy), regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_SERVICE_NAMESPACE));
- assertEquals(Arrays.asList(serviceImportPolicy), regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE));
+ assertEquals(Arrays.asList(serviceImportPolicy),
+ regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_SERVICE_NAMESPACE));
+ assertEquals(Arrays.asList(serviceImportPolicy),
+ regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE));
- regionFilter = createRegionFilter(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE, Arrays.asList(serviceImportPolicy));
+ regionFilter = createRegionFilter(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE,
+ Arrays.asList(serviceImportPolicy));
assertFalse(regionFilter.isAllowed(barService.getReference()));
assertFalse(regionFilter.isAllowed(barServiceCapability));
assertNull(regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_SERVICE_NAMESPACE));
- assertEquals(Arrays.asList(serviceImportPolicy), regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE));
+ assertEquals(Arrays.asList(serviceImportPolicy),
+ regionFilter.getSharingPolicy().get(RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE));
}
@SuppressWarnings("deprecation")
@Test
public void testAllNamespaceForService() throws InvalidSyntaxException {
- RegionFilter negateNonServices = RegionReflectionUtils.newStandardRegionFilterBuilder().allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(" + RegionFilter.VISIBLE_ALL_NAMESPACE_ATTRIBUTE + "=" + RegionFilter.VISIBLE_SERVICE_NAMESPACE + ")").build();
+ RegionFilter negateNonServices = RegionReflectionUtils.newStandardRegionFilterBuilder().allow(
+ RegionFilter.VISIBLE_ALL_NAMESPACE,
+ "(" + RegionFilter.VISIBLE_ALL_NAMESPACE_ATTRIBUTE + "=" + RegionFilter.VISIBLE_SERVICE_NAMESPACE + ")")
+ .build();
assertFalse(negateNonServices.isAllowed(stubBundle));
assertFalse(negateNonServices.isAllowed(fooPackage));
assertFalse(negateNonServices.isAllowed(barPackage));
@@ -212,7 +233,10 @@ public class StandardRegionFilterTests {
assertTrue(negateNonServices.isAllowed(barService.getReference()));
assertTrue(negateNonServices.isAllowed(barServiceCapability));
- negateNonServices = RegionReflectionUtils.newStandardRegionFilterBuilder().allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(" + RegionFilter.VISIBLE_ALL_NAMESPACE_ATTRIBUTE + "=" + RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE + ")").build();
+ negateNonServices = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(" + RegionFilter.VISIBLE_ALL_NAMESPACE_ATTRIBUTE + "="
+ + RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE + ")")
+ .build();
assertFalse(negateNonServices.isAllowed(stubBundle));
assertFalse(negateNonServices.isAllowed(fooPackage));
assertFalse(negateNonServices.isAllowed(barPackage));
@@ -224,7 +248,8 @@ public class StandardRegionFilterTests {
@Test
public void testAllNamespace() throws InvalidSyntaxException {
- RegionFilter regionFilterNotAllowed = RegionReflectionUtils.newStandardRegionFilterBuilder().allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(all=namespace)").build();
+ RegionFilter regionFilterNotAllowed = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(all=namespace)").build();
assertFalse(regionFilterNotAllowed.isAllowed(stubBundle));
assertFalse(regionFilterNotAllowed.isAllowed(fooPackage));
assertFalse(regionFilterNotAllowed.isAllowed(barPackage));
@@ -233,7 +258,8 @@ public class StandardRegionFilterTests {
assertFalse(regionFilterNotAllowed.isAllowed(barService.getReference()));
assertFalse(regionFilterNotAllowed.isAllowed(barServiceCapability));
- RegionFilter regionFilterAllAllowed = RegionReflectionUtils.newStandardRegionFilterBuilder().allowAll(RegionFilter.VISIBLE_ALL_NAMESPACE).build();
+ RegionFilter regionFilterAllAllowed = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allowAll(RegionFilter.VISIBLE_ALL_NAMESPACE).build();
assertTrue(regionFilterAllAllowed.isAllowed(stubBundle));
assertTrue(regionFilterAllAllowed.isAllowed(fooPackage));
assertTrue(regionFilterAllAllowed.isAllowed(barPackage));
@@ -246,7 +272,10 @@ public class StandardRegionFilterTests {
@SuppressWarnings("deprecation")
@Test
public void testNegativeAllNamespace() throws InvalidSyntaxException {
- RegionFilter negateServices = RegionReflectionUtils.newStandardRegionFilterBuilder().allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(!(" + RegionFilter.VISIBLE_ALL_NAMESPACE_ATTRIBUTE + "=" + RegionFilter.VISIBLE_SERVICE_NAMESPACE + "))").build();
+ RegionFilter negateServices = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(!(" + RegionFilter.VISIBLE_ALL_NAMESPACE_ATTRIBUTE + "="
+ + RegionFilter.VISIBLE_SERVICE_NAMESPACE + "))")
+ .build();
assertTrue(negateServices.isAllowed(stubBundle));
assertTrue(negateServices.isAllowed(fooPackage));
assertTrue(negateServices.isAllowed(barPackage));
@@ -255,7 +284,10 @@ public class StandardRegionFilterTests {
assertFalse(negateServices.isAllowed(barService.getReference()));
assertFalse(negateServices.isAllowed(barServiceCapability));
- negateServices = RegionReflectionUtils.newStandardRegionFilterBuilder().allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(!(" + RegionFilter.VISIBLE_ALL_NAMESPACE_ATTRIBUTE + "=" + RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE + "))").build();
+ negateServices = RegionReflectionUtils.newStandardRegionFilterBuilder()
+ .allow(RegionFilter.VISIBLE_ALL_NAMESPACE, "(!(" + RegionFilter.VISIBLE_ALL_NAMESPACE_ATTRIBUTE + "="
+ + RegionFilter.VISIBLE_OSGI_SERVICE_NAMESPACE + "))")
+ .build();
assertTrue(negateServices.isAllowed(stubBundle));
assertTrue(negateServices.isAllowed(fooPackage));
assertTrue(negateServices.isAllowed(barPackage));
diff --git a/bundles/org.eclipse.equinox.region/pom.xml b/bundles/org.eclipse.equinox.region/pom.xml
index a7ea5cb..9fe08c7 100644
--- a/bundles/org.eclipse.equinox.region/pom.xml
+++ b/bundles/org.eclipse.equinox.region/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.registry/pom.xml b/bundles/org.eclipse.equinox.registry/pom.xml
index e72644d..86781f4 100644
--- a/bundles/org.eclipse.equinox.registry/pom.xml
+++ b/bundles/org.eclipse.equinox.registry/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/.classpath b/bundles/org.eclipse.equinox.security.linux.x86_64/.classpath
deleted file mode 100644
index 19ec869..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
- <attributes>
- <attribute name="module" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/.project b/bundles/org.eclipse.equinox.security.linux.x86_64/.project
deleted file mode 100644
index 8d42917..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.equinox.security.linux.x86_64</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.equinox.security.linux.x86_64/.settings/org.eclipse.core.runtime.prefs
deleted file mode 100644
index 5a0ad22..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/.settings/org.eclipse.core.runtime.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-line.separator=\n
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.security.linux.x86_64/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 271c1fb..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,112 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.APILeak=warning
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
-org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
-org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
-org.eclipse.objectteams.otdt.compiler.option.pure_java=enabled
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security.linux.x86_64/META-INF/MANIFEST.MF
deleted file mode 100644
index 99475d6..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,12 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %fragmentName
-Bundle-SymbolicName: org.eclipse.equinox.security.linux.x86_64;singleton:=true
-Bundle-Version: 1.1.500.qualifier
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.equinox.security;bundle-version="[1.0.0,2.0.0)"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Bundle-Localization: fragment
-Eclipse-PlatformFilter: (& (osgi.os=linux) (osgi.arch=x86_64))
-Automatic-Module-Name: org.eclipse.equinox.security.linux.x86_64
-Eclipse-BundleShape: dir
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/META-INF/p2.inf b/bundles/org.eclipse.equinox.security.linux.x86_64/META-INF/p2.inf
deleted file mode 100644
index 525d0ce..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/META-INF/p2.inf
+++ /dev/null
@@ -1,2 +0,0 @@
-requires.0.namespace=org.eclipse.equinox.p2.iu
-requires.0.name=org.eclipse.equinox.security.linux
\ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/about.html b/bundles/org.eclipse.equinox.security.linux.x86_64/about.html
deleted file mode 100644
index 164f781..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/about.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-<title>About</title>
-</head>
-<body lang="EN-US">
- <h2>About This Content</h2>
-
- <p>November 30, 2017</p>
- <h3>License</h3>
-
- <p>
- The Eclipse Foundation makes available all content in this plug-in
- ("Content"). Unless otherwise indicated below, the Content
- is provided to you under the terms and conditions of the Eclipse
- Public License Version 2.0 ("EPL"). A copy of the EPL is
- available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
- For purposes of the EPL, "Program" will mean the Content.
- </p>
-
- <p>
- If you did not receive this Content directly from the Eclipse
- Foundation, the Content is being redistributed by another party
- ("Redistributor") and different terms and conditions may
- apply to your use of any object code in the Content. Check the
- Redistributor's license that was provided with the Content. If no such
- license exists, contact the Redistributor. Unless otherwise indicated
- below, the terms and conditions of the EPL still apply to any source
- code in the Content and such source code may be obtained at <a
- href="http://www.eclipse.org/">http://www.eclipse.org</a>.
- </p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/forceQualifierUpdate.txt b/bundles/org.eclipse.equinox.security.linux.x86_64/forceQualifierUpdate.txt
deleted file mode 100644
index 2e3e337..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/forceQualifierUpdate.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-# To force a version qualifier update add the bug here
-
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/fragment.properties b/bundles/org.eclipse.equinox.security.linux.x86_64/fragment.properties
deleted file mode 100644
index 5171871..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/fragment.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2017 IBM Corporation and others.
-#
-# This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License 2.0
-# which accompanies this distribution, and is available at
-# https://www.eclipse.org/legal/epl-2.0/
-#
-# SPDX-License-Identifier: EPL-2.0
-#
-# Contributors:
-# Julien HENRY - Linux implementation
-###############################################################################
-fragmentName = Linux libsecret integration (64 bit)
-providerName = Eclipse.org - Equinox
-linuxModuleName = Linux Integration (64 bit)
-providerDescription = The provider uses libsecret to store a randomly generated user-specific \'master\' password. Users who can log into the operating system account can access contents of the secure storage.
diff --git a/bundles/org.eclipse.equinox.security.linux.x86_64/pom.xml b/bundles/org.eclipse.equinox.security.linux.x86_64/pom.xml
deleted file mode 100644
index d70661a..0000000
--- a/bundles/org.eclipse.equinox.security.linux.x86_64/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2017, 2021 Eclipse Foundation.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Distribution License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/org/documents/edl-v10.php
-
- Contributors:
- Julien HENRY - Linux implementation
- Red Hat Inc. - Replace Linux implementation with JNA version
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>rt.equinox.bundles</artifactId>
- <groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
- <relativePath>../../</relativePath>
- </parent>
- <groupId>org.eclipse.equinox</groupId>
- <artifactId>org.eclipse.equinox.security.linux.x86_64</artifactId>
- <version>1.1.500-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>target-platform-configuration</artifactId>
- <configuration>
- <dependency-resolution>
- <extraRequirements>
- <requirement>
- <!-- workaround usage of split package https://bugs.eclipse.org/bugs/show_bug.cgi?id=403196 -->
- <id>org.eclipse.equinox.registry</id>
- <versionRange>0.0.0</versionRange>
- <type>p2-installable-unit</type>
- </requirement>
- </extraRequirements>
- </dependency-resolution>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </project>
diff --git a/bundles/org.eclipse.equinox.security.linux/pom.xml b/bundles/org.eclipse.equinox.security.linux/pom.xml
index 88b7a5d..5b2ef43 100644
--- a/bundles/org.eclipse.equinox.security.linux/pom.xml
+++ b/bundles/org.eclipse.equinox.security.linux/pom.xml
@@ -15,7 +15,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.security.macosx/pom.xml b/bundles/org.eclipse.equinox.security.macosx/pom.xml
index 5ae43dc..d5fbec4 100644
--- a/bundles/org.eclipse.equinox.security.macosx/pom.xml
+++ b/bundles/org.eclipse.equinox.security.macosx/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.security.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security.tests/META-INF/MANIFEST.MF
index 19b4886..2d82821 100644
--- a/bundles/org.eclipse.equinox.security.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.security.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Equinox security tests
Bundle-SymbolicName: org.eclipse.equinox.security.tests;singleton:=true
-Bundle-Version: 1.2.200.qualifier
+Bundle-Version: 1.2.300.qualifier
Bundle-Activator: org.eclipse.equinox.internal.security.tests.SecurityTestsActivator
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: Eclipse.org
diff --git a/bundles/org.eclipse.equinox.security.tests/Plugin_Testing/controlled_provider/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security.tests/Plugin_Testing/controlled_provider/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ecf1a90
--- /dev/null
+++ b/bundles/org.eclipse.equinox.security.tests/Plugin_Testing/controlled_provider/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ControlledPasswordProvider
+Bundle-SymbolicName: org.eclipse.equinox.security.ControlledPasswordProvider;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Eclipse.org
+Require-Bundle: org.eclipse.equinox.security.tests
diff --git a/bundles/org.eclipse.equinox.security.tests/Plugin_Testing/controlled_provider/plugin.xml b/bundles/org.eclipse.equinox.security.tests/Plugin_Testing/controlled_provider/plugin.xml
new file mode 100644
index 0000000..4197da8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.security.tests/Plugin_Testing/controlled_provider/plugin.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ id="ControlledPasswordProvider"
+ name="Controlled password provider for tests of secure preferences"
+ point="org.eclipse.equinox.security.secureStorage">
+ <provider
+ class="org.eclipse.equinox.internal.security.tests.storage.ControlledPasswordProvider"
+ priority="10">
+ </provider>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.equinox.security.tests/pom.xml b/bundles/org.eclipse.equinox.security.tests/pom.xml
index 42ae3ba..441ee87 100644
--- a/bundles/org.eclipse.equinox.security.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.security.tests/pom.xml
@@ -14,12 +14,12 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.security.tests</artifactId>
- <version>1.2.200-SNAPSHOT</version>
+ <version>1.2.300-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<testClass>org.eclipse.equinox.security.tests.AllSecurityTests</testClass>
diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ControlledPasswordProvider.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ControlledPasswordProvider.java
new file mode 100644
index 0000000..442af33
--- /dev/null
+++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ControlledPasswordProvider.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.security.tests.storage;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.crypto.spec.PBEKeySpec;
+import org.eclipse.equinox.security.storage.provider.IPreferencesContainer;
+import org.eclipse.equinox.security.storage.provider.PasswordProvider;
+
+/**
+ * Password provider which can be provide controlled password generation from
+ * tests.
+ * <p>
+ * Initially the password is 'initialPassword' and on each request to generate a
+ * new password it will be 'changedPassword-X' where X is a incremental number.
+ */
+public class ControlledPasswordProvider extends PasswordProvider {
+
+ // MODULE_ID = lower-case(Bundle-SymbolicName + Extension ID)
+ public static final String MODULE_ID = "org.eclipse.equinox.security.controlledpasswordprovider.controlledpasswordprovider";
+
+ private static final String INITIAL_PASSWORD = "initialPassword";
+ private static final String CHANGED_PASSWORD = "changedPassword-"; // An incremental number will be appended
+
+ private static PBEKeySpec PASSWORD = new PBEKeySpec(INITIAL_PASSWORD.toCharArray());
+ private static AtomicInteger counter = new AtomicInteger(0);
+
+ @Override
+ public PBEKeySpec getPassword(IPreferencesContainer container, int passwordType) {
+
+ boolean newPassword = ((passwordType & CREATE_NEW_PASSWORD) != 0);
+ boolean passwordChange = ((passwordType & PASSWORD_CHANGE) != 0);
+
+ if (newPassword || passwordChange) {
+ PASSWORD = new PBEKeySpec(createNewPassword().toCharArray());
+ }
+
+ return PASSWORD;
+ }
+
+ @Override
+ public boolean retryOnError(Exception e, IPreferencesContainer container) {
+ return false;
+ }
+
+ private String createNewPassword() {
+ return CHANGED_PASSWORD + counter.incrementAndGet();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ReEncrypterTest.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ReEncrypterTest.java
new file mode 100644
index 0000000..83f4ce2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ReEncrypterTest.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.security.tests.storage;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+import org.eclipse.core.tests.harness.BundleTestingHelper;
+import org.eclipse.equinox.internal.security.storage.friends.InternalExchangeUtils;
+import org.eclipse.equinox.internal.security.storage.friends.ReEncrypter;
+import org.eclipse.equinox.internal.security.tests.SecurityTestsActivator;
+import org.eclipse.equinox.security.storage.ISecurePreferences;
+import org.eclipse.equinox.security.storage.StorageException;
+import org.junit.Test;
+import org.osgi.framework.*;
+
+public class ReEncrypterTest extends StorageAbstractTest {
+
+ final private static int MAX_TIME_PER_BUNDLE = 10000; // maximum time to wait for bundle event in milliseconds
+ final private static String TEST_FILES_ROOT = "Plugin_Testing/";
+
+ final private static String key = "password";
+ final private static String value = "p[[pkknb#";
+
+ final private static String clearTextKey = "data";
+ final private static String clearTextValue = "-> this should not be encrypted <-";
+
+ final private static String defaultValue = "default";
+
+ @Test
+ public void testFlushAfterEncrypt() throws IOException, StorageException, BundleException {
+ URL location = getStorageLocation();
+ assertNotNull(location);
+
+ Bundle bundle = null;
+ try {
+ bundle = installBundle("controlled_provider");
+
+ { // block1: fill and save
+ ISecurePreferences preferences = newPreferences(location, getOptions());
+ fill(preferences);
+ preferences.flush();
+ closePreferences(preferences);
+ }
+
+ { // block2: re-encrypt
+ ISecurePreferences preferences = newPreferences(location, getOptions());
+ ReEncrypter reEncrypter = new ReEncrypter(preferences, getModuleID());
+
+ boolean decryptResult = reEncrypter.decrypt();
+ assertTrue(decryptResult);
+
+ boolean switchToNewPasswordResult = reEncrypter.switchToNewPassword();
+ assertTrue(switchToNewPasswordResult);
+
+ boolean encryptResult = reEncrypter.encrypt();
+ assertTrue(encryptResult);
+ }
+
+ { // block3: re-load and check
+ ISecurePreferences preferences = newPreferences(location, getOptions());
+ check(preferences);
+ }
+ } finally {
+ if (bundle != null)
+ bundle.uninstall();
+ }
+ }
+
+ @Override
+ protected String getModuleID() {
+ return ControlledPasswordProvider.MODULE_ID;
+ }
+
+ protected Map<String, Object> getOptions() {
+ // Don't specify default password for those tests; they need to have
+ // password providers
+ return getOptions(null);
+ }
+
+ /**
+ * Fills the secure preferences with some encrypted and non encrypted values.
+ */
+ private void fill(ISecurePreferences preferences) throws StorageException {
+ assertFalse(isModified(preferences));
+
+ preferences.put(key, value, true); // puts encrypted entry at the root node
+ preferences.put(clearTextKey, clearTextValue, false); // puts clear text entry at the root node
+
+ assertTrue(isModified(preferences));
+ }
+
+ /**
+ * Checks that there isn't any change in the secure preferences and it contains
+ * the same values preciously saved.
+ */
+ private void check(ISecurePreferences preferences) throws StorageException {
+ assertFalse(isModified(preferences));
+
+ assertEquals(value, preferences.get(key, defaultValue)); // checks entry at the root node
+ assertEquals(clearTextValue, preferences.get(clearTextKey, defaultValue));
+ }
+
+ /**
+ * The method reaches into internal classes to check if modified flag is set on
+ * secure preference data.
+ */
+ private boolean isModified(ISecurePreferences node) {
+ return InternalExchangeUtils.isModified(node);
+ }
+
+ /**
+ * Dynamically installs a bundle that should contribute an Extension to the
+ * org.eclipse.equinox.security.secureStorage Extension Point.
+ *
+ * Copied from DynamicPreferencesTest.
+ */
+ protected Bundle installBundle(String bundlePath) throws MalformedURLException, BundleException, IOException {
+ BundleContext bundleContext = SecurityTestsActivator.getDefault().getBundleContext();
+ Bundle bundle = null;
+ WaitingRegistryListener listener = new WaitingRegistryListener();
+ listener.register("org.eclipse.equinox.security.secureStorage");
+
+ try {
+ bundle = BundleTestingHelper.installBundle("0.1", bundleContext, TEST_FILES_ROOT + bundlePath);
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { bundle });
+ // synchronization: listener should receive 1 group of events
+ assertTrue(listener.waitFor(1, MAX_TIME_PER_BUNDLE) == 1);
+ } finally {
+ listener.unregister();
+ }
+ return bundle;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/security/tests/AllSecurityTests.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/security/tests/AllSecurityTests.java
index 7e84a7f..d51cbdd 100644
--- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/security/tests/AllSecurityTests.java
+++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/security/tests/AllSecurityTests.java
@@ -26,7 +26,7 @@ import org.junit.runners.Suite.SuiteClasses;
*/
@RunWith(Suite.class)
@SuiteClasses({ Base64Test.class, DetectPBECiphersTest.class, SlashEncodeTest.class, DefaultPreferencesTest.class,
- DynamicPreferencesTest.class, ObsoletesTest.class, WinPreferencesTest.class })
+ DynamicPreferencesTest.class, ObsoletesTest.class, WinPreferencesTest.class, ReEncrypterTest.class })
public class AllSecurityTests {
// see @SuiteClasses
}
diff --git a/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
index 9907cde..11308c6 100644
--- a/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.security.ui;singleton:=true
-Bundle-Version: 1.3.100.qualifier
+Bundle-Version: 1.3.200.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Import-Package: javax.crypto.spec,
diff --git a/bundles/org.eclipse.equinox.security.ui/pom.xml b/bundles/org.eclipse.equinox.security.ui/pom.xml
index 6852778..a33498e 100644
--- a/bundles/org.eclipse.equinox.security.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.security.ui/pom.xml
@@ -15,13 +15,13 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.security.ui</artifactId>
- <version>1.3.100-SNAPSHOT</version>
+ <version>1.3.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java
index 6fd82dd..53f217f 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java
@@ -196,19 +196,22 @@ public class X500PrincipalHelper {
while (startIndex < dn.length()) {
int endIndex;
+ StringBuilder value = new StringBuilder();
for (endIndex = startIndex; endIndex < dn.length(); endIndex++) {
c = dn.charAt(endIndex);
if (c == ',' || c == '+')
break;
if (c == '\\') {
endIndex++; // skip the escaped char
+ } else {
+ value.append(c);
}
}
if (endIndex > dn.length())
throw new IllegalArgumentException("unterminated escape " + dn); //$NON-NLS-1$
- nameValues.add(dn.substring(startIndex, endIndex));
+ nameValues.add(value.toString());
if (c != '+') {
rdnNameArray.add(nameValues);
diff --git a/bundles/org.eclipse.equinox.security.win32.x86_64/pom.xml b/bundles/org.eclipse.equinox.security.win32.x86_64/pom.xml
index 863af21..7cd2208 100644
--- a/bundles/org.eclipse.equinox.security.win32.x86_64/pom.xml
+++ b/bundles/org.eclipse.equinox.security.win32.x86_64/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
index 8eaaade..df46f58 100644
--- a/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.security;singleton:=true
-Bundle-Version: 1.3.800.qualifier
+Bundle-Version: 1.3.900.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.equinox.internal.security.auth.AuthPlugin
diff --git a/bundles/org.eclipse.equinox.security/pom.xml b/bundles/org.eclipse.equinox.security/pom.xml
index 815d5f3..4267290 100644
--- a/bundles/org.eclipse.equinox.security/pom.xml
+++ b/bundles/org.eclipse.equinox.security/pom.xml
@@ -14,12 +14,12 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.security</artifactId>
- <version>1.3.800-SNAPSHOT</version>
+ <version>1.3.900-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/nls/SecAuthMessages.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/nls/SecAuthMessages.java
index 657ae4b..e071fd9 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/nls/SecAuthMessages.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/nls/SecAuthMessages.java
@@ -87,6 +87,7 @@ public class SecAuthMessages extends NLS {
public static String usingAlgorithm;
public static String decryptingError;
public static String encryptingError;
+ public static String persistingError;
public static String noDigest;
public static String failedCreateRecovery;
public static String initCancelled;
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/nls/messages.properties b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/nls/messages.properties
index 2188284..b52345b 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/nls/messages.properties
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/nls/messages.properties
@@ -80,6 +80,7 @@ noAlgorithm = Unable to find provider of the encryption algorithm \"{0}\". Unabl
usingAlgorithm = Unable to find default encryption algorithm \"{0}\", using \"{1}\" instead.
decryptingError = Unable to decrypt value associated with the key \"{0}\" on the node \"{1}\".
encryptingError = Unable to encrypt value associated with the key \"{0}\" on the node \"{1}\".
+persistingError = Unable to persist encrypted values of node \"{0}\" to the underlying storage.
noDigest = Digest algorithm \"{0}\" is not available.
failedCreateRecovery = Unable to create value for the password recovery.
initCancelled = Secure Storage initialization was canceled; please try again.
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
index 6fe0bc8..d504437 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.security.storage.friends;
+import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;
import org.eclipse.equinox.internal.security.auth.AuthPlugin;
@@ -143,6 +144,16 @@ public class ReEncrypter {
container.setOption(IProviderHints.REQUIRED_MODULE_ID, originalProperty);
else
container.removeOption(IProviderHints.REQUIRED_MODULE_ID);
+
+ try {
+ // Ensure modified entries are persisted and avoid potential inconsistent state
+ root.flush();
+ } catch (IOException e) {
+ String msg = NLS.bind(SecAuthMessages.persistingError, root.name());
+ AuthPlugin.getDefault().logError(msg, e);
+ result = false;
+ }
+
return result;
}
diff --git a/bundles/org.eclipse.equinox.servletbridge.extensionbundle/pom.xml b/bundles/org.eclipse.equinox.servletbridge.extensionbundle/pom.xml
index 4663050..a46e4fe 100644
--- a/bundles/org.eclipse.equinox.servletbridge.extensionbundle/pom.xml
+++ b/bundles/org.eclipse.equinox.servletbridge.extensionbundle/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.servletbridge.template/pom.xml b/bundles/org.eclipse.equinox.servletbridge.template/pom.xml
index 0cfd78c..46a6f61 100644
--- a/bundles/org.eclipse.equinox.servletbridge.template/pom.xml
+++ b/bundles/org.eclipse.equinox.servletbridge.template/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.servletbridge/pom.xml b/bundles/org.eclipse.equinox.servletbridge/pom.xml
index 7af5f07..e9cf8d8 100644
--- a/bundles/org.eclipse.equinox.servletbridge/pom.xml
+++ b/bundles/org.eclipse.equinox.servletbridge/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.slf4j.stub/pom.xml b/bundles/org.eclipse.equinox.slf4j.stub/pom.xml
index a168e76..1130330 100644
--- a/bundles/org.eclipse.equinox.slf4j.stub/pom.xml
+++ b/bundles/org.eclipse.equinox.slf4j.stub/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
diff --git a/bundles/org.eclipse.equinox.transforms.hook/pom.xml b/bundles/org.eclipse.equinox.transforms.hook/pom.xml
index 41891bf..726b2ac 100644
--- a/bundles/org.eclipse.equinox.transforms.hook/pom.xml
+++ b/bundles/org.eclipse.equinox.transforms.hook/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.transforms.xslt/pom.xml b/bundles/org.eclipse.equinox.transforms.xslt/pom.xml
index 7b5383d..d65791e 100644
--- a/bundles/org.eclipse.equinox.transforms.xslt/pom.xml
+++ b/bundles/org.eclipse.equinox.transforms.xslt/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.useradmin/pom.xml b/bundles/org.eclipse.equinox.useradmin/pom.xml
index f3238d7..368de0b 100644
--- a/bundles/org.eclipse.equinox.useradmin/pom.xml
+++ b/bundles/org.eclipse.equinox.useradmin/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<properties>
diff --git a/bundles/org.eclipse.equinox.util/pom.xml b/bundles/org.eclipse.equinox.util/pom.xml
index bf0f41d..da55418 100644
--- a/bundles/org.eclipse.equinox.util/pom.xml
+++ b/bundles/org.eclipse.equinox.util/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.weaving.caching.j9/pom.xml b/bundles/org.eclipse.equinox.weaving.caching.j9/pom.xml
index e991321..9d90fb5 100644
--- a/bundles/org.eclipse.equinox.weaving.caching.j9/pom.xml
+++ b/bundles/org.eclipse.equinox.weaving.caching.j9/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.weaving.caching/pom.xml b/bundles/org.eclipse.equinox.weaving.caching/pom.xml
index 1bd847b..52638cf 100644
--- a/bundles/org.eclipse.equinox.weaving.caching/pom.xml
+++ b/bundles/org.eclipse.equinox.weaving.caching/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.weaving.hook/pom.xml b/bundles/org.eclipse.equinox.weaving.hook/pom.xml
index 1c28f95..933542b 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/pom.xml
+++ b/bundles/org.eclipse.equinox.weaving.hook/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/bundles/org.eclipse.equinox.wireadmin/pom.xml b/bundles/org.eclipse.equinox.wireadmin/pom.xml
index 6f5f0c9..f59f4e0 100644
--- a/bundles/org.eclipse.equinox.wireadmin/pom.xml
+++ b/bundles/org.eclipse.equinox.wireadmin/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox</groupId>
diff --git a/debian/changelog b/debian/changelog
index ff5a6a6..f5148b1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+equinox-bundles (200904302341+git20220310.1.fd2f4fb+ds-1) UNRELEASED; urgency=low
+
+ * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk> Sat, 21 Jan 2023 22:28:22 -0000
+
equinox-bundles (4.22-1) unstable; urgency=medium
* New upstream release
diff --git a/debian/patches/jetty-compatibility.patch b/debian/patches/jetty-compatibility.patch
index f97b055..c704875 100644
--- a/debian/patches/jetty-compatibility.patch
+++ b/debian/patches/jetty-compatibility.patch
@@ -1,9 +1,11 @@
Description: Fixes the compatibility with the version of Jetty in Debian
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
---- a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
-+++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
-@@ -26,7 +26,6 @@
+Index: equinox-bundles.git/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
+===================================================================
+--- equinox-bundles.git.orig/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
++++ equinox-bundles.git/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
+@@ -26,7 +26,6 @@ import javax.servlet.http.*;
import org.eclipse.equinox.http.jetty.JettyConstants;
import org.eclipse.equinox.http.jetty.JettyCustomizer;
import org.eclipse.equinox.http.servlet.HttpServiceServlet;
@@ -11,7 +13,7 @@ Forwarded: not-needed
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.server.session.HouseKeeper;
import org.eclipse.jetty.server.session.SessionHandler;
-@@ -182,7 +181,6 @@
+@@ -182,7 +181,6 @@ public class HttpServerManager implement
// HTTPS Configuration
HttpConfiguration https_config = new HttpConfiguration(http_config);
https_config.addCustomizer(new SecureRequestCustomizer());
@@ -19,7 +21,7 @@ Forwarded: not-needed
// HTTPS connector
httpsConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config)); //$NON-NLS-1$
-@@ -200,7 +198,6 @@
+@@ -200,7 +198,6 @@ public class HttpServerManager implement
http_config.setSecureScheme("https"); //$NON-NLS-1$
http_config.setSecurePort(Details.getInt(dictionary, JettyConstants.HTTPS_PORT, 443));
}
diff --git a/debian/patches/osgi-compatibility.patch b/debian/patches/osgi-compatibility.patch
index 0698953..c55801d 100644
--- a/debian/patches/osgi-compatibility.patch
+++ b/debian/patches/osgi-compatibility.patch
@@ -1,9 +1,11 @@
Description: Fixes the compatibility with the version of the OSGi specification in Debian
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
---- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java
-+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java
-@@ -122,7 +122,7 @@
+Index: equinox-bundles.git/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java
+===================================================================
+--- equinox-bundles.git.orig/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java
++++ equinox-bundles.git/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java
+@@ -122,7 +122,7 @@ public class UtilActivator implements Bu
timeLog(33); /* 33 = "Creating Timer service took " */
int i = getInteger("equinox.util.threadpool.inactiveTime", 30);
diff --git a/features/org.eclipse.equinox.compendium.sdk/pom.xml b/features/org.eclipse.equinox.compendium.sdk/pom.xml
index a8aea56..1651d92 100644
--- a/features/org.eclipse.equinox.compendium.sdk/pom.xml
+++ b/features/org.eclipse.equinox.compendium.sdk/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
diff --git a/features/org.eclipse.equinox.core.feature/feature.xml b/features/org.eclipse.equinox.core.feature/feature.xml
index f4d152d..4b91e44 100644
--- a/features/org.eclipse.equinox.core.feature/feature.xml
+++ b/features/org.eclipse.equinox.core.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.core.feature"
label="%featureName"
- version="1.13.400.qualifier"
+ version="1.13.600.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.equinox.core.feature/pom.xml b/features/org.eclipse.equinox.core.feature/pom.xml
index 3e2a97c..87d3d18 100644
--- a/features/org.eclipse.equinox.core.feature/pom.xml
+++ b/features/org.eclipse.equinox.core.feature/pom.xml
@@ -14,12 +14,12 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
<artifactId>org.eclipse.equinox.core.feature</artifactId>
- <version>1.13.400-SNAPSHOT</version>
+ <version>1.13.600-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.equinox.core.sdk/feature.xml b/features/org.eclipse.equinox.core.sdk/feature.xml
index f7c48d8..b74db66 100644
--- a/features/org.eclipse.equinox.core.sdk/feature.xml
+++ b/features/org.eclipse.equinox.core.sdk/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.core.sdk"
label="%featureName"
- version="3.23.200.qualifier"
+ version="3.23.400.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
@@ -420,7 +420,7 @@
install-size="0"
version="0.0.0"
unpack="false"/>
-
+
<plugin
id="org.eclipse.equinox.weaving.caching"
download-size="0"
diff --git a/features/org.eclipse.equinox.core.sdk/forceQualifierUpdate.txt b/features/org.eclipse.equinox.core.sdk/forceQualifierUpdate.txt
index e44daba..27edf75 100644
--- a/features/org.eclipse.equinox.core.sdk/forceQualifierUpdate.txt
+++ b/features/org.eclipse.equinox.core.sdk/forceQualifierUpdate.txt
@@ -12,3 +12,4 @@ Bug 571080 - Update to Sshd osgi 2.6.0
Build failure on 20210324
Bug 572853 - Comparator errors in 4.20 I20210414-1800 build
Bug 574602 - Eclipse 4.21 prerequisites: Orbit
+Bug 578120 - Update to latest Orbit - bouncycastle and mina sshd updates
\ No newline at end of file
diff --git a/features/org.eclipse.equinox.core.sdk/pom.xml b/features/org.eclipse.equinox.core.sdk/pom.xml
index 185b2a9..575be81 100644
--- a/features/org.eclipse.equinox.core.sdk/pom.xml
+++ b/features/org.eclipse.equinox.core.sdk/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
<artifactId>org.eclipse.equinox.core.sdk</artifactId>
- <version>3.23.200-SNAPSHOT</version>
+ <version>3.23.400-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.equinox.sdk/feature.xml b/features/org.eclipse.equinox.sdk/feature.xml
index 479118b..e5ed833 100644
--- a/features/org.eclipse.equinox.sdk/feature.xml
+++ b/features/org.eclipse.equinox.sdk/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.sdk"
label="%featureName"
- version="3.23.200.qualifier"
+ version="3.23.400.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.equinox.sdk/pom.xml b/features/org.eclipse.equinox.sdk/pom.xml
index 9b601a5..ae35e3a 100644
--- a/features/org.eclipse.equinox.sdk/pom.xml
+++ b/features/org.eclipse.equinox.sdk/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
<artifactId>org.eclipse.equinox.sdk</artifactId>
- <version>3.23.200-SNAPSHOT</version>
+ <version>3.23.400-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.equinox.server.core/feature.xml b/features/org.eclipse.equinox.server.core/feature.xml
index 96ccfae..1f38e33 100644
--- a/features/org.eclipse.equinox.server.core/feature.xml
+++ b/features/org.eclipse.equinox.server.core/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.server.core"
label="%featureName"
- version="1.14.400.qualifier"
+ version="1.14.600.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.equinox.server.core/pom.xml b/features/org.eclipse.equinox.server.core/pom.xml
index 3bcc624..deb6f8e 100644
--- a/features/org.eclipse.equinox.server.core/pom.xml
+++ b/features/org.eclipse.equinox.server.core/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
<artifactId>org.eclipse.equinox.server.core</artifactId>
- <version>1.14.400-SNAPSHOT</version>
+ <version>1.14.600-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.equinox.server.jetty/pom.xml b/features/org.eclipse.equinox.server.jetty/pom.xml
index 88fa15e..6a5958c 100644
--- a/features/org.eclipse.equinox.server.jetty/pom.xml
+++ b/features/org.eclipse.equinox.server.jetty/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
diff --git a/features/org.eclipse.equinox.server.p2/feature.xml b/features/org.eclipse.equinox.server.p2/feature.xml
index 4713727..5c9205b 100644
--- a/features/org.eclipse.equinox.server.p2/feature.xml
+++ b/features/org.eclipse.equinox.server.p2/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.server.p2"
label="%featureName"
- version="1.12.300.qualifier"
+ version="1.12.500.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
@@ -19,7 +19,7 @@
<import feature="org.eclipse.ecf.core.feature" version="1.5.0" match="compatible"/>
<import feature="org.eclipse.ecf.core.ssl.feature" version="1.1.0" match="compatible"/>
<import feature="org.eclipse.ecf.filetransfer.feature" version="3.13.7" match="compatible"/>
- <import feature="org.eclipse.ecf.filetransfer.httpclient45.feature" version="1.0.0" match="compatible"/>
+ <import feature="org.eclipse.ecf.filetransfer.httpclient5.feature" version="1.0.0" match="compatible"/>
<import feature="org.eclipse.ecf.filetransfer.ssl.feature" version="1.1.0" match="compatible"/>
</requires>
diff --git a/features/org.eclipse.equinox.server.p2/pom.xml b/features/org.eclipse.equinox.server.p2/pom.xml
index 5eb6f52..51af873 100644
--- a/features/org.eclipse.equinox.server.p2/pom.xml
+++ b/features/org.eclipse.equinox.server.p2/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
<artifactId>org.eclipse.equinox.server.p2</artifactId>
- <version>1.12.300-SNAPSHOT</version>
+ <version>1.12.500-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.equinox.server.servletbridge/pom.xml b/features/org.eclipse.equinox.server.servletbridge/pom.xml
index 22b25cd..71bb1d5 100644
--- a/features/org.eclipse.equinox.server.servletbridge/pom.xml
+++ b/features/org.eclipse.equinox.server.servletbridge/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
diff --git a/features/org.eclipse.equinox.server.simple/pom.xml b/features/org.eclipse.equinox.server.simple/pom.xml
index 1a86dd6..ece0e45 100644
--- a/features/org.eclipse.equinox.server.simple/pom.xml
+++ b/features/org.eclipse.equinox.server.simple/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
diff --git a/features/org.eclipse.equinox.serverside.sdk/feature.xml b/features/org.eclipse.equinox.serverside.sdk/feature.xml
index edcc0a0..ecac9f6 100644
--- a/features/org.eclipse.equinox.serverside.sdk/feature.xml
+++ b/features/org.eclipse.equinox.serverside.sdk/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.serverside.sdk"
label="%featureName"
- version="3.23.200.qualifier"
+ version="3.23.400.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.equinox.serverside.sdk/pom.xml b/features/org.eclipse.equinox.serverside.sdk/pom.xml
index 48bb583..26304e9 100644
--- a/features/org.eclipse.equinox.serverside.sdk/pom.xml
+++ b/features/org.eclipse.equinox.serverside.sdk/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>rt.equinox.bundles</artifactId>
<groupId>org.eclipse.equinox.bundles</groupId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.equinox.feature</groupId>
<artifactId>org.eclipse.equinox.serverside.sdk</artifactId>
- <version>3.23.200-SNAPSHOT</version>
+ <version>3.23.400-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/pom.xml b/pom.xml
index f1dbc40..60744fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.eclipse</groupId>
<artifactId>eclipse-platform-parent</artifactId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../eclipse-platform-parent</relativePath>
</parent>
@@ -85,7 +85,6 @@
<module>bundles/org.eclipse.equinox.security.macosx</module>
<module>bundles/org.eclipse.equinox.security.win32.x86_64</module>
<module>bundles/org.eclipse.equinox.security.linux</module>
- <module>bundles/org.eclipse.equinox.security.linux.x86_64</module>
<module>bundles/org.eclipse.equinox.bidi</module>
<module>bundles/org.eclipse.equinox.cm</module>
<module>bundles/org.eclipse.equinox.console</module>
diff --git a/tests-pom/pom.xml b/tests-pom/pom.xml
index 5e3cf4a..675764c 100644
--- a/tests-pom/pom.xml
+++ b/tests-pom/pom.xml
@@ -14,7 +14,7 @@
<parent>
<groupId>org.eclipse.equinox.bundles</groupId>
<artifactId>rt.equinox.bundles</artifactId>
- <version>4.22.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<artifactId>tests-pom</artifactId>
<packaging>pom</packaging>