Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.common.tests')
-rw-r--r--bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.common.tests/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java56
-rw-r--r--bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/TestClass.java19
4 files changed, 76 insertions, 5 deletions
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 afab99b89..70e803646 100644
--- a/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Common Eclipse Runtime Tests
Bundle-SymbolicName: org.eclipse.equinox.common.tests;singleton:=true
-Bundle-Version: 3.11.0.qualifier
+Bundle-Version: 3.11.100.qualifier
Automatic-Module-Name: org.eclipse.equinox.common.tests
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
- org.eclipse.equinox.common;bundle-version="3.10.300",
+ org.eclipse.equinox.common;bundle-version="3.12.0",
org.eclipse.core.tests.harness;bundle-version="3.11.400",
org.eclipse.equinox.registry;bundle-version="3.8.200"
Import-Package: org.eclipse.osgi.service.localization,
diff --git a/bundles/org.eclipse.equinox.common.tests/pom.xml b/bundles/org.eclipse.equinox.common.tests/pom.xml
index b4e3cde3b..b591f29f5 100644
--- a/bundles/org.eclipse.equinox.common.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.common.tests/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common.tests</artifactId>
- <version>3.11.0-SNAPSHOT</version>
+ <version>3.11.100-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java
index 172214e99..41e4405c0 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,12 +10,30 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Alexander Fedorov (ArSysOp) - Bug 561712
*******************************************************************************/
package org.eclipse.equinox.common.tests;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.Arrays;
-import org.eclipse.core.runtime.*;
+import java.util.Collections;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.tests.harness.CoreTest;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.FrameworkUtil;
public class StatusTest extends CoreTest {
@@ -108,6 +126,40 @@ public class StatusTest extends CoreTest {
}
+ public void testSingleFromClass() throws ClassNotFoundException, IOException, BundleException {
+ assertEquals("org.eclipse.equinox.common.tests", new Status(IStatus.WARNING, StatusTest.class, "").getPlugin());
+ assertEquals("org.eclipse.equinox.common", new Status(IStatus.ERROR, IStatus.class, "", null).getPlugin());
+ assertEquals("java.lang.String", new Status(IStatus.WARNING, String.class, 0, "", null).getPlugin());
+ assertEquals("org.eclipse.core.runtime.Status", new Status(IStatus.WARNING, (Class<?>) null, "").getPlugin());
+ assertEquals(TestClass.class.getName(),
+ new Status(IStatus.WARNING, installNoBSNBundle().loadClass(TestClass.class.getName()), "").getPlugin());
+ }
+
+ public void testMultiFromClass() throws ClassNotFoundException, IOException, BundleException {
+ assertEquals("org.eclipse.equinox.common", new MultiStatus(IStatus.class, 0, "").getPlugin());
+ assertEquals("org.eclipse.equinox.common.tests", new MultiStatus(StatusTest.class, 0, "").getPlugin());
+ assertEquals("java.lang.String", new MultiStatus(String.class, 0, new Status[0], "", null).getPlugin());
+ assertEquals("org.eclipse.core.runtime.MultiStatus", new MultiStatus((Class<?>) null, 0, "").getPlugin());
+ assertEquals(TestClass.class.getName(),
+ new MultiStatus(installNoBSNBundle().loadClass(TestClass.class.getName()), 0, "").getPlugin());
+ }
+
+ private Bundle installNoBSNBundle() throws IOException, BundleException {
+ BundleContext bc = FrameworkUtil.getBundle(getClass()).getBundleContext();
+ File noNameBSNFile = bc.getDataFile("noNameBSN.jar");
+ noNameBSNFile.delete();
+ URI noNameBSNJar = URI.create("jar:" + noNameBSNFile.toURI().toASCIIString());
+
+ try (FileSystem zipfs = FileSystems.newFileSystem(noNameBSNJar, Collections.singletonMap("create", "true"))) {
+ URL testClassURL = getClass().getResource("TestClass.class");
+ Path testClassPath = zipfs.getPath(testClassURL.getPath().substring(1));
+ // copy a file into the zip file
+ Files.createDirectories(testClassPath.getParent());
+ Files.copy(testClassURL.openStream(), testClassPath);
+ }
+ return bc.installBundle(noNameBSNFile.toURI().toASCIIString());
+ }
+
public void testAddAll() {
multistatus1.add(status2);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/TestClass.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/TestClass.java
new file mode 100644
index 000000000..05299a277
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/TestClass.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2020 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
+ * Alexander Fedorov (ArSysOp) - Bug 561712
+ *******************************************************************************/
+package org.eclipse.equinox.common.tests;
+
+public class TestClass {
+
+}

Back to the top