Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESTWS-741: Remove 1.8 submodule (Removed 0mod-1.8Controller) #619

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging;
import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.DrugOrderSubclassHandler1_8;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.DrugOrderSubclassHandler1_9;

/**
* Exposes the {@link org.openmrs.DrugOrder} subclass as a type in
* {@link org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_10.DrugOrderSubclassHandler1_10}
*/
@SubClassHandler(supportedClass = DrugOrder.class, supportedOpenmrsVersions = { "1.10.* - 1.11.*" })
public class DrugOrderSubclassHandler1_10 extends DrugOrderSubclassHandler1_8 {
public class DrugOrderSubclassHandler1_10 extends DrugOrderSubclassHandler1_9 {

/**
* @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#newDelegate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
import org.openmrs.module.webservices.rest.web.representation.Representation;
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.DrugResource1_8;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.DrugResource1_9;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
Expand All @@ -27,7 +27,7 @@
* supporting standard CRUD operations
*/
@Resource(name = RestConstants.VERSION_1 + "/drug", order = 3, supportedClass = Drug.class, supportedOpenmrsVersions = { "1.10.*" })
public class DrugResource1_10 extends DrugResource1_8 {
public class DrugResource1_10 extends DrugResource1_9 {

/**
* @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getResourceVersion()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.openmrs.module.webservices.rest.web.response.ObjectNotFoundException;
import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException;
import org.openmrs.module.webservices.rest.web.response.ResponseException;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.OrderResource1_8;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.PatientResource1_8;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.OrderResource1_9;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.PatientResource1_9;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -51,7 +51,7 @@
* , supporting standard CRUD operations
*/
@Resource(name = RestConstants.VERSION_1 + "/order", supportedClass = Order.class, supportedOpenmrsVersions = { "1.10.* - 2.1.*" })
public class OrderResource1_10 extends OrderResource1_8 {
public class OrderResource1_10 extends OrderResource1_9 {

/**
* @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation)
Expand Down Expand Up @@ -218,7 +218,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe
protected PageableResult doSearch(RequestContext context) throws ResponseException {
String patientUuid = context.getRequest().getParameter("patient");
if (patientUuid != null) {
Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass(
Patient patient = ((PatientResource1_9) Context.getService(RestService.class).getResourceBySupportedClass(
Patient.class)).getByUniqueId(patientUuid);
if (patient == null) {
throw new ObjectNotFoundException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource;
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.PersonResource1_8;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.PersonResource1_9;

/**
* {@link Resource} for Person, supporting standard CRUD operations
*/
@Resource(name = RestConstants.VERSION_1 + "/person", order = 3, supportedClass = Person.class, supportedOpenmrsVersions = {
"1.10.4 - 1.10.*" })
public class PersonResource1_10 extends PersonResource1_8 {
public class PersonResource1_10 extends PersonResource1_9 {

/**
* @see DelegatingCrudResource#getRepresentationDescription(Representation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.openmrs.module.webservices.rest.web.representation.RefRepresentation;
import org.openmrs.module.webservices.rest.web.representation.Representation;
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.ProgramEnrollmentResource1_8;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.ProgramEnrollmentResource1_9;
import org.openmrs.util.OpenmrsUtil;

import java.util.Collections;
Expand All @@ -37,7 +37,7 @@

@Resource(name = RestConstants.VERSION_1 + "/programenrollment", supportedClass = PatientProgram.class, supportedOpenmrsVersions = {
"1.10.* - 9.*" })
public class ProgramEnrollmentResource1_10 extends ProgramEnrollmentResource1_8 {
public class ProgramEnrollmentResource1_10 extends ProgramEnrollmentResource1_9 {

@Override
public DelegatingResourceDescription getRepresentationDescription(Representation rep) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import org.openmrs.module.webservices.rest.web.representation.RefRepresentation;
import org.openmrs.module.webservices.rest.web.representation.Representation;
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.ProgramResource1_8;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.ProgramResource1_9;

@Resource(name = RestConstants.VERSION_1 + "/program", supportedClass = Program.class, supportedOpenmrsVersions = {
"1.10.* - 9.*" })
public class ProgramResource1_10 extends ProgramResource1_8 {
public class ProgramResource1_10 extends ProgramResource1_9 {

@Override
public DelegatingResourceDescription getRepresentationDescription(Representation rep) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

/**
* Exposes the {@link org.openmrs.TestOrder} subclass as a type in
* {@link org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.OrderResource1_8}
* {@link org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.OrderResource1_9}
*/
@SubClassHandler(supportedClass = TestOrder.class, supportedOpenmrsVersions = { "1.10.* - 9.*" })
public class TestOrderSubclassHandler1_10 extends BaseDelegatingSubclassHandler<Order, TestOrder> implements DelegatingSubclassHandler<Order, TestOrder> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.SimpleObject;
import org.openmrs.module.webservices.rest.test.Util;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_8;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_9;
import org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceControllerTest;
import org.openmrs.util.OpenmrsUtil;
import org.springframework.mock.web.MockHttpServletRequest;
Expand Down Expand Up @@ -67,28 +67,28 @@ public long getAllCount() {
*/
@Override
public String getUuid() {
return RestTestConstants1_8.PATIENT_PROGRAM_UUID;
return RestTestConstants1_9.PATIENT_PROGRAM_UUID;
}

@Test
@Override
public void shouldGetAll() throws Exception {
MockHttpServletRequest req = request(RequestMethod.GET, getURI());
req.setParameter("patient", RestTestConstants1_8.PATIENT_IN_A_PROGRAM_UUID);
req.setParameter("patient", RestTestConstants1_9.PATIENT_IN_A_PROGRAM_UUID);
SimpleObject result = deserialize(handle(req));

Patient patient = patientService.getPatientByUuid(RestTestConstants1_8.PATIENT_IN_A_PROGRAM_UUID);
Patient patient = patientService.getPatientByUuid(RestTestConstants1_9.PATIENT_IN_A_PROGRAM_UUID);
List<PatientProgram> patientPrograms = service.getPatientPrograms(patient, null, null, null, null, null, false);
Assert.assertEquals(patientPrograms.size(), Util.getResultsSize(result));
}

@Test
public void shouldExcludeVoided() throws Exception {
MockHttpServletRequest req = request(RequestMethod.GET, getURI());
req.setParameter("patient", RestTestConstants1_8.PATIENT_WITH_VOIDED_PROGRAM_UUID);
req.setParameter("patient", RestTestConstants1_9.PATIENT_WITH_VOIDED_PROGRAM_UUID);
SimpleObject result = deserialize(handle(req));

Patient patient = patientService.getPatientByUuid(RestTestConstants1_8.PATIENT_WITH_VOIDED_PROGRAM_UUID);
Patient patient = patientService.getPatientByUuid(RestTestConstants1_9.PATIENT_WITH_VOIDED_PROGRAM_UUID);
List<PatientProgram> patientPrograms = service.getPatientPrograms(patient, null, null, null, null, null, false);
Assert.assertEquals(patientPrograms.size(), Util.getResultsSize(result));
}
Expand All @@ -97,7 +97,7 @@ public void shouldExcludeVoided() throws Exception {
public void shouldTransitPatientState() throws Exception {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String stateStartDate = "2015-08-04";
String json = "{ \"states\": [{ \"state\": {\"uuid\" : \"" + RestTestConstants1_8.STATE_UUID
String json = "{ \"states\": [{ \"state\": {\"uuid\" : \"" + RestTestConstants1_9.STATE_UUID
+ "\"}, \"startDate\": \"" + stateStartDate + "\"}]}";

PatientProgram patientProgram = service.getPatientProgramByUuid(getUuid());
Expand All @@ -111,7 +111,7 @@ public void shouldTransitPatientState() throws Exception {
List<PatientState> states = new ArrayList<PatientState>(patientProgram.getStates());
Assert.assertEquals(2, states.size());
sortPatientStatesBasedOnStartDate(states);
Assert.assertEquals(RestTestConstants1_8.STATE_UUID, states.get(1).getState().getUuid());
Assert.assertEquals(RestTestConstants1_9.STATE_UUID, states.get(1).getState().getUuid());
String existingStateEndDate = dateFormat.format(states.get(0).getEndDate());
Assert.assertEquals(stateStartDate, existingStateEndDate);
}
Expand Down Expand Up @@ -149,7 +149,7 @@ public void shouldVoidPatientState() throws Exception {

//Transit the existing patient state to new state
String stateStartDate = "2015-08-04";
String json = "{ \"states\": [{ \"state\": {\"uuid\" : \"" + RestTestConstants1_8.STATE_UUID
String json = "{ \"states\": [{ \"state\": {\"uuid\" : \"" + RestTestConstants1_9.STATE_UUID
+ "\"}, \"startDate\": \"" + stateStartDate + "\"}]}";

MockHttpServletRequest req = newPostRequest(getURI() + "/" + getUuid(), SimpleObject.parseJson(json));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import org.openmrs.Person;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_8;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_9;
import org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest;

public class PersonResource1_10Test extends BaseDelegatingResourceTest<PersonResource1_10, Person> {
Expand Down Expand Up @@ -40,6 +40,6 @@ public String getDisplayProperty() {

@Override
public String getUuidProperty() {
return RestTestConstants1_8.PERSON_UUID;
return RestTestConstants1_9.PERSON_UUID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.openmrs.api.ProgramWorkflowService;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.SimpleObject;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_8;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_9;
import org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceControllerTest;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;
Expand All @@ -41,7 +41,7 @@ public String getURI() {

@Override
public String getUuid() {
return RestTestConstants1_8.PROGRAM_UUID;
return RestTestConstants1_9.PROGRAM_UUID;
}

@Override
Expand All @@ -56,8 +56,8 @@ public void shouldCreateAProgram() throws Exception {
SimpleObject program = new SimpleObject();
program.add("name", "Program name");
program.add("description", "Program description");
program.add("concept", RestTestConstants1_8.CONCEPT_UUID);
program.add("outcomesConcept", RestTestConstants1_8.CONCEPT2_UUID);
program.add("concept", RestTestConstants1_9.CONCEPT3_UUID);
program.add("outcomesConcept", RestTestConstants1_9.CONCEPT2_UUID);

String json = new ObjectMapper().writeValueAsString(program);

Expand All @@ -67,7 +67,7 @@ public void shouldCreateAProgram() throws Exception {
SimpleObject newProgram = deserialize(handle(req));

Assert.assertNotNull(PropertyUtils.getProperty(newProgram, "uuid"));
Assert.assertEquals(RestTestConstants1_8.CONCEPT2_UUID,
Assert.assertEquals(RestTestConstants1_9.CONCEPT2_UUID,
((Map) PropertyUtils.getProperty(newProgram, "outcomesConcept")).get("uuid"));
Assert.assertEquals(originalCount + 1, getAllCount());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.SimpleObject;
import org.openmrs.module.webservices.rest.test.Util;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_8;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_9;
import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException;
import org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceControllerTest;

Expand Down Expand Up @@ -48,7 +48,7 @@ public String getURI() {

@Override
public String getUuid() {
return RestTestConstants1_8.OBS_UUID;
return RestTestConstants1_9.OBS2_UUID;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import org.openmrs.Concept;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_8;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_9;
import org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest;

public class ConceptResource1_11Test extends BaseDelegatingResourceTest<ConceptResource1_11, Concept> {
Expand All @@ -36,6 +36,6 @@ public String getDisplayProperty() {

@Override
public String getUuidProperty() {
return RestTestConstants1_8.CONCEPT_NUMERIC_UUID;
return RestTestConstants1_9.CONCEPT_NUMERIC_UUID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.openmrs.Obs;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.SimpleObject;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_8;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_9;
import org.openmrs.module.webservices.rest.web.representation.Representation;
import org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest;

Expand Down Expand Up @@ -47,7 +47,7 @@ public String getDisplayProperty() {

@Override
public String getUuidProperty() {
return RestTestConstants1_8.OBS_UUID;
return RestTestConstants1_9.OBS2_UUID;
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import org.openmrs.Person;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_8;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_9;
import org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest;

public class PersonResource1_11Test extends BaseDelegatingResourceTest<PersonResource1_11, Person> {
Expand Down Expand Up @@ -42,6 +42,6 @@ public String getDisplayProperty() {

@Override
public String getUuidProperty() {
return RestTestConstants1_8.PERSON_UUID;
return RestTestConstants1_9.PERSON_UUID;
}
}
Loading
Loading