use of java.util.Dictionary in project sling by apache.
the class DataSourceIT method testDataSourceAsService.
@SuppressWarnings("unchecked")
@Test
public void testDataSourceAsService() throws Exception {
Configuration config = ca.createFactoryConfiguration(PID, null);
Dictionary<String, Object> p = new Hashtable<String, Object>();
p.put("url", "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
p.put("datasource.name", "test");
p.put("initialSize", "5");
p.put("defaultAutoCommit", "default");
p.put("defaultReadOnly", "false");
p.put("datasource.svc.properties", new String[] { "initSQL=SELECT 1" });
p.put("maxActive", 70);
config.update(p);
Filter filter = context.createFilter("(&(objectclass=javax.sql.DataSource)(datasource.name=test))");
ServiceTracker<DataSource, DataSource> st = new ServiceTracker<DataSource, DataSource>(context, filter, null);
st.open();
DataSource ds = st.waitForService(10000);
assertNotNull(ds);
Connection conn = ds.getConnection();
assertNotNull(conn);
//Cannot access directly so access via reflection
assertEquals("70", getProperty(ds, "poolProperties.maxActive"));
assertEquals("5", getProperty(ds, "poolProperties.initialSize"));
assertEquals("SELECT 1", getProperty(ds, "poolProperties.initSQL"));
assertEquals("false", getProperty(ds, "poolProperties.defaultReadOnly"));
assertNull(getProperty(ds, "poolProperties.defaultAutoCommit"));
config = ca.listConfigurations("(datasource.name=test)")[0];
Dictionary dic = config.getProperties();
dic.put("defaultReadOnly", Boolean.TRUE);
config.update(dic);
TimeUnit.MILLISECONDS.sleep(100);
assertEquals("true", getProperty(ds, "poolProperties.defaultReadOnly"));
}
use of java.util.Dictionary in project opennms by OpenNMS.
the class EchoRpcThreadIT method addServicesOnStartup.
@SuppressWarnings("rawtypes")
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
services.put(MinionIdentity.class.getName(), new KeyValueHolder<Object, Dictionary>(new MockMinionIdentity(REMOTE_LOCATION_NAME), new Properties()));
Properties props = new Properties();
props.setProperty("alias", "opennms.broker");
services.put(Component.class.getName(), new KeyValueHolder<Object, Dictionary>(queuingservice, props));
services.put(RpcModule.class.getName(), new KeyValueHolder<Object, Dictionary>(lockingRpcModule, new Properties()));
}
use of java.util.Dictionary in project rt.equinox.framework by eclipse.
the class StateResolverTest method testNativeCodeResolution01.
public void testNativeCodeResolution01() throws BundleException {
State state = buildEmptyState();
Dictionary[] props = new Dictionary[] { new Hashtable() };
// $NON-NLS-1$ //$NON-NLS-2$
props[0].put("osgi.ws", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[0].put("osgi.os", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[0].put("osgi.arch", "x86");
// $NON-NLS-1$ //$NON-NLS-2$
props[0].put("osgi.nl", "en_US");
state.setPlatformProperties(props);
Hashtable manifest = new Hashtable();
long bundleID = 0;
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=Windows2000;osname=\"Windows 2003\";osname=Windows95;osname=Windows98;osname=WindowsNT;osname=WindowsXP;osname=\"Windows NT (unknown)\";osname=\"Windows Vista\"; language=en");
// $NON-NLS-1$
BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++);
state.addBundle(testNativeBundle);
state.resolve();
// $NON-NLS-1$
assertTrue("1.0", testNativeBundle.isResolved());
}
use of java.util.Dictionary in project rt.equinox.framework by eclipse.
the class StateResolverTest method testNativeCodeResolution05.
public void testNativeCodeResolution05() throws BundleException {
State state = buildEmptyState();
Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable(), new Hashtable() };
// $NON-NLS-1$ //$NON-NLS-2$
props[0].put("osgi.ws", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[0].put("osgi.os", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[0].put("osgi.arch", "x86");
// $NON-NLS-1$ //$NON-NLS-2$
props[0].put("osgi.nl", "en_US");
// $NON-NLS-1$ //$NON-NLS-2$
props[1].put("osgi.ws", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[1].put("osgi.os", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[1].put("osgi.arch", "x86_64");
// $NON-NLS-1$ //$NON-NLS-2$
props[1].put("osgi.nl", "en_US");
// $NON-NLS-1$ //$NON-NLS-2$
props[2].put("osgi.ws", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[2].put("osgi.os", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[2].put("osgi.arch", "x86");
// $NON-NLS-1$ //$NON-NLS-2$
props[2].put("osgi.nl", "fr_FR");
state.setPlatformProperties(props);
Hashtable manifest = new Hashtable();
long bundleID = 0;
manifest.clear();
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle1");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32; language=en");
// $NON-NLS-1$
BundleDescription testNativeBundle1 = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++);
manifest.clear();
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86_64;osname=win32; language=en");
// $NON-NLS-1$
BundleDescription testNativeBundle2 = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++);
manifest.clear();
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle3");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32; language=fr");
// $NON-NLS-1$
BundleDescription testNativeBundle3 = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++);
state.addBundle(testNativeBundle1);
state.addBundle(testNativeBundle2);
state.addBundle(testNativeBundle3);
state.resolve();
// $NON-NLS-1$
assertTrue("1.0", testNativeBundle1.isResolved());
// $NON-NLS-1$
assertTrue("2.0", testNativeBundle2.isResolved());
// $NON-NLS-1$
assertTrue("3.0", testNativeBundle3.isResolved());
}
use of java.util.Dictionary in project rt.equinox.framework by eclipse.
the class StateResolverTest method testNativeCodeResolution06.
public void testNativeCodeResolution06() throws BundleException {
State state = buildEmptyState();
Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable(), new Hashtable() };
// empty props[0]
// $NON-NLS-1$ //$NON-NLS-2$
props[1].put("osgi.ws", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[1].put("osgi.os", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[1].put("osgi.arch", "x86_64");
// $NON-NLS-1$ //$NON-NLS-2$
props[2].put("osgi.ws", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[2].put("osgi.os", "win32");
// $NON-NLS-1$ //$NON-NLS-2$
props[2].put("osgi.arch", "x86");
state.setPlatformProperties(props);
Hashtable manifest = new Hashtable();
long bundleID = 0;
manifest.clear();
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle1");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32");
// $NON-NLS-1$
BundleDescription testNativeBundle1 = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++);
state.addBundle(testNativeBundle1);
state.resolve();
// $NON-NLS-1$
assertTrue("1.0", testNativeBundle1.isResolved());
}
Aggregations