test_class.declarator: service = mock(ComputationService.class)
test_class.modifier: private static
test_class.original_string: private static IComputationService service = mock(ComputationService.class);
test_class.type: IComputationService
test_class.var_name: service
test_class.declarator: computation
test_class.modifier: private static
test_class.original_string: private static ComputationDomain computation;
test_class.type: ComputationDomain
test_class.var_name: computation
test_class.declarator: updatedComputation
test_class.modifier: private static
test_class.original_string: private static ComputationDomain updatedComputation;
test_class.type: ComputationDomain
test_class.var_name: updatedComputation
test_class.declarator: resource
test_class.modifier: private static
test_class.original_string: private static ComputationResource resource;
test_class.type: ComputationResource
test_class.var_name: resource
test_class.declarator: tenant = "tenant"
test_class.modifier: private static
test_class.original_string: private static String tenant = "tenant";
test_class.type: String
test_class.var_name: tenant
test_class.file: fabric-manager/src/test/java/com/olacabs/fabric/manager/resource/ComputationResourceTest.java
test_class.identifier: ComputationResourceTest
test_case.body: @Test
      public void testValidSave() {
          doReturn(computation).when(service).saveOrUpdate(anyString(), any(ComputationDomain.class));
  
          final Response response = resource.saveOrUpdate(tenant, computation);
          Assert.assertEquals(response.getStatus(), 201);
          Assert.assertEquals(response.getEntity(), computation);
      }
test_case.class_method_signature: ComputationResourceTest.testValidSave()
test_case.full_signature: @Test public void testValidSave()
test_case.identifier: testValidSave
test_case.invocations: saveOrUpdate when doReturn anyString any saveOrUpdate assertEquals getStatus assertEquals getEntity
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidSave()
focal_class.declarator: service
focal_class.modifier: private final
focal_class.original_string: private final IComputationService service;
focal_class.type: IComputationService
focal_class.var_name: service
focal_class.file: fabric-manager/src/main/java/com/olacabs/fabric/manager/resource/ComputationResource.java
focal_class.identifier: ComputationResource
focal_class.class_method_signature: ComputationResource.saveOrUpdate(@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation)
focal_class.full_signature: @UserRequired @POST @Timed @Consumes(MediaType.APPLICATION_JSON) @UnitOfWork @Path("{tenant}") @ApiOperation(value = "Save/update computation, basically creates a new version", response = ComputationDomain.class) public Response saveOrUpdate(@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation)
focal_class.identifier: saveOrUpdate
focal_class.modifiers: @UserRequired @POST @Timed @Consumes(MediaType.APPLICATION_JSON) @UnitOfWork @Path("{tenant}") @ApiOperation(value = "Save/update computation, basically creates a new version", response = ComputationDomain.class) public
focal_class.parameters: (@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation)
focal_class.return: Response
focal_class.signature: Response saveOrUpdate(@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation)
focal_class.class_method_signature: ComputationResource.getLatestByName(@PathParam("tenant") final String tenant, @PathParam("name") final String name,
              @QueryParam("version") final Integer version)
focal_class.full_signature: @GET @Timed @UnitOfWork(transactional = false) @Path("{tenant}/{name}") @ApiOperation(value = "Get latest computation based on name and version(optional)", response = ComputationDomain.class) public Response getLatestByName(@PathParam("tenant") final String tenant, @PathParam("name") final String name,
              @QueryParam("version") final Integer version)
focal_class.identifier: getLatestByName
focal_class.modifiers: @GET @Timed @UnitOfWork(transactional = false) @Path("{tenant}/{name}") @ApiOperation(value = "Get latest computation based on name and version(optional)", response = ComputationDomain.class) public
focal_class.parameters: (@PathParam("tenant") final String tenant, @PathParam("name") final String name,
              @QueryParam("version") final Integer version)
focal_class.return: Response
focal_class.signature: Response getLatestByName(@PathParam("tenant") final String tenant, @PathParam("name") final String name,
              @QueryParam("version") final Integer version)
focal_class.class_method_signature: ComputationResource.search(@PathParam("tenant") final String tenant,
                             @QueryParam("name") final String name,
                             @QueryParam("version") final Integer version,
                             @QueryParam("latest") @DefaultValue("true") final Boolean latest)
