Skip to content

Commit

Permalink
adjust move and delete tests for cleaning up ns-anns
Browse files Browse the repository at this point in the history
  • Loading branch information
mtbc committed Apr 18, 2016
1 parent aabc35c commit 67a71ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void moveImageWithNonSharedAnnotation(String src, String dest,
if (src.equals("rwrw--")) n = 0;
param = new ParametersI();
param.addIds(annotationIdsUser2);
assertEquals(iQuery.findAllByQuery(sb.toString(), param).size(), n);
assertEquals(iQuery.findAllByQuery(sb.toString(), param).size(), 0);

loginUser(g);
param = new ParametersI();
Expand Down
27 changes: 15 additions & 12 deletions components/tools/OmeroJava/test/integration/chmod/RolesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import static org.testng.AssertJUnit.*;
import static omero.rtypes.rstring;
import omero.cmd.Delete2;
import omero.cmd.graphs.ChildOption;
import omero.gateway.util.Requests;
import omero.model.Annotation;
import omero.model.CommentAnnotation;
Expand Down Expand Up @@ -57,6 +58,8 @@
*/
public class RolesTest extends AbstractServerTest {

private static final ChildOption KEEP_ANN = Requests.option().excludeType("Annotation").build();

/**
* Since we are creating a new client on each invocation, we should also
* clean it up. Note: {@link #newUserAndGroup(String)} also closes, but not
Expand Down Expand Up @@ -126,7 +129,7 @@ public void testInteractionByMemberRW() throws Exception {
}

try {
Delete2 dc = Requests.delete().target(dl).build();
Delete2 dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(false, client, dc);
} catch (Exception e) {
fail("Member should not be allowed to delete "
Expand Down Expand Up @@ -231,7 +234,7 @@ public void testInteractionByGroupOwnerRW() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down Expand Up @@ -325,7 +328,7 @@ public void testInteractionByAdminRW() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down Expand Up @@ -435,7 +438,7 @@ public void testInteractionByMemberRWR() throws Exception {
}

try {
Delete2 dc = Requests.delete().target(dl).build();
Delete2 dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(false, client, dc);
} catch (Exception e) {
fail("Member should not be allowed to delete "
Expand Down Expand Up @@ -541,7 +544,7 @@ public void testInteractionByGroupOwnerRWR() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down Expand Up @@ -626,7 +629,7 @@ public void testInteractionByAdminRWR() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down Expand Up @@ -722,7 +725,7 @@ public void testInteractionByMemberRWRA() throws Exception {
}

try {
Delete2 dc = Requests.delete().target(dl).build();
Delete2 dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(false, client, dc);
} catch (Exception e) {
fail("Member should not be allowed to delete "
Expand Down Expand Up @@ -824,7 +827,7 @@ public void testInteractionByGroupOwnerRWRA() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down Expand Up @@ -909,7 +912,7 @@ public void testInteractionByAdminRWRA() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down Expand Up @@ -993,7 +996,7 @@ public void testInteractionByMemberRWRW() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down Expand Up @@ -1082,7 +1085,7 @@ public void testInteractionByGroupOwnerRWRW() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down Expand Up @@ -1166,7 +1169,7 @@ public void testInteractionByAdminRWRW() throws Exception {
callback(true, client, dc);

// Try to delete the annotation link i.e. canDelete
dc = Requests.delete().target(dl).build();
dc = Requests.delete().target(dl).option(KEEP_ANN).build();
callback(true, client, dc);

// Try to delete the annotation i.e. canDelete
Expand Down

0 comments on commit 67a71ca

Please sign in to comment.