@Test public void testEmptyTagForRelease() { final DataManager dataManager = mock(DataManager.class); final EnvironmentHandler environmentHandler = new EnvironmentHandler(dataManager); final PublicApiHandler handler = new PublicApiHandler(null, null, null, null, null, environmentHandler, null, null); assertThatExceptionOfType(ClientErrorException.class) .isThrownBy(() -> handler.putTagsForRelease("some-integration-id", Collections.singletonList(""))) .withMessageStartingWith("Missing environment") .satisfies(e -> assertThat(e.getResponse().getStatusInfo().toEnum()).isEqualTo(Status.NOT_FOUND)); }
@PUT @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Map<String, ContinuousDeliveryEnvironment> putTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId, @NotNull @Parameter(required = true) List<String> environments) { return environmentHandler.putTagsForRelease(integrationId, environments); }
PublicApiHandler { @PUT @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Map<String, ContinuousDeliveryEnvironment> putTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId, @NotNull @Parameter(required = true) List<String> environments) { return environmentHandler.putTagsForRelease(integrationId, environments); } }
PublicApiHandler { @PUT @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Map<String, ContinuousDeliveryEnvironment> putTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId, @NotNull @Parameter(required = true) List<String> environments) { return environmentHandler.putTagsForRelease(integrationId, environments); } protected  PublicApiHandler(DataManager dataMgr, EncryptionComponent encryptionComponent,
        IntegrationDeploymentHandler deploymentHandler, ConnectionHandler connectionHandler,
        MonitoringProvider monitoringProvider, EnvironmentHandler environmentHandler,
        IntegrationSupportHandler handler, IntegrationHandler integrationHandler); }
PublicApiHandler { @PUT @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Map<String, ContinuousDeliveryEnvironment> putTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId, @NotNull @Parameter(required = true) List<String> environments) { return environmentHandler.putTagsForRelease(integrationId, environments); } protected  PublicApiHandler(DataManager dataMgr, EncryptionComponent encryptionComponent,
        IntegrationDeploymentHandler deploymentHandler, ConnectionHandler connectionHandler,
        MonitoringProvider monitoringProvider, EnvironmentHandler environmentHandler,
        IntegrationSupportHandler handler, IntegrationHandler integrationHandler); List<String> getReleaseEnvironments(); @GET @Path("environments") @Produces(MediaType.APPLICATION_JSON) Response getReleaseEnvironments(@QueryParam("withUses") @Parameter boolean withUses); @POST @Path("environments/{env}") void addNewEnvironment(@NotNull @PathParam("env") @Parameter(required = true) String environment); @DELETE @Path("environments/{env}") void deleteEnvironment(@NotNull @PathParam("env") @Parameter(required = true) String environment); @PUT @Path("environments/{env}") @Consumes(MediaType.APPLICATION_JSON) void renameEnvironment(@NotNull @PathParam("env") @Parameter(required = true) String environment,
        @NotNull @Parameter(required = true) String newEnvironment); @GET @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) Map<String, ContinuousDeliveryEnvironment> getReleaseTags(@NotNull @PathParam("id") @Parameter(required = true) String integrationId); @DELETE @Path("integrations/{id}/tags/{env}") void deleteReleaseTag(@NotNull @PathParam("id") @Parameter(required = true) String integrationId,
        @NotNull @PathParam("env") @Parameter(required = true) String environment); @PUT @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Map<String, ContinuousDeliveryEnvironment> putTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId,
        @NotNull @Parameter(required = true) List<String> environments); @PATCH @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Map<String, ContinuousDeliveryEnvironment> patchTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId,
        @NotNull @Parameter(required = true) List<String> environments); @GET @Path("integrations/{env}/export.zip") @Produces(MediaType.APPLICATION_OCTET_STREAM) @SuppressWarnings("JdkObsolete") Response exportResources(@NotNull @PathParam("env") @Parameter(required = true) String environment,
                                    @QueryParam("all") @Parameter boolean exportAll,
                                    @QueryParam("ignoreTimestamp") @Parameter boolean ignoreTimestamp); @POST @Path("integrations") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") // https://github.com/spotbugs/spotbugs/issues/259 ContinuousDeliveryImportResults importResources(@Context SecurityContext sec,
        @NotNull @MultipartForm @Parameter(required = true) ImportFormDataInput formInput); @POST @Path("connections/{id}/properties") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) ConnectionOverview configureConnection(@Context SecurityContext sec,
                                                  @NotNull @PathParam("id") @Parameter(required = true) String connectionId,
                                                  @NotNull @QueryParam("refreshIntegrations") @Parameter Boolean refeshIntegrations,
                                                  @NotNull @Parameter(required = true) Map<String, String> properties); @GET @Path("integrations/{id}/state") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) IntegrationState getIntegrationState(@Context SecurityContext sec, @NotNull @PathParam("id") @Parameter(required = true) String integrationId); @POST @Path("integrations/{id}/deployments") @Produces(MediaType.APPLICATION_JSON) IntegrationDeployment publishIntegration(@Context final SecurityContext sec,
        @NotNull @PathParam("id") @Parameter(required = true) final String integrationId); @PUT @Path("integrations/{id}/deployments/stop") @Produces(MediaType.APPLICATION_JSON) void stopIntegration(@Context final SecurityContext sec, @NotNull @PathParam("id") @Parameter(required = true) final String integrationId); }
