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 1 commit
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 @@ -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;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8;
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9;

import java.util.Map;
import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -37,7 +37,7 @@

@Controller
@RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/password")
public class ChangePasswordController1_8 extends BaseRestController {
public class ChangePasswordController1_9 extends BaseRestController {

@Qualifier("userService")
@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8;
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9;

import java.io.IOException;

Expand All @@ -27,7 +27,7 @@
import org.openmrs.module.webservices.rest.web.response.ResponseException;
import org.openmrs.module.webservices.rest.web.v1_0.controller.BaseRestController;
import org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceController;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.HL7MessageResource1_8;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.HL7MessageResource1_9;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
Expand All @@ -43,13 +43,13 @@
import ca.uhn.hl7v2.util.Terser;

/**
* Controller for {@link HL7MessageResource1_8}.
* Controller for {@link HL7MessageResource1_9}.
* <p>
* It is provided, because we want to support posting plain HL7 messages in addition to those in
* json.
*/
@Controller
public class HL7MessageController1_8 extends BaseRestController {
public class HL7MessageController1_9 extends BaseRestController {

@Autowired
@Qualifier("mainResourceController")
Expand Down Expand Up @@ -92,7 +92,7 @@ public Object create(@RequestBody String hl7, HttpServletRequest request, HttpSe
throw new ConversionException(e.getMessage(), e);
}

Object created = ((HL7MessageResource1_8) Context.getService(RestService.class).getResourceByName(
Object created = ((HL7MessageResource1_9) Context.getService(RestService.class).getResourceByName(
RestConstants.VERSION_1 + "/hl7")).create(post, context);
return RestUtil.created(response, created);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8;
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.io.IOUtils;
Expand All @@ -34,7 +34,7 @@

@Controller
@RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/obs")
public class ObsComplexValueController1_8 extends BaseRestController {
public class ObsComplexValueController1_9 extends BaseRestController {

@Autowired
ObsService obsService;
Expand Down
Loading
Loading