|
58 | 58 | import java.util.Comparator;
|
59 | 59 | import java.util.stream.Stream;
|
60 | 60 |
|
61 |
| -import static edu.kit.datamanager.mappingservice.mapping.Mapping.GEMMA; |
62 | 61 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
63 | 62 | import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
64 | 63 | import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
|
@@ -128,7 +127,7 @@ public void documentMappingRegistry() throws Exception {
|
128 | 127 | // register a first mapping for xml
|
129 | 128 | // Create a mapping record
|
130 | 129 | record.setMappingId(EXAMPLE_SCHEMA_ID_XML);
|
131 |
| - record.setMappingType(GEMMA.name()); |
| 130 | + record.setMappingType("GEMMA_unknown"); |
132 | 131 |
|
133 | 132 | File mappingsDir = Paths.get(TEMP_DIR_4_MAPPING).toFile();
|
134 | 133 | String mappingContent = FileUtils.readFileToString(new File("src/test/resources/mapping/gemma/simple.xml.mapping"), StandardCharsets.UTF_8);
|
@@ -168,23 +167,23 @@ public void documentMappingRegistry() throws Exception {
|
168 | 167 | this.mockMvc.perform(get("/api/v1/mappingAdministration/").param("page", Integer.toString(0)).param("size", Integer.toString(20))).andExpect(status().isOk()).andDo(document("get-all-mappings-pagination", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).andReturn().getResponse();
|
169 | 168 |
|
170 | 169 | // Get single mapping record
|
171 |
| - String etag = this.mockMvc.perform(get("/api/v1/mappingAdministration/" + EXAMPLE_SCHEMA_ID_JSON + "/" + GEMMA.name()).accept(MappingRecord.MAPPING_RECORD_MEDIA_TYPE.toString())).andExpect(status().isOk()).andDo(document("get-single-mapping", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).andReturn().getResponse().getHeader("ETag"); |
| 170 | + String etag = this.mockMvc.perform(get("/api/v1/mappingAdministration/" + EXAMPLE_SCHEMA_ID_JSON + "/GEMMA_unknown").accept(MappingRecord.MAPPING_RECORD_MEDIA_TYPE.toString())).andExpect(status().isOk()).andDo(document("get-single-mapping", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).andReturn().getResponse().getHeader("ETag"); |
172 | 171 |
|
173 | 172 | // Get mapping file
|
174 |
| - this.mockMvc.perform(get("/api/v1/mappingAdministration/" + EXAMPLE_SCHEMA_ID_JSON + "/" + GEMMA.name())).andExpect(status().isOk()).andDo(document("get-mapping-file", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).andReturn().getResponse(); |
| 173 | + this.mockMvc.perform(get("/api/v1/mappingAdministration/" + EXAMPLE_SCHEMA_ID_JSON + "/GEMMA_unknown")).andExpect(status().isOk()).andDo(document("get-mapping-file", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).andReturn().getResponse(); |
175 | 174 |
|
176 | 175 | //update schema document and create new version
|
177 | 176 | mappingContent = FileUtils.readFileToString(new File("src/test/resources/mapping/gemma/simple_v2.mapping"), StandardCharsets.UTF_8);
|
178 | 177 | mappingFile = new MockMultipartFile("document", EXAMPLE_SCHEMA_ID_JSON + "4gemma_v2.mapping", "application/json", mappingContent.getBytes());
|
179 |
| - etag = this.mockMvc.perform(MockMvcRequestBuilders.multipart("/api/v1/mappingAdministration/" + EXAMPLE_SCHEMA_ID_JSON + "/" + GEMMA.name()). |
| 178 | + etag = this.mockMvc.perform(MockMvcRequestBuilders.multipart("/api/v1/mappingAdministration/" + EXAMPLE_SCHEMA_ID_JSON + "/GEMMA_unknown"). |
180 | 179 | file(recordFile).
|
181 | 180 | file(mappingFile).header("If-Match", etag).with(putMultipart())).
|
182 | 181 | andExpect(status().isOk()).
|
183 | 182 | andDo(document("update-mapping", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).
|
184 | 183 | andReturn().getResponse().getHeader("ETag");
|
185 | 184 |
|
186 | 185 | // Get mapping file version 2
|
187 |
| - this.mockMvc.perform(get("/api/v1/mappingAdministration/" + EXAMPLE_SCHEMA_ID_JSON + "/" + GEMMA.name())).andExpect(status().isOk()).andDo(document("get-mapping-filev2", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).andReturn().getResponse(); |
| 186 | + this.mockMvc.perform(get("/api/v1/mappingAdministration/" + EXAMPLE_SCHEMA_ID_JSON + "/GEMMA_unknown")).andExpect(status().isOk()).andDo(document("get-mapping-filev2", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).andReturn().getResponse(); |
188 | 187 |
|
189 | 188 | }
|
190 | 189 |
|
|
0 commit comments