use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class XmlRuleValidatorTest method testSetNamespaceContext.
@Test
public void testSetNamespaceContext() {
XmlRuleValidator obj = new XmlRuleValidator();
assertNull(obj.getNamespaceContext());
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("hello", "world"));
obj.setNamespaceContext(kvps);
assertEquals(kvps, obj.getNamespaceContext());
obj.setNamespaceContext(null);
assertNull(obj.getNamespaceContext());
}
use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class XmlValidationServiceTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
ValidationStage vs = new ValidationStage();
vs.setIterationXpath("/document/names");
vs.setElementXpath("fullName");
vs.addRule(new NotNullContentValidation());
KeyValuePair disableExternalEntities = new KeyValuePair("http://xml.org/sax/features/external-general-entities", "false");
KeyValuePair disableDoctypeDecl = new KeyValuePair("http://apache.org/xml/features/disallow-doctype-decl", "true");
return new XmlValidationService(new XmlBasicValidator(new DocumentBuilderFactoryBuilder().withNamespaceAware(true).withFeatures(new KeyValuePairSet(Arrays.asList(disableExternalEntities, disableDoctypeDecl)))), new BasicXmlSchemaValidator().withSchema("http://host/schema.xsd or %message{metadatKey}"), new XmlRuleValidator(vs));
}
use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class PooledConnectionHelper method createAdvancedPooledConnection.
public static AdvancedJdbcPooledConnection createAdvancedPooledConnection(String driver, String url, int poolsize) {
AdvancedJdbcPooledConnection conn = new AdvancedJdbcPooledConnection();
conn.setConnectUrl(url);
conn.setDriverImp(driver);
KeyValuePairSet poolProps = new KeyValuePairSet();
poolProps.add(new KeyValuePair(PooledConnectionProperties.maxPoolSize.name(), Integer.toString(poolsize)));
poolProps.add(new KeyValuePair(PooledConnectionProperties.minPoolSize.name(), Integer.toString(poolsize)));
poolProps.add(new KeyValuePair(PooledConnectionProperties.maxIdleTime.name(), Long.toString(DEFAULT_IDLE_TIME.toMilliseconds())));
poolProps.add(new KeyValuePair(PooledConnectionProperties.idleConnectionTestPeriod.name(), Long.toString(DEFAULT_IDLE_CONNECTION_TEST.toMilliseconds())));
poolProps.add(new KeyValuePair(PooledConnectionProperties.checkoutTimeout.name(), Long.toString(DEFAULT_ACQUIRE_WAIT.toMilliseconds())));
conn.setConnectionAttempts(1);
conn.setConnectionPoolProperties(poolProps);
conn.setConnectionRetryInterval(DEFAULT_RETRY_WAIT);
return conn;
}
use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class PooledConnectionPropertiesTest method testApply.
@Test
public void testApply() throws Exception {
String url = "jdbc:derby:memory:" + GUID.safeUUID() + ";create=true";
String driver = "org.apache.derby.jdbc.EmbeddedDriver";
KeyValuePairSet props = new KeyValuePairSet();
for (PooledConnectionProperties p : PooledConnectionProperties.values()) {
props.add(new KeyValuePair(p.name(), DUMMY_VALUES.get(p.propertyType()).value()));
}
props.add(new KeyValuePair("hello", "world"));
ComboPooledDataSource ds = new ComboPooledDataSource();
PooledConnectionProperties.apply(null, ds);
PooledConnectionProperties.apply(props, ds);
assertEquals(10, ds.getAcquireIncrement());
}
use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class AdvancedJdbcPooledConnectionTest method configure.
@Override
protected AdvancedJdbcPooledConnection configure(AdvancedJdbcPooledConnection conn1) throws Exception {
String url = initialiseDatabase();
conn1.setConnectUrl(url);
conn1.setDriverImp(DRIVER_IMP);
conn1.setConnectionAttempts(1);
conn1.setConnectionRetryInterval(new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
KeyValuePairSet poolProps = new KeyValuePairSet();
poolProps.add(new KeyValuePair(PooledConnectionProperties.acquireIncrement.name(), "5"));
poolProps.add(new KeyValuePair(PooledConnectionProperties.minPoolSize.name(), "10"));
poolProps.add(new KeyValuePair(PooledConnectionProperties.maxPoolSize.name(), "50"));
conn1.setConnectionPoolProperties(poolProps);
return conn1;
}
Aggregations