diff options
author | Thomas Watson | 2014-02-26 15:22:56 +0000 |
---|---|---|
committer | Thomas Watson | 2014-02-26 15:22:56 +0000 |
commit | 5f224660cc2352c99c12a73259d64b34a72772db (patch) | |
tree | 04ae4004a746be915359d1d8d616d683127ca2fd /bundles/org.eclipse.osgi.tests | |
parent | 8b0c45ec585392556c01c38b42e7f63c6a023291 (diff) | |
download | rt.equinox.framework-5f224660cc2352c99c12a73259d64b34a72772db.tar.gz rt.equinox.framework-5f224660cc2352c99c12a73259d64b34a72772db.tar.xz rt.equinox.framework-5f224660cc2352c99c12a73259d64b34a72772db.zip |
Add new no default test
Also fix a bug in addLocation that prevented any locations from ever getting added.
Diffstat (limited to 'bundles/org.eclipse.osgi.tests')
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java index 8c7fc5e84..8770f1071 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2013 IBM Corporation and others. + * Copyright (c) 2004, 2014 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 @@ -313,7 +313,7 @@ public class BasicLocationTests extends CoreTest { private static void addLocation(BundleContext context, String filter, Map<String, Location> locations) throws InvalidSyntaxException { Collection<ServiceReference<Location>> locationRefs = context.getServiceReferences(Location.class, filter); - if (!locations.isEmpty()) { + if (!locationRefs.isEmpty()) { locations.put(filter, context.getService(locationRefs.iterator().next())); } } @@ -359,7 +359,26 @@ public class BasicLocationTests extends CoreTest { } finally { equinox.stop(); } + } + + public void testNoDefault() throws Exception { + Map<String, String> fwkConfig = new HashMap<String, String>(); + fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true"); + fwkConfig.put(EquinoxLocations.PROP_INSTALL_AREA, "file:" + prefix + "/g"); + fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "@noDefault"); + fwkConfig.put(EquinoxLocations.PROP_USER_AREA, "@noDefault"); + Equinox equinox = new Equinox(fwkConfig); + equinox.init(); + try { + Map<String, Location> locations = getLocations(equinox); + Location userLocation = locations.get(Location.USER_FILTER); + Location instanceLocation = locations.get(Location.INSTANCE_FILTER); + assertNull("User locatoin is not null.", userLocation.getURL()); + assertNull("Instance location is not null.", instanceLocation.getURL()); + } finally { + equinox.stop(); + } } public void testUserDir() throws Exception { |