Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-10-05 17:59:14 -0400
committerMickael Istria2018-10-08 06:24:40 -0400
commit65d2de89ebdffc2ed0fdf596f9f1c3e5c9609789 (patch)
tree573a860bf2d01feaaa52373d4a11c563b10dba2b /bundles/org.eclipse.equinox.p2.tests.ui
parent02ceef70510167c357b7cf205476fc234f2bef57 (diff)
downloadrt.equinox.p2-65d2de89ebdffc2ed0fdf596f9f1c3e5c9609789.tar.gz
rt.equinox.p2-65d2de89ebdffc2ed0fdf596f9f1c3e5c9609789.tar.xz
rt.equinox.p2-65d2de89ebdffc2ed0fdf596f9f1c3e5c9609789.zip
Fix setup for ImportExportTests
Closing service tracker in test's setup method unbinds agent in ImportExportImpl and is the cause of NPEs when calling P2ImportExport's exportP2F(OutputStream, IInstallableUnit[], boolean, IProgressMonitor). Just open service tracker before test, keep it open during the test and close it after the test. Change-Id: I61c1f8d4b37e0b490d61f4b2496343e6f0132591 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.ui')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java7
3 files changed, 6 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
index 82c246555..504d3e134 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.tests.ui
-Bundle-Version: 1.2.100.qualifier
+Bundle-Version: 1.2.200.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.100",
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
index 549f493f4..0fad0ab7e 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.tests.ui</artifactId>
- <version>1.2.100-SNAPSHOT</version>
+ <version>1.2.200-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
index 1751151a2..7cc7b3e54 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
@@ -33,6 +33,7 @@ import org.osgi.util.tracker.ServiceTracker;
public class ImportExportTests extends AbstractProvisioningTest {
private P2ImportExport importexportService;
+ private ServiceTracker<P2ImportExport, P2ImportExport> tracker;
private List<IStatus> getChildren(IStatus s) {
List<IStatus> rt = new ArrayList<>();
@@ -48,17 +49,17 @@ public class ImportExportTests extends AbstractProvisioningTest {
@Override
protected void setUp() throws Exception {
super.setUp();
- ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<>(TestActivator.getContext(), P2ImportExport.class, null);
+ tracker = new ServiceTracker<>(TestActivator.getContext(), P2ImportExport.class, null);
tracker.open();
importexportService = tracker.getService();
assertNotNull("Fail to get ImportExport service", importexportService);
- tracker.close();
}
@Override
protected void tearDown() throws Exception {
- super.tearDown();
+ tracker.close();
importexportService = null;
+ super.tearDown();
}
public void testLoadP2f() throws IOException {

Back to the top