Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2013-05-13 20:52:35 +0000
committerThomas Watson2013-05-13 20:52:35 +0000
commit4c7977c3d3cdd7425b1d5f2ccc92ff10567efcad (patch)
tree6f80b26d5ce9ee00f023c5d52f9bc0bff6a936b8 /bundles/org.eclipse.osgi.tests/src
parent9ae51027b2f61691b26677f8777a354abecebce9 (diff)
downloadrt.equinox.framework-4c7977c3d3cdd7425b1d5f2ccc92ff10567efcad.tar.gz
rt.equinox.framework-4c7977c3d3cdd7425b1d5f2ccc92ff10567efcad.tar.xz
rt.equinox.framework-4c7977c3d3cdd7425b1d5f2ccc92ff10567efcad.zip
Bug 405919 - [unity] support for osgi.checkConfiguration option
- Added DiscardBundleTests to the BundleTests suite - Fixed issues with tests usage of encoded URIs when touching the test bundle files.
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/src')
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java3
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java18
2 files changed, 11 insertions, 10 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java
index 06a4d9510..21df7b707 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@ import junit.framework.TestSuite;
public class BundleTests {
public static Test suite() {
TestSuite suite = new TestSuite(BundleTests.class.getName());
+ suite.addTest(DiscardBundleTests.suite());
suite.addTest(LoggingTests.suite());
suite.addTest(BundleResourceTests.suite());
suite.addTest(BundleInstallUpdateTests.suite());
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java
index f2b090153..77adecca1 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java
@@ -136,15 +136,16 @@ public class DiscardBundleTests extends AbstractBundleTests {
doTest(configuration, discard, getJarLocation());
}
- private void doTest(Map<String, ?> configuration, boolean discard, String location) throws Exception {
+ private void doTest(Map<String, ?> configuration, boolean discard, File bundleFile) throws Exception {
Equinox equinox = new Equinox(configuration);
initAndStart(equinox);
try {
+ String location = REFERENCE_PROTOCOL + bundleFile.toURI();
equinox.getBundleContext().installBundle(location);
try {
equinox = restart(equinox, configuration);
assertNotDiscarded(location, equinox);
- touchFile(location);
+ touchFile(bundleFile);
equinox = restart(equinox, configuration);
if (discard)
assertDiscarded(location, equinox);
@@ -162,12 +163,12 @@ public class DiscardBundleTests extends AbstractBundleTests {
}
}
- private String getDirectoryLocation() {
- return REFERENCE_PROTOCOL + root.toURI() + BUNDLE_DIR;
+ private File getDirectoryLocation() {
+ return new File(root, BUNDLE_DIR);
}
- private String getJarLocation() {
- return REFERENCE_PROTOCOL + root.toURI() + BUNDLE_JAR;
+ private File getJarLocation() {
+ return new File(root, BUNDLE_JAR);
}
private void initAndStart(Equinox equinox) throws BundleException {
@@ -199,10 +200,9 @@ public class DiscardBundleTests extends AbstractBundleTests {
}
}
- private void touchFile(String location) {
- File file = new File(location.substring((REFERENCE_PROTOCOL + "file:").length()));
+ private void touchFile(File file) {
if (file.isDirectory())
file = new File(file, BUNDLE_MANIFEST);
- assertTrue("Could not set last modified", file.setLastModified(file.lastModified() + 1000));
+ assertTrue("Could not set last modified: " + file, file.setLastModified(file.lastModified() + 1000));
}
} \ No newline at end of file

Back to the top