Search in sources :

Example 21 with Extension

use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-mirebalais by PIH.

the class CustomAppLoaderTest method shouldCreateVisitActionsExtension.

@Test
public void shouldCreateVisitActionsExtension() {
    Extension extension = CustomAppLoaderUtil.visitAction(CustomAppLoaderConstants.Extensions.ORDER_XRAY_VISIT_ACTION, "label", "icon", "link", "url", "privilege", "require");
    assertThat(extension.getId(), is(CustomAppLoaderConstants.Extensions.ORDER_XRAY_VISIT_ACTION));
    assertThat(extension.getLabel(), is("label"));
    assertThat(extension.getIcon(), is("icon"));
    assertThat(extension.getUrl(), is("url"));
    assertThat(extension.getScript(), nullValue());
    assertThat(extension.getRequiredPrivilege(), is("privilege"));
    assertThat(extension.getRequire(), is("require"));
    assertThat(extension.getType(), is("link"));
    assertThat(extension.getExtensionPointId(), is(CustomAppLoaderConstants.ExtensionPoints.VISIT_ACTIONS));
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension) Test(org.junit.Test)

Example 22 with Extension

use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-mirebalais by PIH.

the class CustomAppLoaderTest method shouldCreateOverviewReportExtension.

@Test
public void shouldCreateOverviewReportExtension() {
    Extension extension = CustomAppLoaderUtil.overviewReport("id", "label", "uuid", "privilege", 1, "linkId");
    assertThat(extension.getId(), is("id"));
    assertThat(extension.getLabel(), is("label"));
    assertThat(extension.getType(), is("link"));
    assertThat(extension.getExtensionPointId(), is(CustomAppLoaderConstants.ExtensionPoints.REPORTING_OVERVIEW_REPORTS));
    assertThat(extension.getRequiredPrivilege(), is("privilege"));
    assertThat(extension.getOrder(), is(1));
    assertThat(extension.getUrl(), is("reportingui/runReport.page?reportDefinition=uuid"));
    assertThat((String) extension.getExtensionParams().get("linkId"), is("linkId"));
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension) Test(org.junit.Test)

Example 23 with Extension

use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-mirebalais by PIH.

the class CustomAppLoaderTest method shouldCreateFragmentExtension.

@Test
public void shouldCreateFragmentExtension() {
    Extension extension = CustomAppLoaderUtil.fragmentExtension("id", "provider", "fragment", "privilege", "extensionPoint", map("config", "config"));
    assertThat(extension.getId(), is("id"));
    assertThat((String) extension.getExtensionParams().get("provider"), is("provider"));
    assertThat((String) extension.getExtensionParams().get("fragment"), is("fragment"));
    assertThat((String) ((Map<String, Object>) extension.getExtensionParams().get("fragmentConfig")).get("config"), is("config"));
    assertThat(extension.getRequiredPrivilege(), is("privilege"));
    assertThat(extension.getExtensionPointId(), is("extensionPoint"));
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension) Map(java.util.Map) Test(org.junit.Test)

Example 24 with Extension

use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-mirebalais by PIH.

the class CustomAppLoaderTest method shouldCreateDashboardTab.

@Test
public void shouldCreateDashboardTab() {
    Extension extension = CustomAppLoaderUtil.dashboardTab("id", "label", "privilege", "provider", "fragment");
    assertThat(extension.getId(), is("id"));
    assertThat(extension.getExtensionPointId(), is("patientDashboard.tabs"));
    assertThat(extension.getType(), is("link"));
    assertThat(extension.getLabel(), is("label"));
    assertThat(extension.getRequiredPrivilege(), is("privilege"));
    assertThat((String) extension.getExtensionParams().get("provider"), is("provider"));
    assertThat((String) extension.getExtensionParams().get("fragment"), is("fragment"));
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension) Test(org.junit.Test)

Example 25 with Extension

use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-mirebalais by PIH.

the class CustomAppLoaderTest method shouldCreateDataExportExtension.

@Test
public void shouldCreateDataExportExtension() {
    Extension extension = CustomAppLoaderUtil.dataExport("id", "label", "uuid", "privilege", 1, "linkId");
    assertThat(extension.getId(), is("id"));
    assertThat(extension.getLabel(), is("label"));
    assertThat(extension.getType(), is("link"));
    assertThat(extension.getExtensionPointId(), is(CustomAppLoaderConstants.ExtensionPoints.REPORTING_DATA_EXPORT));
    assertThat(extension.getRequiredPrivilege(), is("privilege"));
    assertThat(extension.getOrder(), is(1));
    assertThat(extension.getUrl(), is("reportingui/runReport.page?reportDefinition=uuid"));
    assertThat((String) extension.getExtensionParams().get("linkId"), is("linkId"));
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension) Test(org.junit.Test)

Aggregations

Extension (org.openmrs.module.appframework.domain.Extension)40 Test (org.junit.Test)18 AppContextModel (org.openmrs.module.appframework.context.AppContextModel)7 ArrayList (java.util.ArrayList)5 Map (java.util.Map)4 PatientContextModel (org.openmrs.module.coreapps.contextmodel.PatientContextModel)4 CustomAppLoaderUtil.addFeatureToggleToExtension (org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.addFeatureToggleToExtension)4 CustomAppLoaderUtil.containsExtension (org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.containsExtension)4 CustomAppLoaderUtil.fragmentExtension (org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.fragmentExtension)4 VisitContextModel (org.openmrs.module.coreapps.contextmodel.VisitContextModel)3 VisitDomainWrapper (org.openmrs.module.emrapi.visit.VisitDomainWrapper)3 Redirect (org.openmrs.ui.framework.page.Redirect)3 Location (org.openmrs.Location)2 Patient (org.openmrs.Patient)2 AppDescriptor (org.openmrs.module.appframework.domain.AppDescriptor)2 SimpleObject (org.openmrs.ui.framework.SimpleObject)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Locale (java.util.Locale)1