Search in sources :

Example 21 with ContextKey

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);
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Test(org.junit.Test)

Example 22 with ContextKey

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);
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Test(org.junit.Test)

Example 23 with ContextKey

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());
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Test(org.junit.Test)

Example 24 with ContextKey

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")));
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Test(org.junit.Test)

Example 25 with ContextKey

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());
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Resource(org.springframework.core.io.Resource) Test(org.junit.Test)

Aggregations

ContextKey (org.jaffa.loader.ContextKey)49 Test (org.junit.Test)21 ComponentDefinition (org.jaffa.presentation.portlet.component.ComponentDefinition)6 Component (org.jaffa.presentation.portlet.component.componentdomain.Component)5 TransactionInfo (org.jaffa.transaction.services.configdomain.TransactionInfo)5 TypeInfo (org.jaffa.transaction.services.configdomain.TypeInfo)5 Properties (java.util.Properties)4 Task (org.jaffa.modules.scheduler.services.configdomain.Task)4 GlobalMenu (org.jaffa.components.navigation.domain.GlobalMenu)3 BusinessFunction (org.jaffa.security.businessfunctionsdomain.BusinessFunction)3 Role (org.jaffa.security.securityrolesdomain.Role)3 Config (org.jaffa.transaction.services.configdomain.Config)3 InputStream (java.io.InputStream)2 Config (org.jaffa.modules.messaging.services.configdomain.Config)2 JmsConfig (org.jaffa.modules.messaging.services.configdomain.JmsConfig)2 JndiConfig (org.jaffa.modules.messaging.services.configdomain.JndiConfig)2 Config (org.jaffa.modules.scheduler.services.configdomain.Config)2 Components (org.jaffa.presentation.portlet.component.componentdomain.Components)2 BusinessFunctions (org.jaffa.security.businessfunctionsdomain.BusinessFunctions)2 Roles (org.jaffa.security.securityrolesdomain.Roles)2