test_class.file: modules/flowable-rest/src/test/java/org/flowable/rest/service/api/repository/DeploymentResourceTest.java
test_class.identifier: DeploymentResourceTest
test_class.superclass: extends BaseSpringRestTestCase
test_case.body: @Test
      public void testPostNewDeploymentBarFileWithTenantId() throws Exception {
          try {
              // Create zip with bpmn-file and resource
              ByteArrayOutputStream zipOutput = new ByteArrayOutputStream();
              ZipOutputStream zipStream = new ZipOutputStream(zipOutput);
  
              // Add bpmn-xml
              zipStream.putNextEntry(new ZipEntry("oneTaskProcess.bpmn20.xml"));
              IOUtils.copy(ReflectUtil.getResourceAsStream("org/flowable/rest/service/api/repository/oneTaskProcess.bpmn20.xml"), zipStream);
              zipStream.closeEntry();
  
              // Add text-resource
              zipStream.putNextEntry(new ZipEntry("test.txt"));
              IOUtils.write("Testing REST-deployment", zipStream, StandardCharsets.UTF_8);
              zipStream.closeEntry();
              zipStream.close();
  
              // Upload a bar-file using multipart-data
              HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT_COLLECTION));
              httpPost.setEntity(
                      HttpMultipartHelper.getMultiPartEntity("test-deployment.bar", "application/zip", new ByteArrayInputStream(zipOutput.toByteArray()),
                              Collections.singletonMap("tenantId", "myTenant")));
              CloseableHttpResponse response = executeBinaryRequest(httpPost, HttpStatus.SC_CREATED);
  
              // Check deployment
              JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
              closeResponse(response);
  
              assertThatJson(responseNode)
                      .when(Option.IGNORING_EXTRA_FIELDS)
                      .isEqualTo("{"
                              + "tenantId: 'myTenant'"
                              + "}");
  
              String id = responseNode.get("id").textValue();
              Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(id).singleResult();
              assertThat(deployment).isNotNull();
              assertThat(deployment.getTenantId()).isEqualTo("myTenant");
  
          } finally {
              // Always cleanup any created deployments, even if the test failed
              List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
              for (Deployment deployment : deployments) {
                  repositoryService.deleteDeployment(deployment.getId(), true);
              }
          }
      }
test_case.class_method_signature: DeploymentResourceTest.testPostNewDeploymentBarFileWithTenantId()
test_case.full_signature: @Test public void testPostNewDeploymentBarFileWithTenantId()
test_case.identifier: testPostNewDeploymentBarFileWithTenantId
test_case.invocations: putNextEntry copy getResourceAsStream closeEntry putNextEntry write closeEntry close createRelativeResourceUrl setEntity getMultiPartEntity toByteArray singletonMap executeBinaryRequest readTree getContent getEntity closeResponse isEqualTo when assertThatJson textValue get singleResult deploymentId createDeploymentQuery isNotNull assertThat isEqualTo assertThat getTenantId list createDeploymentQuery deleteDeployment getId
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPostNewDeploymentBarFileWithTenantId()
focal_class.declarator: restResponseFactory
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected RestResponseFactory restResponseFactory;
focal_class.type: RestResponseFactory
focal_class.var_name: restResponseFactory
focal_class.declarator: repositoryService
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected RepositoryService repositoryService;
focal_class.type: RepositoryService
focal_class.var_name: repositoryService
focal_class.declarator: restApiInterceptor
focal_class.modifier: @Autowired(required=false)
      protected
focal_class.original_string: @Autowired(required=false)
      protected BpmnRestApiInterceptor restApiInterceptor;
focal_class.type: BpmnRestApiInterceptor
focal_class.var_name: restApiInterceptor
focal_class.file: modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/DeploymentResource.java
focal_class.identifier: DeploymentResource
focal_class.class_method_signature: DeploymentResource.getDeployment(@ApiParam(name = "deploymentId", value ="The id of the deployment to get.") @PathVariable String deploymentId, HttpServletRequest request)
focal_class.full_signature: @ApiOperation(value = "Get a deployment", tags = { "Deployment" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the deployment was found and returned."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @GetMapping(value = "/repository/deployments/{deploymentId}", produces = "application/json") public DeploymentResponse getDeployment(@ApiParam(name = "deploymentId", value ="The id of the deployment to get.") @PathVariable String deploymentId, HttpServletRequest request)
focal_class.identifier: getDeployment
focal_class.modifiers: @ApiOperation(value = "Get a deployment", tags = { "Deployment" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the deployment was found and returned."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @GetMapping(value = "/repository/deployments/{deploymentId}", produces = "application/json") public
focal_class.parameters: (@ApiParam(name = "deploymentId", value ="The id of the deployment to get.") @PathVariable String deploymentId, HttpServletRequest request)
focal_class.return: DeploymentResponse
focal_class.signature: DeploymentResponse getDeployment(@ApiParam(name = "deploymentId", value ="The id of the deployment to get.") @PathVariable String deploymentId, HttpServletRequest request)
focal_class.class_method_signature: DeploymentResource.deleteDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response)
focal_class.full_signature: @ApiOperation(value = "Delete a deployment", tags = { "Deployment" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the deployment was found and has been deleted. Response-body is intentionally empty."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @DeleteMapping(value = "/repository/deployments/{deploymentId}", produces = "application/json") public void deleteDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response)
focal_class.identifier: deleteDeployment
focal_class.modifiers: @ApiOperation(value = "Delete a deployment", tags = { "Deployment" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the deployment was found and has been deleted. Response-body is intentionally empty."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @DeleteMapping(value = "/repository/deployments/{deploymentId}", produces = "application/json") public
focal_class.parameters: (@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response)
focal_class.return: void
focal_class.signature: void deleteDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response)
focal_method.body: @ApiOperation(value = "Delete a deployment", tags = { "Deployment" })
      @ApiResponses(value = {
              @ApiResponse(code = 204, message = "Indicates the deployment was found and has been deleted. Response-body is intentionally empty."),
              @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.")
      })
      @DeleteMapping(value = "/repository/deployments/{deploymentId}", produces = "application/json")
      public void deleteDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response) {
          
          Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
  
          if (deployment == null) {
              throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class);
          }
          
          if (restApiInterceptor != null) {
              restApiInterceptor.deleteDeployment(deployment);
          }
  
          if (cascade) {
              repositoryService.deleteDeployment(deploymentId, true);
          } else {
              repositoryService.deleteDeployment(deploymentId);
          }
          response.setStatus(HttpStatus.NO_CONTENT.value());
      }
focal_method.class_method_signature: DeploymentResource.deleteDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response)
focal_method.full_signature: @ApiOperation(value = "Delete a deployment", tags = { "Deployment" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the deployment was found and has been deleted. Response-body is intentionally empty."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @DeleteMapping(value = "/repository/deployments/{deploymentId}", produces = "application/json") public void deleteDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response)
focal_method.identifier: deleteDeployment
focal_method.invocations: singleResult deploymentId createDeploymentQuery deleteDeployment deleteDeployment deleteDeployment setStatus value
focal_method.modifiers: @ApiOperation(value = "Delete a deployment", tags = { "Deployment" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the deployment was found and has been deleted. Response-body is intentionally empty."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @DeleteMapping(value = "/repository/deployments/{deploymentId}", produces = "application/json") public
focal_method.parameters: (@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response)
focal_method.return: void
focal_method.signature: void deleteDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
              HttpServletResponse response)