focal_class.full_signature: @GET @Timed @UnitOfWork(transactional = false) @Path("{tenant}") @ApiOperation(value = "Search computation based on params", response = List.class) public Response search(@PathParam("tenant") final String tenant,
                             @QueryParam("name") final String name,
                             @QueryParam("version") final Integer version,
                             @QueryParam("latest") @DefaultValue("true") final Boolean latest)
focal_class.identifier: search
focal_class.modifiers: @GET @Timed @UnitOfWork(transactional = false) @Path("{tenant}") @ApiOperation(value = "Search computation based on params", response = List.class) public
focal_class.parameters: (@PathParam("tenant") final String tenant,
                             @QueryParam("name") final String name,
                             @QueryParam("version") final Integer version,
                             @QueryParam("latest") @DefaultValue("true") final Boolean latest)
focal_class.return: Response
focal_class.signature: Response search(@PathParam("tenant") final String tenant,
                             @QueryParam("name") final String name,
                             @QueryParam("version") final Integer version,
                             @QueryParam("latest") @DefaultValue("true") final Boolean latest)
focal_class.class_method_signature: ComputationResource.delete(@PathParam("tenant") final String tenant, @PathParam("internalId") final int id)
focal_class.full_signature: @DELETE @Timed @Path("{tenant}/{internalId}") @UnitOfWork @UserRequired @ApiOperation(value = "Soft delete computation") public Response delete(@PathParam("tenant") final String tenant, @PathParam("internalId") final int id)
focal_class.identifier: delete
focal_class.modifiers: @DELETE @Timed @Path("{tenant}/{internalId}") @UnitOfWork @UserRequired @ApiOperation(value = "Soft delete computation") public
focal_class.parameters: (@PathParam("tenant") final String tenant, @PathParam("internalId") final int id)
focal_class.return: Response
focal_class.signature: Response delete(@PathParam("tenant") final String tenant, @PathParam("internalId") final int id)
focal_class.class_method_signature: ComputationResource.get(@PathParam("tenant") final String tenant, @PathParam("internalId") final int id)
focal_class.full_signature: @GET @Timed @Path(("{tenant}/id/{internalId}")) @UnitOfWork(transactional = false) public Response get(@PathParam("tenant") final String tenant, @PathParam("internalId") final int id)
focal_class.identifier: get
focal_class.modifiers: @GET @Timed @Path(("{tenant}/id/{internalId}")) @UnitOfWork(transactional = false) public
focal_class.parameters: (@PathParam("tenant") final String tenant, @PathParam("internalId") final int id)
focal_class.return: Response
focal_class.signature: Response get(@PathParam("tenant") final String tenant, @PathParam("internalId") final int id)
focal_class.class_method_signature: ComputationResource.fetchLatest(final Set<ComputationDomain> computations)
focal_class.full_signature: private ComputationDomain fetchLatest(final Set<ComputationDomain> computations)
focal_class.identifier: fetchLatest
focal_class.modifiers: private
focal_class.parameters: (final Set<ComputationDomain> computations)
focal_class.return: ComputationDomain
focal_class.signature: ComputationDomain fetchLatest(final Set<ComputationDomain> computations)
focal_method.body: @UserRequired
      @POST
      @Timed
      @Consumes(MediaType.APPLICATION_JSON)
      @UnitOfWork
      @Path("{tenant}")
      @ApiOperation(value = "Save/update computation, basically creates a new version",
              response = ComputationDomain.class)
      public Response saveOrUpdate(@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation) {
          final ComputationDomain result = service.saveOrUpdate(tenant, computation);
          return Response.status(Response.Status.CREATED).entity(result).build();
      }
focal_method.class_method_signature: ComputationResource.saveOrUpdate(@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation)
focal_method.full_signature: @UserRequired @POST @Timed @Consumes(MediaType.APPLICATION_JSON) @UnitOfWork @Path("{tenant}") @ApiOperation(value = "Save/update computation, basically creates a new version", response = ComputationDomain.class) public Response saveOrUpdate(@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation)
focal_method.identifier: saveOrUpdate
focal_method.invocations: saveOrUpdate build entity status
focal_method.modifiers: @UserRequired @POST @Timed @Consumes(MediaType.APPLICATION_JSON) @UnitOfWork @Path("{tenant}") @ApiOperation(value = "Save/update computation, basically creates a new version", response = ComputationDomain.class) public
focal_method.parameters: (@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation)
focal_method.return: Response
focal_method.signature: Response saveOrUpdate(@PathParam("tenant") final String tenant, @Valid final ComputationDomain computation)