TSK-947: Use Url mappings on rest documentation tests
This commit is contained in:
parent
f848bf4f4e
commit
4049f4d4d7
|
@ -13,6 +13,8 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate Rest Docu for AbstractPagingController.
|
* Generate Rest Docu for AbstractPagingController.
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +57,7 @@ class AbstractPagingControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void commonSummaryResourceFieldsDocTest() throws Exception {
|
void commonSummaryResourceFieldsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications?page=2&page-size=5")
|
.get(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS) + "?page=2&page-size=5")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("CommonSummaryResourceFields",
|
.andDo(MockMvcRestDocumentation.document("CommonSummaryResourceFields",
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
|
import pro.taskana.RestHelper;
|
||||||
import pro.taskana.TaskanaSpringBootTest;
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +34,8 @@ public abstract class BaseRestDocumentation {
|
||||||
@Autowired
|
@Autowired
|
||||||
protected MockMvc mockMvc;
|
protected MockMvc mockMvc;
|
||||||
|
|
||||||
|
@Autowired RestHelper restHelper;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUpMockMvc() {
|
public void setUpMockMvc() {
|
||||||
document("{methodName}",
|
document("{methodName}",
|
||||||
|
|
|
@ -20,6 +20,8 @@ import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate REST Dokumentation for ClassificationController.
|
* Generate REST Dokumentation for ClassificationController.
|
||||||
*/
|
*/
|
||||||
|
@ -200,7 +202,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getAllClassificationsDocTest() throws Exception {
|
void getAllClassificationsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications?domain=DOMAIN_B")
|
.get(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS) + "?domain=DOMAIN_B")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -211,7 +213,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getSpecificClassificationDocTest() throws Exception {
|
void getSpecificClassificationDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
.get(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("GetSpecificClassificationDocTest",
|
.andDo(MockMvcRestDocumentation.document("GetSpecificClassificationDocTest",
|
||||||
|
@ -221,7 +223,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void classificationSubsetDocTest() throws Exception {
|
void classificationSubsetDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
.get(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("ClassificationSubset",
|
.andDo(MockMvcRestDocumentation.document("ClassificationSubset",
|
||||||
|
@ -231,7 +233,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void createAndDeleteClassificationDocTest() throws Exception {
|
void createAndDeleteClassificationDocTest() throws Exception {
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/classifications")
|
.post(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS))
|
||||||
.contentType("application/hal+json")
|
.contentType("application/hal+json")
|
||||||
.content("{\"key\":\"Key0815casdgdgh\", \"domain\":\"DOMAIN_B\"}")
|
.content("{\"key\":\"Key0815casdgdgh\", \"domain\":\"DOMAIN_B\"}")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
@ -245,7 +247,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
String newId = content.substring(content.indexOf("CLI:"), content.indexOf("CLI:") + 40);
|
String newId = content.substring(content.indexOf("CLI:"), content.indexOf("CLI:") + 40);
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/api/v1/classifications/" + newId)
|
.delete(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, newId))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("DeleteClassificationDocTest"));
|
.andDo(MockMvcRestDocumentation.document("DeleteClassificationDocTest"));
|
||||||
|
@ -254,7 +256,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void updateClassificationDocTest() throws Exception {
|
void updateClassificationDocTest() throws Exception {
|
||||||
URL url = new URL(
|
URL url = new URL(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009");
|
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"));
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
con.setRequestProperty("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
con.setRequestProperty("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -273,7 +275,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
String modifiedTask = new String(originalTask.toString());
|
String modifiedTask = new String(originalTask.toString());
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.put("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
.put(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.content(modifiedTask))
|
.content(modifiedTask))
|
||||||
|
|
|
@ -14,6 +14,8 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test ClassificationDefinitionControlller.
|
* Test ClassificationDefinitionControlller.
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +34,7 @@ class ClassificationDefinitionControllerRestDocumentation extends BaseRestDocume
|
||||||
@Test
|
@Test
|
||||||
void exportAllClassificationDefinitions() throws Exception {
|
void exportAllClassificationDefinitions() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classification-definitions")
|
.get(restHelper.toUrl(Mapping.URL_CLASSIFICATIONDEFINITION))
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -44,7 +46,7 @@ class ClassificationDefinitionControllerRestDocumentation extends BaseRestDocume
|
||||||
void importClassificationDefinitions() throws Exception {
|
void importClassificationDefinitions() throws Exception {
|
||||||
String definitionString = "[{\"key\":\"Key0815\", \"domain\":\"DOMAIN_B\"}]";
|
String definitionString = "[{\"key\":\"Key0815\", \"domain\":\"DOMAIN_B\"}]";
|
||||||
|
|
||||||
this.mockMvc.perform(multipart("http://127.0.0.1:" + port + "/api/v1/classification-definitions")
|
this.mockMvc.perform(multipart(restHelper.toUrl(Mapping.URL_CLASSIFICATIONDEFINITION))
|
||||||
.file("file",
|
.file("file",
|
||||||
definitionString.getBytes())
|
definitionString.getBytes())
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
|
|
@ -12,6 +12,8 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate common REST Documentation.
|
* Generate common REST Documentation.
|
||||||
*
|
*
|
||||||
|
@ -63,7 +65,7 @@ class CommonRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void commonFieldsDocTest() throws Exception {
|
void commonFieldsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
.get(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("CommonFields",
|
.andDo(MockMvcRestDocumentation.document("CommonFields",
|
||||||
|
|
|
@ -11,6 +11,8 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate REST docu for the monitor controller.
|
* Generate REST docu for the monitor controller.
|
||||||
*
|
*
|
||||||
|
@ -46,7 +48,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getTaskStatusReport() throws Exception {
|
void getTaskStatusReport() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/monitor/tasks-status-report")
|
.get(restHelper.toUrl(Mapping.URL_MONITOR_TASKSSTATUS))
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("GetTaskStatusReportDocTest",
|
.andDo(MockMvcRestDocumentation.document("GetTaskStatusReportDocTest",
|
||||||
|
@ -56,8 +58,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void tasksWorkbasketReport() throws Exception {
|
void tasksWorkbasketReport() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port
|
.get(restHelper.toUrl(Mapping.URL_MONITOR_TASKSWORKBASKET) + "?daysInPast=4&states=READY,CLAIMED,COMPLETED")
|
||||||
+ "/api/v1/monitor/tasks-workbasket-report?daysInPast=4&states=READY,CLAIMED,COMPLETED")
|
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -68,7 +69,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void tasksClassificationReport() throws Exception {
|
void tasksClassificationReport() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/monitor/tasks-classification-report")
|
.get(restHelper.toUrl(Mapping.URL_MONITOR_TASKSCLASSIFICATION))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -79,7 +80,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getTimestampReport() throws Exception {
|
void getTimestampReport() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/monitor/timestamp-report")
|
.get(restHelper.toUrl(Mapping.URL_MONITOR_TIMESTAMP))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
|
|
@ -20,6 +20,8 @@ import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate REST Documentation for the TaskController.
|
* Generate REST Documentation for the TaskController.
|
||||||
*/
|
*/
|
||||||
|
@ -290,7 +292,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getAllTasksDocTest() throws Exception {
|
void getAllTasksDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/tasks?por.type=VNR&por.value=22334455")
|
.get(restHelper.toUrl(Mapping.URL_TASKS) + "?por.type=VNR&por.value=22334455")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -301,7 +303,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getSpecificTaskDocTest() throws Exception {
|
void getSpecificTaskDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000")
|
.get(restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -312,7 +314,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void taskSubSetDocTest() throws Exception {
|
void taskSubSetDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000")
|
.get(restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -322,7 +324,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void updateTaskDocTest() throws Exception {
|
void updateTaskDocTest() throws Exception {
|
||||||
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000");
|
URL url = new URL(restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"));
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
con.setRequestProperty("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
con.setRequestProperty("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -340,7 +342,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
String originalTask = content.toString();
|
String originalTask = content.toString();
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.put("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000")
|
.put(restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.content(originalTask))
|
.content(originalTask))
|
||||||
|
@ -354,7 +356,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
void createAndDeleteTaskDocTest() throws Exception {
|
void createAndDeleteTaskDocTest() throws Exception {
|
||||||
|
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
.post(restHelper.toUrl(Mapping.URL_TASKS))
|
||||||
.contentType("application/hal+json")
|
.contentType("application/hal+json")
|
||||||
.content("{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
.content("{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
||||||
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
||||||
|
@ -370,7 +372,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
String newId = content.substring(content.indexOf("TKI:"), content.indexOf("TKI:") + 40);
|
String newId = content.substring(content.indexOf("TKI:"), content.indexOf("TKI:") + 40);
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/api/v1/tasks/" + newId)
|
.delete(restHelper.toUrl(Mapping.URL_TASKS_ID, newId))
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
|
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
|
||||||
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
||||||
|
@ -380,7 +382,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
void claimTaskDocTest() throws Exception {
|
void claimTaskDocTest() throws Exception {
|
||||||
|
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
.post(restHelper.toUrl(Mapping.URL_TASKS))
|
||||||
.contentType("application/hal+json")
|
.contentType("application/hal+json")
|
||||||
.content("{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
.content("{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
||||||
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
||||||
|
@ -394,7 +396,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
String newId = content.substring(content.indexOf("TKI:"), content.indexOf("TKI:") + 40);
|
String newId = content.substring(content.indexOf("TKI:"), content.indexOf("TKI:") + 40);
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks/" + newId + "/claim")
|
.post(restHelper.toUrl(Mapping.URL_TASKS_ID_CLAIM, newId))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
||||||
.content("{}"))
|
.content("{}"))
|
||||||
|
@ -403,7 +405,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
responseFields(taskFieldDescriptors)));
|
responseFields(taskFieldDescriptors)));
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/api/v1/tasks/" + newId)
|
.delete(restHelper.toUrl(Mapping.URL_TASKS_ID, newId))
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
|
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
|
||||||
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
||||||
|
@ -412,7 +414,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void completeTaskDocTest() throws Exception {
|
void completeTaskDocTest() throws Exception {
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
.post(restHelper.toUrl(Mapping.URL_TASKS))
|
||||||
.contentType("application/hal+json")
|
.contentType("application/hal+json")
|
||||||
.content("{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
.content("{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
||||||
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
||||||
|
@ -426,7 +428,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
String newId = content.substring(content.indexOf("TKI:"), content.indexOf("TKI:") + 40);
|
String newId = content.substring(content.indexOf("TKI:"), content.indexOf("TKI:") + 40);
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks/" + newId + "/complete")
|
.post(restHelper.toUrl(Mapping.URL_TASKS_ID_COMPLETE, newId))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
||||||
.content("{}"))
|
.content("{}"))
|
||||||
|
@ -435,7 +437,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
responseFields(taskFieldDescriptors)));
|
responseFields(taskFieldDescriptors)));
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/api/v1/tasks/" + newId)
|
.delete(restHelper.toUrl(Mapping.URL_TASKS_ID, newId))
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
|
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
|
||||||
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
||||||
|
@ -444,7 +446,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void transferTaskDocTest() throws Exception {
|
void transferTaskDocTest() throws Exception {
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
.post(restHelper.toUrl(Mapping.URL_TASKS))
|
||||||
.contentType("application/hal+json")
|
.contentType("application/hal+json")
|
||||||
.content("{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
.content("{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
||||||
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
||||||
|
@ -459,15 +461,15 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
String newId = content.substring(content.indexOf("TKI:"), content.indexOf("TKI:") + 40);
|
String newId = content.substring(content.indexOf("TKI:"), content.indexOf("TKI:") + 40);
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks/" + newId
|
.post(restHelper.toUrl(Mapping.URL_TASKS_ID_TRANSFER_WORKBASKETID, newId,
|
||||||
+ "/transfer/WBI:100000000000000000000000000000000001")
|
"WBI:100000000000000000000000000000000001"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("TransferTaskDocTest",
|
.andDo(MockMvcRestDocumentation.document("TransferTaskDocTest",
|
||||||
responseFields(taskFieldDescriptors)));
|
responseFields(taskFieldDescriptors)));
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/api/v1/tasks/" + newId)
|
.delete(restHelper.toUrl(Mapping.URL_TASKS_ID, newId))
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
|
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
|
||||||
.andExpect(MockMvcResultMatchers.status().isNoContent());
|
.andExpect(MockMvcResultMatchers.status().isNoContent());
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate REST Docu for the TaskanaEngineController.
|
* Generate REST Docu for the TaskanaEngineController.
|
||||||
*
|
*
|
||||||
|
@ -46,7 +48,7 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getAllDomainsDocTest() throws Exception {
|
void getAllDomainsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/domains")
|
.get(restHelper.toUrl(Mapping.URL_DOMAIN))
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -57,7 +59,7 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getAllClassificationCategoriesDocTest() throws Exception {
|
void getAllClassificationCategoriesDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classification-categories")
|
.get(restHelper.toUrl(Mapping.URL_CLASSIFICATIONCATEGORIES))
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -68,7 +70,7 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getAllClassificationTypesDocTest() throws Exception {
|
void getAllClassificationTypesDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classification-types")
|
.get(restHelper.toUrl(Mapping.URL_CLASSIFICATIONTYPES))
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -79,7 +81,7 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getCurrentUserInfo() throws Exception {
|
void getCurrentUserInfo() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/current-user-info")
|
.get(restHelper.toUrl(Mapping.URL_CURRENTUSER))
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -90,7 +92,7 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getHistoryProviderIsEnabled() throws Exception {
|
void getHistoryProviderIsEnabled() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/history-provider-enabled")
|
.get(restHelper.toUrl(Mapping.URL_HISTORYENABLED))
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
|
|
@ -13,6 +13,8 @@ import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.annotation.DirtiesContext;
|
import org.springframework.test.annotation.DirtiesContext;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate REST Docu for the WorkbasketAccessItemController.
|
* Generate REST Docu for the WorkbasketAccessItemController.
|
||||||
*/
|
*/
|
||||||
|
@ -109,8 +111,8 @@ class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentat
|
||||||
void getWorkbasketAccessItemsDocTest() throws Exception {
|
void getWorkbasketAccessItemsDocTest() throws Exception {
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(RestDocumentationRequestBuilders
|
.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port
|
.get(restHelper.toUrl(Mapping.URL_WORKBASKETACCESSITEMS)
|
||||||
+ "/api/v1/workbasket-access-items/?sort-by=workbasket-key&order=asc&access-ids=user_2_2")
|
+ "?sort-by=workbasket-key&order=asc&access-ids=user_2_2")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -123,7 +125,7 @@ class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentat
|
||||||
void removeWorkbasketAccessItemsDocTest() throws Exception {
|
void removeWorkbasketAccessItemsDocTest() throws Exception {
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(RestDocumentationRequestBuilders
|
.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/api/v1/workbasket-access-items/?access-id=user_2_2")
|
.delete(restHelper.toUrl(Mapping.URL_WORKBASKETACCESSITEMS) + "?access-id=user_2_2")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("RemoveWorkbasketAccessItemsDocTest"));
|
.andDo(MockMvcRestDocumentation.document("RemoveWorkbasketAccessItemsDocTest"));
|
||||||
|
|
|
@ -19,6 +19,8 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate REST Documentatioon for the WorkbasketController.
|
* Generate REST Documentatioon for the WorkbasketController.
|
||||||
*/
|
*/
|
||||||
|
@ -274,7 +276,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getAllWorkbasketsDocTest() throws Exception {
|
void getAllWorkbasketsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(
|
this.mockMvc.perform(
|
||||||
RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port + "/api/v1/workbaskets?type=PERSONAL")
|
RestDocumentationRequestBuilders.get(restHelper.toUrl(Mapping.URL_WORKBASKET) + "?type=PERSONAL")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -285,7 +287,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void getSpecificWorkbasketDocTest() throws Exception {
|
void getSpecificWorkbasketDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000001")
|
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000001"))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -295,8 +297,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getAllWorkbasketAccessItemsDocTest() throws Exception {
|
void getAllWorkbasketAccessItemsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
||||||
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000001/workbasketAccessItems")
|
restHelper.toUrl(Mapping.URL_WORKBASKET_ID_ACCESSITEMS, "WBI:100000000000000000000000000000000001"))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -307,7 +309,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void workbasketSubsetDocTest() throws Exception {
|
void workbasketSubsetDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000001")
|
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000001"))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -317,8 +319,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void removeWorkbasketAsDistributionTargetDocTest() throws Exception {
|
void removeWorkbasketAsDistributionTargetDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.delete("http://127.0.0.1:" + port
|
this.mockMvc.perform(RestDocumentationRequestBuilders.delete(
|
||||||
+ "/api/v1/workbaskets/distribution-targets/WBI:100000000000000000000000000000000007")
|
restHelper.toUrl(Mapping.URL_WORKBASKET_DISTRIBUTION_ID, "WBI:100000000000000000000000000000000007"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("RemoveWorkbasketAsDistributionTargetDocTest"));
|
.andDo(MockMvcRestDocumentation.document("RemoveWorkbasketAsDistributionTargetDocTest"));
|
||||||
|
@ -326,8 +328,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getAllWorkbasketDistributionTargets() throws Exception {
|
void getAllWorkbasketDistributionTargets() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
||||||
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000002/distribution-targets")
|
restHelper.toUrl(Mapping.URL_WORKBASKET_ID_DISTRIBUTION, "WBI:100000000000000000000000000000000002"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("GetAllWorkbasketDistributionTargets",
|
.andDo(MockMvcRestDocumentation.document("GetAllWorkbasketDistributionTargets",
|
||||||
|
@ -336,7 +338,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void createWorkbasketDocTest() throws Exception {
|
void createWorkbasketDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.post("http://127.0.0.1:" + port + "/api/v1/workbaskets")
|
this.mockMvc.perform(RestDocumentationRequestBuilders.post(restHelper.toUrl(Mapping.URL_WORKBASKET))
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
||||||
.content(
|
.content(
|
||||||
|
@ -352,7 +354,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void updateWorkbasketDocTest() throws Exception {
|
void updateWorkbasketDocTest() throws Exception {
|
||||||
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000002");
|
URL url = new URL(restHelper.toUrl(Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000002"));
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
con.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4=");
|
con.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4=");
|
||||||
|
@ -371,7 +373,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
String modifiedWorkbasket = new String(originalWorkbasket.toString());
|
String modifiedWorkbasket = new String(originalWorkbasket.toString());
|
||||||
|
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.put(
|
this.mockMvc.perform(RestDocumentationRequestBuilders.put(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000002")
|
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000002"))
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.content(modifiedWorkbasket))
|
.content(modifiedWorkbasket))
|
||||||
|
@ -384,7 +386,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
@Test
|
@Test
|
||||||
void markWorkbasketForDeletionDocTest() throws Exception {
|
void markWorkbasketForDeletionDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.delete(
|
this.mockMvc.perform(RestDocumentationRequestBuilders.delete(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/workbaskets/" + "WBI:100000000000000000000000000000000005")
|
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000005"))
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
||||||
.andExpect(MockMvcResultMatchers.status().isAccepted())
|
.andExpect(MockMvcResultMatchers.status().isAccepted())
|
||||||
.andDo(MockMvcRestDocumentation.document("MarkWorkbasketForDeletionDocTest"));
|
.andDo(MockMvcRestDocumentation.document("MarkWorkbasketForDeletionDocTest"));
|
||||||
|
@ -392,8 +394,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void accessItemDocTest() throws Exception {
|
void accessItemDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
||||||
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000001/workbasketAccessItems")
|
restHelper.toUrl(Mapping.URL_WORKBASKET_ID_ACCESSITEMS, "WBI:100000000000000000000000000000000001"))
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
|
|
@ -14,6 +14,8 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import pro.taskana.rest.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate Rest Documentation for Workbasket Definitions.
|
* Generate Rest Documentation for Workbasket Definitions.
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +34,7 @@ class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentat
|
||||||
@Test
|
@Test
|
||||||
void exportAllWorkbasketDefinitions() throws Exception {
|
void exportAllWorkbasketDefinitions() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/workbasket-definitions")
|
.get(restHelper.toUrl(Mapping.URL_WORKBASKETDEFIITIONS))
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
@ -50,7 +52,7 @@ class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentat
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "]";
|
+ "]";
|
||||||
|
|
||||||
this.mockMvc.perform(multipart("http://127.0.0.1:" + port + "/api/v1/workbasket-definitions")
|
this.mockMvc.perform(multipart(restHelper.toUrl(Mapping.URL_WORKBASKETDEFIITIONS))
|
||||||
.file("file",
|
.file("file",
|
||||||
definitionString.getBytes())
|
definitionString.getBytes())
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
|
|
@ -8,8 +8,6 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
import pro.taskana.TaskanaSpringBootTest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Mapping and Linkbuilder.
|
* Test Mapping and Linkbuilder.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -352,8 +352,7 @@ class TaskControllerIntTest {
|
||||||
restHelper.toUrl(Mapping.URL_TASKS_ID, taskIdOfCreatedTask),
|
restHelper.toUrl(Mapping.URL_TASKS_ID, taskIdOfCreatedTask),
|
||||||
HttpMethod.DELETE,
|
HttpMethod.DELETE,
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
||||||
ParameterizedTypeReference.forType(Void.class)
|
ParameterizedTypeReference.forType(Void.class));
|
||||||
);
|
|
||||||
|
|
||||||
assertEquals(HttpStatus.NO_CONTENT, responseDeleted.getStatusCode());
|
assertEquals(HttpStatus.NO_CONTENT, responseDeleted.getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue