use of org.eclipse.osgi.service.datalocation.Location in project rt.equinox.framework by eclipse.
the class BasicLocationTests method testLocationDataArea01.
public void testLocationDataArea01() {
Location instance = instanceLocationTracker.getService();
doAllTestLocationDataArea(instance, INSTANCE_DATA_AREA_PREFIX);
Location configuration = configLocationTracker.getService();
doAllTestLocationDataArea(configuration, "");
}
use of org.eclipse.osgi.service.datalocation.Location in project rt.equinox.framework by eclipse.
the class BasicLocationTests method testSchemes.
public void testSchemes() 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_USER_AREA, "http://example.com/a");
fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "ftp://example.com/c/d");
fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA, "platform:/base/e/f");
fwkConfig.put(EquinoxLocations.PROP_INSTALL_AREA, "file:" + prefix + "/g");
Equinox equinox = new Equinox(fwkConfig);
equinox.init();
try {
Map<String, Location> locations = getLocations(equinox);
checkSlashes(locations);
checkLocation(locations.get(Location.USER_FILTER), true, true, "http");
checkLocation(locations.get(Location.INSTANCE_FILTER), true, true, "ftp");
checkLocation(locations.get(Location.CONFIGURATION_FILTER), true, true, "platform");
checkLocation(locations.get(Location.INSTALL_FILTER), true, true, "file");
} finally {
equinox.stop();
}
}
use of org.eclipse.osgi.service.datalocation.Location in project rt.equinox.framework by eclipse.
the class BasicLocationTests method testUserDir.
public void testUserDir() throws Exception {
Map<String, String> fwkConfig = new HashMap<String, String>();
fwkConfig.put(EquinoxLocations.PROP_USER_AREA, "@user.dir");
fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA + EquinoxLocations.READ_ONLY_AREA_SUFFIX, "true");
fwkConfig.put(EquinoxLocations.PROP_INSTANCE_AREA, "@user.dir");
fwkConfig.put(EquinoxLocations.PROP_CONFIG_AREA, "@user.dir");
fwkConfig.put(EquinoxLocations.PROP_INSTALL_AREA, "file:" + prefix + "/g");
Equinox equinox = new Equinox(fwkConfig);
equinox.init();
try {
Map<String, Location> locations = getLocations(equinox);
checkLocation(locations.get(Location.USER_FILTER), true, true, "file");
checkLocation(locations.get(Location.INSTANCE_FILTER), true, true, "file");
checkLocation(locations.get(Location.CONFIGURATION_FILTER), true, true, "file");
checkLocation(locations.get(Location.INSTALL_FILTER), true, true, "file");
} finally {
equinox.stop();
}
}
use of org.eclipse.osgi.service.datalocation.Location in project rt.equinox.framework by eclipse.
the class BasicLocationTests method testCreateLocation02.
public void testCreateLocation02() {
Location configLocation = configLocationTracker.getService();
File testLocationFile = OSGiTestsActivator.getContext().getDataFile("testLocations/testCreateLocation02");
Location testLocation = configLocation.createLocation(null, null, true);
try {
testLocation.set(testLocationFile.toURL(), false);
} catch (Throwable t) {
fail("Failed to set location", t);
}
try {
assertTrue("Could not lock location", testLocation.lock());
testLocation.release();
fail("Should not be able to lock read-only location");
} catch (IOException e) {
// expected
}
}
use of org.eclipse.osgi.service.datalocation.Location in project rt.equinox.framework by eclipse.
the class BasicLocationTests method testCreateLocation05.
public void testCreateLocation05() {
Location configLocation = configLocationTracker.getService();
File testLocationFile = OSGiTestsActivator.getContext().getDataFile("testLocations/testCreateLocation01");
Location testLocation = configLocation.createLocation(null, null, false);
try {
testLocation.set(testLocationFile.toURL(), false);
} catch (Throwable t) {
fail("Failed to set location", t);
}
try {
assertTrue("Could not lock location", testLocation.lock());
assertFalse("Could lock a secend time", testLocation.lock());
assertFalse("Could lock a third time", testLocation.lock());
} catch (IOException e) {
fail("Failed to lock location", e);
} finally {
testLocation.release();
}
try {
assertTrue("Could not lock location", testLocation.lock());
} catch (IOException e) {
fail("Failed to lock location", e);
} finally {
testLocation.release();
}
}
Aggregations