Skip to content

Commit

Permalink
add a restli delete method for subresource to support soft deletion o…
Browse files Browse the repository at this point in the history
…f aspect
  • Loading branch information
jywadhwani committed Oct 21, 2021
1 parent 7f8409e commit 963711f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.linkedin.restli.server.CreateResponse;
import com.linkedin.restli.server.PagingContext;
import com.linkedin.restli.server.PathKeys;
import com.linkedin.restli.server.UpdateResponse;
import com.linkedin.restli.server.annotations.PagingContextParam;
import com.linkedin.restli.server.annotations.RestMethod;
import com.linkedin.restli.server.annotations.ReturnEntity;
Expand Down Expand Up @@ -111,6 +112,16 @@ public Task<CreateResponse> create(@Nonnull ASPECT aspect) {
});
}

/**
* Soft deletes the latest version of aspect if it exists in the system
* @return {@link UpdateResponse} indicating the status code of the response
*/
@RestMethod.Delete
@Nonnull
public Task<UpdateResponse> delete() {
throw new UnsupportedOperationException("Delete method is not implemented");
}

/**
* Similar to {@link #create(RecordTemplate)} but uses a create lambda instead.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ public void testCreate() {
verifyNoMoreInteractions(_mockLocalDAO);
}

@Test
public void testDelete() {

runAndWait(_resource.delete());

// this should test that delete method of DAO is being called once
}

@Test
public void testCreateViaLambda() {
AspectFoo foo = new AspectFoo().setValue("foo");
Expand Down

0 comments on commit 963711f

Please sign in to comment.