use of org.jaffa.components.navigation.domain.GlobalMenu in project jaffa-framework by jaffa-projects.
the class NavigationXmlLoadTest method testXmlLoad.
/**
* Verifies that we can load the menus from the navigation.xml file into our navigation repository.
*/
@Test
public void testXmlLoad() {
NavigationManager navigationManager = xmlLoaderConfig.getBean(NavigationManager.class);
assertNotNull(navigationManager.getNavigationRepository());
GlobalMenu globalMenu = navigationManager.getNavigationRepository().getAllValues().get(0);
assertEquals(4, globalMenu.getMenuOption().size());
}
use of org.jaffa.components.navigation.domain.GlobalMenu in project jaffa-framework by jaffa-projects.
the class NavigationManager method unregisterResource.
/**
* unregisterXML - Unregisters the navigation global menu from the IRepository
* @param resource the object that contains the xml config file.
* @param precedence associated with the module based on its definition in manifest
* @param variation associated with the module based on its definition in manifest
* @throws JAXBException
* @throws SAXException
* @throws IOException
*/
@Override
public void unregisterResource(Resource resource, String precedence, String variation) throws JAXBException, SAXException, IOException {
GlobalMenu globalMenu = JAXBHelper.unmarshalConfigFile(GlobalMenu.class, resource, CONFIGURATION_SCHEMA_FILE);
if (globalMenu != null) {
ContextKey key = new ContextKey(GLOBAL_MENU_ID, resource.getURI().toString(), variation, precedence);
unregisterGlobalMenu(key);
}
}
use of org.jaffa.components.navigation.domain.GlobalMenu in project jaffa-framework by jaffa-projects.
the class NavigationManager method registerResource.
/**
* registerXML - Registers the navigation global menu into the IRepository
* @param resource the object that contains the xml config file.
* @param precedence associated with the module based on its definition in manifest
* @param variation associated with the module based on its definition in manifest
* @throws JAXBException
* @throws SAXException
* @throws IOException
*/
@Override
public void registerResource(Resource resource, String precedence, String variation) throws JAXBException, SAXException, IOException {
GlobalMenu globalMenu = JAXBHelper.unmarshalConfigFile(GlobalMenu.class, resource, CONFIGURATION_SCHEMA_FILE);
if (globalMenu != null) {
ContextKey key = new ContextKey(GLOBAL_MENU_ID, resource.getURI().toString(), variation, precedence);
registerGlobalMenu(key, globalMenu);
}
}
use of org.jaffa.components.navigation.domain.GlobalMenu 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));
}
Aggregations