use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class NavigationXmlLoadTest method testNavigationRegistration.
/**
* testNavigationRegistration - Verifies that the navigation.xml has been loaded correctly into the NavigationManager.
*/
@Test
public void testNavigationRegistration() {
NavigationManager navigationManager = xmlLoaderConfig.getBean(NavigationManager.class);
ContextKey key = new ContextKey("CONTRACTOR", "roles.xml", "DEF", "100-Highest");
assertNull(navigationManager.getNavigationRepository().query(key));
GlobalMenu globalMenu = new GlobalMenu();
MenuOption menuOption = new MenuOption();
menuOption.setLabel("Label 1");
globalMenu.getMenuOption().add(menuOption);
navigationManager.registerGlobalMenu(key, globalMenu);
assertNotNull(navigationManager.getNavigationRepository().query(key));
navigationManager.unregisterGlobalMenu(key);
assertNull(navigationManager.getNavigationRepository().query(key));
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class MessagingManagerTest method testCheckForQueueAndTopicNamingConflictsNoConflict.
/**
* Test that no conflict is reported when no topics and queues have
* identical names.
* @throws Exception
*/
@Test
public void testCheckForQueueAndTopicNamingConflictsNoConflict() throws Exception {
String[] queueNames = messagingManager.getQueueNames();
assertEquals(0, queueNames.length);
QueueInfo qInfo = new QueueInfo();
String queueName = "q1";
qInfo.setName(queueName);
ContextKey contextKey = new ContextKey(queueName, "jaffa-messaging-config.xml", VariationContext.NULL_VARIATION, "0-PLATFORM");
messagingManager.registerQueueInfo(contextKey, qInfo);
queueNames = messagingManager.getQueueNames();
assertEquals(1, queueNames.length);
String[] topicNames = messagingManager.getTopicNames();
assertEquals(0, topicNames.length);
TopicInfo topicInfo = new TopicInfo();
String topicName = "t1";
topicInfo.setName(topicName);
contextKey = new ContextKey(topicName, "jaffa-messaging-config.xml", VariationContext.NULL_VARIATION, "0-PLATFORM");
messagingManager.registerTopicInfo(contextKey, topicInfo);
topicNames = messagingManager.getTopicNames();
assertEquals(1, topicNames.length);
messagingManager.checkForQueueAndTopicNamingConflicts();
// an exception would be thrown if there were identical names
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class TransactionManagerTest method testRegisterTypeInfo.
/**
* tests the registerTypeInfo
*/
@Test
public void testRegisterTypeInfo() {
// initialize
TypeInfo typeInfo = new TypeInfo();
typeInfo.setName("typeInfoName");
ContextKey key = new ContextKey("typeInfoName", null, "DEF", "cust-code");
// test
transactionManager.registerTypeInfo(key, typeInfo);
// verify
verify(typeInfoRepoMock).register(eq(key), Matchers.anyObject());
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class JndiJmsManager method registerResource.
/**
* Unmarshall the contents of the configuration to create and register
* JmsConfig objects.
* @param resource the object that contains the xml config file.
* @param context key with which config file to be registered.
* @param variation key with which config file to be registered.
* @throws JAXBException
* @throws SAXException
* @throws IOException
*/
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
JndiConfig config = JAXBHelper.unmarshalConfigFile(JndiConfig.class, resource, JMS_JNDI_CONFIGURATION_SCHEMA_FILE);
JmsConfig jmsConfig = config.getJmsConfig();
populateJmsConfig(jmsConfig);
ContextKey contextKey = new ContextKey(jmsConfig.getUser(), resource.getURI().toString(), variation, context);
jmsRepository.register(contextKey, jmsConfig);
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class JndiJmsManager method unregisterResource.
/**
* Unregister the JmsConfig objects defined by a particular resource.
* @param resource the object that contains the xml config file.
* @param context key with which config file to be registered.
* @param variation key with which config file to be registered.
* @throws JAXBException
* @throws SAXException
* @throws IOException
*/
@Override
public void unregisterResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
JndiConfig config = JAXBHelper.unmarshalConfigFile(JndiConfig.class, resource, JMS_JNDI_CONFIGURATION_SCHEMA_FILE);
JmsConfig jmsConfig = config.getJmsConfig();
ContextKey contextKey = new ContextKey(jmsConfig.getUser(), resource.getURI().toString(), variation, context);
jmsRepository.unregister(contextKey);
}
Aggregations