use of org.motechproject.osgi.web.ModuleRegistrationData in project motech by motech.
the class UIFrameworkServiceImplTest method shouldSetAndUnsetAttentionNeededFlag.
@Test
public void shouldSetAndUnsetAttentionNeededFlag() {
UIFrameworkServiceImpl uiFrameworkService = new UIFrameworkServiceImpl();
ModuleRegistrationData testModule = new ModuleRegistrationData("test-module", "http://goo.gl");
uiFrameworkService.registerModule(testModule);
uiFrameworkService.moduleNeedsAttention("test-module", "test msg");
Assert.assertTrue(uiFrameworkService.getModuleData("test-module").isNeedsAttention());
Assert.assertEquals(uiFrameworkService.getModuleData("test-module").getCriticalMessage(), "test msg");
uiFrameworkService.moduleBackToNormal("test-module");
Assert.assertFalse(uiFrameworkService.getModuleData("test-module").isNeedsAttention());
Assert.assertTrue(StringUtils.isBlank(uiFrameworkService.getModuleData("test-module").getCriticalMessage()));
}
use of org.motechproject.osgi.web.ModuleRegistrationData in project motech by motech.
the class UIFrameworkServiceImplTest method moduleRegistration.
private ModuleRegistrationData moduleRegistration() {
ModuleRegistrationData registration = new ModuleRegistrationData();
registration.setModuleName("demo");
registration.setUrl("url");
return registration;
}
use of org.motechproject.osgi.web.ModuleRegistrationData in project motech by motech.
the class UIFrameworkServiceImplTest method shouldCheckIfModuleRegistered.
@Test
public void shouldCheckIfModuleRegistered() {
UIFrameworkServiceImpl uiFrameworkService = new UIFrameworkServiceImpl();
ModuleRegistrationData testModule = new ModuleRegistrationData("test-module", "http://goo.gl");
assertFalse(uiFrameworkService.isModuleRegistered("test-module"));
uiFrameworkService.registerModule(testModule);
Assert.assertTrue(uiFrameworkService.isModuleRegistered("test-module"));
}
use of org.motechproject.osgi.web.ModuleRegistrationData in project motech by motech.
the class ModuleAdminServiceImpl method getBundles.
@Override
public List<BundleInformation> getBundles() {
List<BundleInformation> bundles = new ArrayList<>();
List<Bundle> motechBundles = motechBundleFilter.filter(bundleContext.getBundles());
for (Bundle bundle : motechBundles) {
BundleInformation bundleInformation = new BundleInformation(bundle);
ModuleRegistrationData moduleRegistrationData = uiFrameworkService.getModuleDataByBundle(bundle);
if (moduleRegistrationData != null) {
bundleInformation.setSettingsURL(moduleRegistrationData.getSettingsURL());
bundleInformation.setModuleName(moduleRegistrationData.getModuleName());
List<String> angularModules = moduleRegistrationData.getAngularModules();
String angularModuleName = isEmpty(angularModules) ? moduleRegistrationData.getModuleName() : angularModules.get(0);
bundleInformation.setAngularModule(angularModuleName);
}
bundles.add(bundleInformation);
}
return bundles;
}
use of org.motechproject.osgi.web.ModuleRegistrationData in project motech by motech.
the class Activator method serviceAdded.
/**
* Sets Web Security for added service
*
* @param service that was added
*/
private void serviceAdded(UIFrameworkService service) {
ModuleRegistrationData regData = new ModuleRegistrationData();
regData.setModuleName(MODULE_NAME);
regData.setUrl("../websecurity/index.html");
regData.addAngularModule("webSecurity");
regData.addSubMenu("/webSecurity/users", "security.manageUsers", PermissionNames.MANAGE_USER_PERMISSION);
regData.addSubMenu("/webSecurity/roles", "security.manageRoles", PermissionNames.MANAGE_ROLE_AND_PERMISSION_PERMISSION);
regData.addSubMenu("/webSecurity/permissions", "security.managePermissions", PermissionNames.MANAGE_ROLE_AND_PERMISSION_PERMISSION);
regData.addSubMenu("/webSecurity/dynamicURL", "security.manageURL", PermissionNames.MANAGE_URL_PERMISSION);
regData.addI18N("messages", "../websecurity/messages/");
regData.setBundle(bundleContext.getBundle());
regData.setResourcePath(RESOURCE_URL_PATH);
service.registerModule(regData);
LOGGER.debug("Web Security registered in UI framework");
}
Aggregations