use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-mirebalais by PIH.
the class CustomAppLoaderTest method shouldAddAppToHomePage.
@Test
public void shouldAddAppToHomePage() {
AppDescriptor app = CustomAppLoaderUtil.app("id", "label", "icon", "url", "privilege", objectNode("patientPageUrl", "patientPageUrl"));
CustomAppLoaderUtil.addToHomePage(app);
assertThat(app.getExtensions().size(), is(1));
assertThat(app.getExtensions().get(0).getId(), is("id.appLink"));
assertThat(app.getExtensions().get(0).getType(), is("link"));
assertThat(app.getExtensions().get(0).getLabel(), is("label"));
// we go through the app router now
assertThat(app.getExtensions().get(0).getUrl(), is("pihcore/router/appEntryRouter.page?app=id"));
assertThat(app.getExtensions().get(0).getIcon(), is("icon"));
assertThat(app.getExtensions().get(0).getRequiredPrivilege(), is("privilege"));
assertThat(app.getExtensions().get(0).getExtensionPointId(), is(CustomAppLoaderConstants.ExtensionPoints.HOME_PAGE));
assertThat(app.getConfig().get("patientPageUrl").getTextValue(), is("patientPageUrl"));
}
use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-mirebalais by PIH.
the class CustomAppLoaderTest method shouldCreateAppExtension.
@Test
public void shouldCreateAppExtension() {
AppDescriptor app = new AppDescriptor();
CustomAppLoaderUtil.appExtension(app, "id", "label", "icon", "type", "url", "requiredPrivilege", "require", 1, "extensionPoint");
assertThat(app.getExtensions().size(), is(1));
assertThat(app.getExtensions().get(0).getId(), is("id"));
assertThat(app.getExtensions().get(0).getExtensionPointId(), is("extensionPoint"));
assertThat(app.getExtensions().get(0).getType(), is("type"));
assertThat(app.getExtensions().get(0).getLabel(), is("label"));
assertThat(app.getExtensions().get(0).getUrl(), is("url"));
assertThat(app.getExtensions().get(0).getIcon(), is("icon"));
assertThat(app.getExtensions().get(0).getOrder(), is(1));
assertThat(app.getExtensions().get(0).getRequiredPrivilege(), is("requiredPrivilege"));
assertThat(app.getExtensions().get(0).getRequire(), is("require"));
}
use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-mirebalais by PIH.
the class CustomAppLoaderTest method shouldCreatePatientTemplateApp.
@Test
public void shouldCreatePatientTemplateApp() {
AppDescriptor app = CustomAppLoaderUtil.findPatientTemplateApp("id", "label", "icon", "privilege", "afterSelectedUrl", CustomAppLoaderUtil.arrayNode(CustomAppLoaderUtil.objectNode("label", "label1", "link", "link1"), CustomAppLoaderUtil.objectNode("label", "label2", "link", "link2")));
assertThat(app.getId(), is("id"));
assertThat(app.getLabel(), is("label"));
assertThat(app.getIcon(), is("icon"));
assertThat(app.getUrl(), is("coreapps/findpatient/findPatient.page?app=id"));
assertThat(app.getRequiredPrivilege(), is("privilege"));
assertThat(app.getConfig().get("afterSelectedUrl").getTextValue(), is("afterSelectedUrl"));
assertThat(app.getConfig().get("label").getTextValue(), is("label"));
assertThat(app.getConfig().get("heading").getTextValue(), is("label"));
assertThat(app.getConfig().get("showLastViewedPatients").getBooleanValue(), is(false));
assertThat(app.getConfig().get("breadcrumbs").get(0).get("label").getTextValue(), is("label1"));
assertThat(app.getConfig().get("breadcrumbs").get(0).get("link").getTextValue(), is("link1"));
assertThat(app.getConfig().get("breadcrumbs").get(1).get("label").getTextValue(), is("label2"));
assertThat(app.getConfig().get("breadcrumbs").get(1).get("link").getTextValue(), is("link2"));
}
use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-mirebalais by PIH.
the class CustomAppLoaderTest method shouldCreateApp.
@Test
public void shouldCreateApp() {
AppDescriptor app = CustomAppLoaderUtil.app("id", "label", "icon", "url", "privilege", objectNode("patientPageUrl", "patientPageUrl"));
assertThat(app.getId(), is("id"));
assertThat(app.getLabel(), is("label"));
assertThat(app.getIcon(), is("icon"));
assertThat(app.getUrl(), is("url"));
assertThat(app.getRequiredPrivilege(), is("privilege"));
assertThat(app.getConfig().get("patientPageUrl").getTextValue(), is("patientPageUrl"));
}
use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-mirebalais by PIH.
the class CustomAppLoaderTest method shouldAddAppToSystemAdministrationPage.
@Test
public void shouldAddAppToSystemAdministrationPage() {
AppDescriptor app = CustomAppLoaderUtil.app("id", "label", "icon", "url", "privilege", null);
CustomAppLoaderUtil.addToSystemAdministrationPage(app);
assertThat(app.getExtensions().size(), is(1));
assertThat(app.getExtensions().get(0).getId(), is("id.systemAdministration.appLink"));
assertThat(app.getExtensions().get(0).getType(), is("link"));
assertThat(app.getExtensions().get(0).getLabel(), is("label"));
assertThat(app.getExtensions().get(0).getUrl(), is("url"));
assertThat(app.getExtensions().get(0).getIcon(), is("icon"));
assertThat(app.getExtensions().get(0).getRequiredPrivilege(), is("privilege"));
assertThat(app.getExtensions().get(0).getExtensionPointId(), is(CustomAppLoaderConstants.ExtensionPoints.SYSTEM_ADMINISTRATION_PAGE));
}
Aggregations