@Test void unremoveProject() { final WebClient client = dogma.httpClient(); createProject(client, "bar"); final String projectPath = PROJECTS_PREFIX + "/bar"; client.delete(projectPath).aggregate().join(); final RequestHeaders headers = RequestHeaders.of(HttpMethod.PATCH, projectPath, HttpHeaderNames.CONTENT_TYPE, MediaType.JSON_PATCH); final String unremovePatch = "[{\"op\":\"replace\",\"path\":\"/status\",\"value\":\"active\"}]"; final AggregatedHttpResponse aRes = client.execute(headers, unremovePatch).aggregate().join(); assertThat(ResponseHeaders.of(aRes.headers()).status()).isEqualTo(HttpStatus.OK); final String expectedJson = '{' + " \"name\": \"bar\"," + " \"creator\": {" + " \"name\": \"System\"," + " \"email\": \"system@localhost.localdomain\"" + " }," + " \"url\": \"/api/v1/projects/bar\"," + " \"createdAt\": \"${json-unit.ignore}\"" + '}'; assertThatJson(aRes.contentUtf8()).isEqualTo(expectedJson); }
@Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) public CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author) { return execute(Command.createProject(author, request.name())) .handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(request.name())))); }
ProjectServiceV1 extends AbstractService { @Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) public CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author) { return execute(Command.createProject(author, request.name())) .handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(request.name())))); } }
ProjectServiceV1 extends AbstractService { @Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) public CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author) { return execute(Command.createProject(author, request.name())) .handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(request.name())))); } ProjectServiceV1(ProjectManager projectManager, CommandExecutor executor, MetadataService mds); }
ProjectServiceV1 extends AbstractService { @Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) public CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author) { return execute(Command.createProject(author, request.name())) .handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(request.name())))); } ProjectServiceV1(ProjectManager projectManager, CommandExecutor executor, MetadataService mds); @Get("/projects") CompletableFuture<List<ProjectDto>> listProjects(@Param @Nullable String status); @Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author); @Get("/projects/{projectName}") @RequiresRole(roles = { ProjectRole.OWNER, ProjectRole.MEMBER }) CompletableFuture<ProjectMetadata> getProjectMetadata(
            @Param String projectName,
            @Param("checkPermissionOnly") @Default("false") boolean isCheckPermissionOnly); @Delete("/projects/{projectName}") @RequiresRole(roles = ProjectRole.OWNER) CompletableFuture<Void> removeProject(Project project, Author author); @Delete("/projects/{projectName}/removed") @RequiresRole(roles = ProjectRole.OWNER) CompletableFuture<Void> purgeProject(@Param String projectName, Author author); @Consumes("application/json-patch+json") @Patch("/projects/{projectName}") @RequiresAdministrator CompletableFuture<ProjectDto> patchProject(@Param String projectName, JsonNode node, Author author); }
ProjectServiceV1 extends AbstractService { @Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) public CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author) { return execute(Command.createProject(author, request.name())) .handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(request.name())))); } ProjectServiceV1(ProjectManager projectManager, CommandExecutor executor, MetadataService mds); @Get("/projects") CompletableFuture<List<ProjectDto>> listProjects(@Param @Nullable String status); @Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author); @Get("/projects/{projectName}") @RequiresRole(roles = { ProjectRole.OWNER, ProjectRole.MEMBER }) CompletableFuture<ProjectMetadata> getProjectMetadata(
            @Param String projectName,
            @Param("checkPermissionOnly") @Default("false") boolean isCheckPermissionOnly); @Delete("/projects/{projectName}") @RequiresRole(roles = ProjectRole.OWNER) CompletableFuture<Void> removeProject(Project project, Author author); @Delete("/projects/{projectName}/removed") @RequiresRole(roles = ProjectRole.OWNER) CompletableFuture<Void> purgeProject(@Param String projectName, Author author); @Consumes("application/json-patch+json") @Patch("/projects/{projectName}") @RequiresAdministrator CompletableFuture<ProjectDto> patchProject(@Param String projectName, JsonNode node, Author author);  }