From 7a39d69573e2827302cd6be52b271ea8dae6c17a Mon Sep 17 00:00:00 2001 From: "K.Suthagar" Date: Mon, 7 Aug 2017 11:27:59 +0530 Subject: [PATCH] Added version and test cased to Module Resource default representation (#291) Added version to Module Resource default representation Test cases added to moduleController Test VersionInDefaultRepresentation added to moduleController Test --- .../web/v1_0/resource/openmrs1_8/ModuleResource1_8.java | 1 + .../controller/openmrs1_8/ModuleController1_8Test.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java index f086e7340..a39f354b6 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java @@ -83,6 +83,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation description.addProperty("display"); description.addProperty("name"); description.addProperty("description"); + description.addProperty("version"); description.addProperty("started"); description.addProperty("startupErrorMessage"); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); diff --git a/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/ModuleController1_8Test.java b/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/ModuleController1_8Test.java index 98846b6f8..03be2cadd 100644 --- a/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/ModuleController1_8Test.java +++ b/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/ModuleController1_8Test.java @@ -95,6 +95,14 @@ public void shouldIncludeAuthorToFullRepresentation() throws Exception { Assert.assertNotNull(PropertyUtils.getProperty(result, "author")); } + @Test + public void shouldIncludeVersionToDefaultRepresentation() throws Exception { + MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid()); + SimpleObject result = deserialize(handle(req)); + + Assert.assertNotNull(PropertyUtils.getProperty(result, "version")); + } + @Test public void shouldUploadModule() throws Exception { byte[] fileData = IOUtils.toByteArray(getClass().getClassLoader().getResourceAsStream("mockModule.omod"));