Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-04-15 15:58:01 -0400
committerThomas Watson2014-04-15 16:03:54 -0400
commit4fbd31ebe2f91a35564c55cb48915adec82ede5f (patch)
tree17bde971e215132e7f485fec575f329fd5ccb3de
parenta6dd1d327729bbb080ad8d4090062be615699b2d (diff)
downloadrt.equinox.framework-4fbd31ebe2f91a35564c55cb48915adec82ede5f.tar.gz
rt.equinox.framework-4fbd31ebe2f91a35564c55cb48915adec82ede5f.tar.xz
rt.equinox.framework-4fbd31ebe2f91a35564c55cb48915adec82ede5f.zip
Bug 432632 - Values with Java Format Strings are not properly returned
from BundleContext.getProperty - Add a testcase Change-Id: I2c8670920ea3b59392d88085483f5c11d56e72fa
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
index e37a06f32..60e2c7792 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
@@ -2083,7 +2083,7 @@ public class SystemBundleTests extends AbstractBundleTests {
assertEquals("Wrong stopping order", expectedOrder.toArray(), stoppingOrder.toArray());
}
- public void testBug412228() throws BundleException, InstantiationException, IllegalAccessException, ClassNotFoundException {
+ public void testBug412228() throws BundleException {
File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$
Map<String, Object> configuration = new HashMap<String, Object>();
configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
@@ -2111,6 +2111,36 @@ public class SystemBundleTests extends AbstractBundleTests {
}
+ public void testBug432632() throws BundleException, IOException {
+ File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$
+ config.mkdirs();
+ // create a config.ini with some system property substitutes
+ Properties configIni = new Properties();
+ configIni.setProperty("test.substitute1", "Some.$test.prop1$.test");
+ configIni.setProperty("test.substitute2", "Some.$test.prop2$.test");
+ configIni.store(new FileOutputStream(new File(config, "config.ini")), "Test config.ini");
+ // Only provide substitution for the first prop
+ System.setProperty("test.prop1", "PASSED");
+ Map<String, Object> configuration = new HashMap<String, Object>();
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
+ equinox.init();
+
+ BundleContext systemContext = equinox.getBundleContext();
+ // check for substitution
+ assertEquals("Wrong value for test.substitute1", "Some.PASSED.test", systemContext.getProperty("test.substitute1"));
+ // check that non-substitution keeps $ delimiters.
+ assertEquals("Wrong value for test.substitute2", "Some.$test.prop2$.test", systemContext.getProperty("test.substitute2"));
+ equinox.stop();
+ try {
+ equinox.waitForStop(5000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ fail("Unexpected interruption.", e);
+ }
+
+ }
+
public void testDynamicSecurityManager() throws BundleException {
SecurityManager sm = System.getSecurityManager();
assertNull("SecurityManager must be null to test.", sm);

Back to the top