Search in sources :

Example 6 with AppDescriptor

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"));
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) Test(org.junit.Test)

Example 7 with AppDescriptor

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"));
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) Test(org.junit.Test)

Example 8 with AppDescriptor

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"));
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) Test(org.junit.Test)

Example 9 with AppDescriptor

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"));
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) Test(org.junit.Test)

Example 10 with AppDescriptor

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));
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) Test(org.junit.Test)

Aggregations

AppDescriptor (org.openmrs.module.appframework.domain.AppDescriptor)15 Test (org.junit.Test)10 Redirect (org.openmrs.ui.framework.page.Redirect)2 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 JsonNode (org.codehaus.jackson.JsonNode)1 Location (org.openmrs.Location)1 Patient (org.openmrs.Patient)1 AppContextModel (org.openmrs.module.appframework.context.AppContextModel)1 Extension (org.openmrs.module.appframework.domain.Extension)1 PatientContextModel (org.openmrs.module.coreapps.contextmodel.PatientContextModel)1 VisitContextModel (org.openmrs.module.coreapps.contextmodel.VisitContextModel)1 AwaitingAdmissionVisitQuery (org.openmrs.module.emrapi.adt.reporting.query.AwaitingAdmissionVisitQuery)1 PatientDomainWrapper (org.openmrs.module.emrapi.patient.PatientDomainWrapper)1 VisitDomainWrapper (org.openmrs.module.emrapi.visit.VisitDomainWrapper)1 Config (org.openmrs.module.pihcore.config.Config)1 MapElementConverter (org.openmrs.module.reporting.data.converter.MapElementConverter)1 ObjectFormatter (org.openmrs.module.reporting.data.converter.ObjectFormatter)1 PropertyConverter (org.openmrs.module.reporting.data.converter.PropertyConverter)1 PatientDataDefinition (org.openmrs.module.reporting.data.patient.definition.PatientDataDefinition)1