use of org.jaffa.loader.config.ApplicationRulesManager in project jaffa-framework by jaffa-projects.
the class CoreLoaderConfig method applicationRulesManager.
/**
* @return Returns a ApplicationRulesManager
*/
@Bean
public ApplicationRulesManager applicationRulesManager() {
ApplicationRulesManager applicationRulesManager = new ApplicationRulesManager();
ContextManager.setApplicationRulesManager(applicationRulesManager);
return applicationRulesManager;
}
use of org.jaffa.loader.config.ApplicationRulesManager in project jaffa-framework by jaffa-projects.
the class ContextManagerTest method testContextManager.
/**
* testContextManager - Verifies that the application rules have been loaded correctly for both global and variation
* specific rules files.
*
* @throws Exception
*/
@Test
public void testContextManager() throws Exception {
ApplicationRulesManager applicationRulesManager = xmlLoaderConfig.getBean(ApplicationRulesManager.class);
assertNotNull(applicationRulesManager.getApplicationRulesRepository());
MockHttpServletRequest request = new MockHttpServletRequest();
// creating user session
UserSession us = UserSession.getUserSession(request);
us.setUserId(USER);
us.setVariation(VARIATION);
// creating mock http session for the same use session
MockHttpSession session = new MockHttpSession();
session.setAttribute(USER_ATTRIBUTE, us);
// setting the mock session into request
request.setSession(session);
ContextManagerFactory.instance().setThreadContext(request);
// Property from global
IContextManager iContextManager = ContextManagerFactory.instance();
assertNotNull(iContextManager.getProperty("org.jaffa.config.global"));
assertNull(iContextManager.getProperty("nonExistentKey"));
// Property from variation
assertNotNull(iContextManager.getProperty("org.jaffa.config.variation"));
// Property from variation
assertEquals("true", iContextManager.getProperty("org.jaffa.config.hidepanel"));
// Property from variation
assertEquals("true", iContextManager.getProperty("org.jaffa.config.hidemaintenancepanel"));
assertEquals("datadist_root/outbound", iContextManager.getProperty("datadist.outboundFolder"));
assertEquals("datadist_root/outbound/fragments", iContextManager.getProperty("datadist.outboundFolder.fragments"));
assertEquals("c:/test/interfaces_root/outbound/test", iContextManager.getProperty("interfaces.outboundTestFolder"));
assertEquals("http://pentaho_host.mypentaho.com:80967/pentaho", iContextManager.getProperty("pentaho.url"));
assertEquals("C:/apache-tomcat-8.5.16/server/Goldesp/conf/report-security.txt", iContextManager.getProperty("usersecurity.reportsecurity.securityFilterKeyFile"));
}
use of org.jaffa.loader.config.ApplicationRulesManager in project jaffa-framework by jaffa-projects.
the class RepositoryJsonServiceTest method setUp.
/**
* This setup function registers resources to each managed repository to produce correct retrieval results
* @throws Exception
*/
@Before
public void setUp() throws Exception {
managerRepositoryService = ManagerRepositoryService.getInstance();
repositoryJsonService = new RepositoryJsonService();
testKey = new ContextKey("testKey", "file1.xml", "NULL", "1-PRODUCT");
testManager = new SchedulerManager();
testTask = new Task();
// Must populate a repository element in order to retrieve data
testTask.setAutoCreateDataBean(true);
testTask.setDataBean("DataBeanTest");
testTask.setType("TestType");
testManager.registerSchedulerTask(testKey, testTask);
// Add managers to ManagerRepositoryService
managerRepositoryService.add("Task", testManager);
managerRepositoryService.add("ComponentManager", new ComponentManager());
managerRepositoryService.add("ApplicationRulesManager", new ApplicationRulesManager());
managerRepositoryService.add("NavigationManager", new NavigationManager());
managerRepositoryService.add("BusinessFunctionManager", new BusinessFunctionManager());
managerRepositoryService.add("RoleManager", new RoleManager());
managerRepositoryService.add("JndiJmsManager", new JndiJmsManager());
managerRepositoryService.add("MessagingManager", new MessagingManager());
managerRepositoryService.add("SoaEventManager", new SoaEventManager());
managerRepositoryService.add("TransactionManager", new TransactionManager());
}
Aggregations