Compare commits
9 commits
279fec4d96
...
d30745f024
Author | SHA1 | Date | |
---|---|---|---|
d30745f024 | |||
125f174b3b | |||
0d359c4d0b | |||
f64932a637 | |||
e14c0f2c36 | |||
|
ae09d81526 | ||
119948b743 | |||
|
a11c5940b5 | ||
ebb7a70f47 |
4 changed files with 2 additions and 67 deletions
27
api/pmt.yml
27
api/pmt.yml
|
@ -143,29 +143,4 @@ paths:
|
||||||
500:
|
500:
|
||||||
$ref: "#/components/responses/InternalError"
|
$ref: "#/components/responses/InternalError"
|
||||||
503:
|
503:
|
||||||
$ref: "#/components/responses/ServiceUnavailable"
|
$ref: "#/components/responses/ServiceUnavailable"
|
||||||
/project/{id}:
|
|
||||||
delete:
|
|
||||||
operationId: "deleteProject"
|
|
||||||
description: "Delete a specific Project"
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: id
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
required: true
|
|
||||||
responses:
|
|
||||||
204:
|
|
||||||
description: "Deletes a specific Project"
|
|
||||||
401:
|
|
||||||
$ref: "#/components/responses/Unauthorized"
|
|
||||||
404:
|
|
||||||
description: "Project not found"
|
|
||||||
content:
|
|
||||||
text/plain:
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
500:
|
|
||||||
$ref: "#/components/responses/InternalError"
|
|
||||||
|
|
|
@ -110,6 +110,7 @@ tasks {
|
||||||
}
|
}
|
||||||
withType<Test> {
|
withType<Test> {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
|
maxParallelForks = 1
|
||||||
}
|
}
|
||||||
named("compileJava").configure {
|
named("compileJava").configure {
|
||||||
dependsOn(swaggerSources.getByName("pmt").code)
|
dependsOn(swaggerSources.getByName("pmt").code)
|
||||||
|
|
|
@ -41,16 +41,6 @@ public class ApiController implements DefaultApi {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResponseEntity<Void> deleteProject(Long id) {
|
|
||||||
if (!projectRepository.existsById(id)) {
|
|
||||||
return ResponseEntity.notFound().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
projectRepository.deleteById(id);
|
|
||||||
return ResponseEntity.noContent().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<GetAllProjectsDTO> getAllProjects() {
|
public ResponseEntity<GetAllProjectsDTO> getAllProjects() {
|
||||||
GetAllProjectsDTO response = new GetAllProjectsDTO();
|
GetAllProjectsDTO response = new GetAllProjectsDTO();
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
package de.hmmh.pmt.project;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
|
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import de.hmmh.pmt.IntegrationTest;
|
|
||||||
import de.hmmh.pmt.db.Project;
|
|
||||||
|
|
||||||
public class DeleteTest extends IntegrationTest {
|
|
||||||
@Test
|
|
||||||
void projectNotFound() throws Exception {
|
|
||||||
mvc
|
|
||||||
.perform(delete(baseUri + "/project/1"))
|
|
||||||
.andExpect(status().isNotFound())
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void deletedSuccessfully() throws Exception {
|
|
||||||
Map<String,Project> allProjects = createTestProjectData();
|
|
||||||
mvc
|
|
||||||
.perform(delete(baseUri + "/project/" + allProjects.get("space-station").getId()))
|
|
||||||
.andExpect(status().isNoContent())
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue