use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class MessagingManagerTest method testRegisterMessageInfo.
/**
* Tests registration of MessageInfo objects
* @throws Exception
*/
@Test
public void testRegisterMessageInfo() throws Exception {
MessageInfo info = new MessageInfo();
String queueName = "q1";
info.setQueueName(queueName);
ContextKey contextKey = new ContextKey(queueName, "jaffa-messaging-config.xml", VariationContext.NULL_VARIATION, "0-PLATFORM");
messagingManager.registerMessageInfo(contextKey, info);
MessageInfo retrievedInfo = messagingManager.getMessageInfo(queueName);
Assert.assertEquals(info, retrievedInfo);
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class MessagingManagerTest method testGetQueueNames.
/**
* Test that registering QueueInfo objects has the expected results
* when requesting all queue names
* @throws Exception
*/
@Test
public void testGetQueueNames() throws Exception {
String[] queueNames = messagingManager.getQueueNames();
assertEquals(0, queueNames.length);
QueueInfo info = new QueueInfo();
String queueName = "q1";
info.setName(queueName);
ContextKey contextKey1 = new ContextKey(queueName, "jaffa-messaging-config.xml", VariationContext.NULL_VARIATION, "0-PLATFORM");
messagingManager.registerQueueInfo(contextKey1, info);
queueNames = messagingManager.getQueueNames();
assertEquals(1, queueNames.length);
QueueInfo info2 = new QueueInfo();
String queueName2 = "q2";
info2.setName(queueName2);
ContextKey contextKey2 = new ContextKey(queueName2, "jaffa-messaging-config.xml", VariationContext.NULL_VARIATION, "0-PLATFORM");
messagingManager.registerQueueInfo(contextKey2, info2);
queueNames = messagingManager.getQueueNames();
assertEquals(2, queueNames.length);
messagingManager.unregisterQueueInfo(contextKey1);
queueNames = messagingManager.getQueueNames();
assertEquals(1, queueNames.length);
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class MessagingManagerTest method testRegisterMessageFilter.
/**
* Tests registration of MessageFilter objects
* @throws Exception
*/
@Test
public void testRegisterMessageFilter() throws Exception {
MessageFilter info = new MessageFilter();
String name = "q1";
info.setFilterName(name);
ContextKey contextKey = new ContextKey(name, "jaffa-messaging-config.xml", VariationContext.NULL_VARIATION, "0-PLATFORM");
messagingManager.registerMessageFilter(contextKey, info);
List<MessageFilter> filters = messagingManager.getMessageFilters();
assertEquals(1, filters.size());
MessageFilter filter1 = filters.get(0);
assertEquals(name, filter1.getFilterName());
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class TransactionManagerTest method testUnRegisterTransactionInfo.
/**
* tests the unregisterTransactionInfo
*/
@Test
public void testUnRegisterTransactionInfo() {
// test
transactionManager.unregisterTransactionInfo(new ContextKey("testBean", null, "DEF", "cust-code"));
// verify
verify(transactionRepoMock).unregister(eq(new ContextKey("testBean", null, "DEF", "cust-code")));
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class TransactionManagerTest method testRegisterXml.
/**
* tests the registerXml
*/
@Test
public void testRegisterXml() throws Exception {
Resource resource = pathMatchingResourcePatternResolver.getResource("classpath:META-INF/jaffa-transaction-config.xml");
// test
transactionManager.registerResource(resource, "cust-code", "DEF");
// verify
verify(transactionRepoMock).register(eq(new ContextKey("org.jaffa.soa.services.SOAEventPoller", null, "DEF", "cust-code")), Matchers.anyObject());
verify(transactionRepoMock).register(eq(new ContextKey("org.jaffa.soa.services.SOAEventQueueMessage", null, "DEF", "cust-code")), Matchers.anyObject());
verify(transactionRepoMock).register(eq(new ContextKey("org.jaffa.transaction.services.TransactionDependencySweeper", null, "DEF", "cust-code")), Matchers.anyObject());
verify(transactionRepoMock).register(eq(new ContextKey("org.jaffa.transaction.tester.TestMessage", null, "DEF", "cust-code")), Matchers.anyObject());
verify(transactionRepoMock).register(eq(new ContextKey("org.jaffa.transaction.tester.TestMessageSingleton", null, "DEF", "cust-code")), Matchers.anyObject());
verify(typeInfoRepoMock).register(eq(new ContextKey("Internal", null, "DEF", "cust-code")), Matchers.anyObject());
verify(typeInfoRepoMock).register(eq(new ContextKey("Poller", null, "DEF", "cust-code")), Matchers.anyObject());
verify(typeInfoRepoMock).register(eq(new ContextKey("Event", null, "DEF", "cust-code")), Matchers.anyObject());
verify(typeInfoRepoMock).register(eq(new ContextKey("Locks", null, "DEF", "cust-code")), Matchers.anyObject());
verify(typeInfoRepoMock).register(eq(new ContextKey("TransactionSingleton", null, "DEF", "cust-code")), Matchers.anyObject());
}
Aggregations