PublicApiHandler { @PUT @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Map<String, ContinuousDeliveryEnvironment> putTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId, @NotNull @Parameter(required = true) List<String> environments) { return environmentHandler.putTagsForRelease(integrationId, environments); } protected  PublicApiHandler(DataManager dataMgr, EncryptionComponent encryptionComponent,
        IntegrationDeploymentHandler deploymentHandler, ConnectionHandler connectionHandler,
        MonitoringProvider monitoringProvider, EnvironmentHandler environmentHandler,
        IntegrationSupportHandler handler, IntegrationHandler integrationHandler); List<String> getReleaseEnvironments(); @GET @Path("environments") @Produces(MediaType.APPLICATION_JSON) Response getReleaseEnvironments(@QueryParam("withUses") @Parameter boolean withUses); @POST @Path("environments/{env}") void addNewEnvironment(@NotNull @PathParam("env") @Parameter(required = true) String environment); @DELETE @Path("environments/{env}") void deleteEnvironment(@NotNull @PathParam("env") @Parameter(required = true) String environment); @PUT @Path("environments/{env}") @Consumes(MediaType.APPLICATION_JSON) void renameEnvironment(@NotNull @PathParam("env") @Parameter(required = true) String environment,
        @NotNull @Parameter(required = true) String newEnvironment); @GET @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) Map<String, ContinuousDeliveryEnvironment> getReleaseTags(@NotNull @PathParam("id") @Parameter(required = true) String integrationId); @DELETE @Path("integrations/{id}/tags/{env}") void deleteReleaseTag(@NotNull @PathParam("id") @Parameter(required = true) String integrationId,
        @NotNull @PathParam("env") @Parameter(required = true) String environment); @PUT @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Map<String, ContinuousDeliveryEnvironment> putTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId,
        @NotNull @Parameter(required = true) List<String> environments); @PATCH @Path("integrations/{id}/tags") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Map<String, ContinuousDeliveryEnvironment> patchTagsForRelease(@NotNull @PathParam("id") @Parameter(required = true) String integrationId,
        @NotNull @Parameter(required = true) List<String> environments); @GET @Path("integrations/{env}/export.zip") @Produces(MediaType.APPLICATION_OCTET_STREAM) @SuppressWarnings("JdkObsolete") Response exportResources(@NotNull @PathParam("env") @Parameter(required = true) String environment,
                                    @QueryParam("all") @Parameter boolean exportAll,
                                    @QueryParam("ignoreTimestamp") @Parameter boolean ignoreTimestamp); @POST @Path("integrations") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") // https://github.com/spotbugs/spotbugs/issues/259 ContinuousDeliveryImportResults importResources(@Context SecurityContext sec,
        @NotNull @MultipartForm @Parameter(required = true) ImportFormDataInput formInput); @POST @Path("connections/{id}/properties") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) ConnectionOverview configureConnection(@Context SecurityContext sec,
                                                  @NotNull @PathParam("id") @Parameter(required = true) String connectionId,
                                                  @NotNull @QueryParam("refreshIntegrations") @Parameter Boolean refeshIntegrations,
                                                  @NotNull @Parameter(required = true) Map<String, String> properties); @GET @Path("integrations/{id}/state") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) IntegrationState getIntegrationState(@Context SecurityContext sec, @NotNull @PathParam("id") @Parameter(required = true) String integrationId); @POST @Path("integrations/{id}/deployments") @Produces(MediaType.APPLICATION_JSON) IntegrationDeployment publishIntegration(@Context final SecurityContext sec,
        @NotNull @PathParam("id") @Parameter(required = true) final String integrationId); @PUT @Path("integrations/{id}/deployments/stop") @Produces(MediaType.APPLICATION_JSON) void stopIntegration(@Context final SecurityContext sec, @NotNull @PathParam("id") @Parameter(required = true) final String integrationId);  }