use of javax.naming.Reference in project rabbitmq-jms-client by rabbitmq.
the class RMQConnectionFactoryTest method testDefaultConnectionFactoryReference.
@Test
public void testDefaultConnectionFactoryReference() throws Exception {
RMQConnectionFactory connFactory = new RMQConnectionFactory();
Reference ref = connFactory.getReference();
assertEquals(defaultProps, getProps(ref), "Not the default properties");
}
use of javax.naming.Reference in project rabbitmq-jms-client by rabbitmq.
the class RMQConnectionFactoryTest method testConnectionFactoryRegeneration.
@Test
public void testConnectionFactoryRegeneration() throws Exception {
RMQConnectionFactory connFactory = new RMQConnectionFactory();
connFactory.setHost("sillyHost");
connFactory.setPassword("my-password");
connFactory.setPort(42);
connFactory.setQueueBrowserReadMax(52);
connFactory.setSsl(true);
connFactory.setTerminationTimeout(1234567890123456789L);
connFactory.setUsername("fred");
connFactory.setVirtualHost("bill");
Reference ref = connFactory.getReference();
RMQConnectionFactory newFactory = (RMQConnectionFactory) new RMQObjectFactory().createConnectionFactory(ref, new Hashtable<Object, Object>(), new CompositeName("newOne"));
assertEquals("amqps://fred:my-password@sillyHost:42/bill", newFactory.getUri(), "Not the correct uri");
assertEquals("sillyHost", newFactory.getHost(), "Not the correct host");
assertEquals("my-password", newFactory.getPassword(), "Not the correct password");
assertEquals(42, newFactory.getPort(), "Not the correct port");
assertEquals(52, newFactory.getQueueBrowserReadMax(), "Not the correct queueBrowserReadMax");
assertEquals(true, newFactory.isSsl(), "Not the correct ssl");
assertEquals(15000L, newFactory.getTerminationTimeout(), "Not the correct terminationTimeout");
assertEquals("fred", newFactory.getUsername(), "Not the correct username");
assertEquals("bill", newFactory.getVirtualHost(), "Not the correct virtualHost");
}
use of javax.naming.Reference in project rabbitmq-jms-client by rabbitmq.
the class RMQConnectionFactoryTest method testConnectionFactoryReferenceUpdated.
@Test
public void testConnectionFactoryReferenceUpdated() throws Exception {
RMQConnectionFactory connFactory = new RMQConnectionFactory();
connFactory.setQueueBrowserReadMax(52);
Reference ref = connFactory.getReference();
addStringRefProperty(ref, "host", "sillyHost");
addStringRefProperty(ref, "password", "my-password");
addStringRefProperty(ref, "port", "42");
// duplicates don't overwrite
addStringRefProperty(ref, "queueBrowserReadMax", "52");
addStringRefProperty(ref, "onMessageTimeoutMs", "62");
addStringRefProperty(ref, "ssl", "true");
addStringRefProperty(ref, "terminationTimeout", "1234567890123456789");
addStringRefProperty(ref, "username", "fred");
addStringRefProperty(ref, "virtualHost", "bill");
RMQConnectionFactory newFactory = (RMQConnectionFactory) new RMQObjectFactory().createConnectionFactory(ref, new Hashtable<Object, Object>(), new CompositeName("newOne"));
assertEquals("sillyHost", newFactory.getHost(), "Not the correct host");
assertEquals("my-password", newFactory.getPassword(), "Not the correct password");
assertEquals(42, newFactory.getPort(), "Not the correct port");
assertEquals(52, newFactory.getQueueBrowserReadMax(), "Not the correct queueBrowserReadMax");
assertEquals(62, newFactory.getOnMessageTimeoutMs(), "Not the correct onMessageTimeoutMs");
assertEquals(true, newFactory.isSsl(), "Not the correct ssl");
assertEquals(1234567890123456789L, newFactory.getTerminationTimeout(), "Not the correct terminationTimeout");
assertEquals("fred", newFactory.getUsername(), "Not the correct username");
assertEquals("bill", newFactory.getVirtualHost(), "Not the correct virtualHost");
assertEquals("amqps://fred:my-password@sillyHost:42/bill", newFactory.getUri());
}
use of javax.naming.Reference in project mssql-jdbc by Microsoft.
the class SQLServerDataSource method getReference.
// Implement javax.naming.Referenceable interface methods.
public Reference getReference() {
loggerExternal.entering(getClassNameLogging(), "getReference");
Reference ref = getReferenceInternal("com.microsoft.sqlserver.jdbc.SQLServerDataSource");
loggerExternal.exiting(getClassNameLogging(), "getReference", ref);
return ref;
}
use of javax.naming.Reference in project h2database by h2database.
the class JdbcDataSource method getReference.
/**
* Get a new reference for this object, using the current settings.
*
* @return the new reference
*/
@Override
public Reference getReference() {
debugCodeCall("getReference");
String factoryClassName = JdbcDataSourceFactory.class.getName();
Reference ref = new Reference(getClass().getName(), factoryClassName, null);
ref.add(new StringRefAddr("url", url));
ref.add(new StringRefAddr("user", userName));
ref.add(new StringRefAddr("password", convertToString(passwordChars)));
ref.add(new StringRefAddr("loginTimeout", String.valueOf(loginTimeout)));
ref.add(new StringRefAddr("description", description));
return ref;
}
Aggregations