diff --git a/cadc-access-control/src/main/java/ca/nrc/cadc/ac/GroupURI.java b/cadc-access-control/src/main/java/ca/nrc/cadc/ac/GroupURI.java index 507dc99c2554187281895bc4766d0f4056e6cd0e..68a87acd53e6edc2c59ddfaced6b0813dae0b324 100644 --- a/cadc-access-control/src/main/java/ca/nrc/cadc/ac/GroupURI.java +++ b/cadc-access-control/src/main/java/ca/nrc/cadc/ac/GroupURI.java @@ -160,11 +160,8 @@ public class GroupURI return true; if (other instanceof GroupURI) { - - GroupURI oID = (GroupURI) other; - String otherURI = getServiceIDString() + "?" + oID.getName(); - String thisURI = getServiceIDString() + "?" + this.getName(); - return thisURI.equals(otherURI); + GroupURI otherURI = (GroupURI) other; + return uri.equals(otherURI.getURI()); } return false; } @@ -179,16 +176,6 @@ public class GroupURI return uri; } - /** - * Returns the decoded authority component of the URI. - * - * @return authority of the URI, or null if the authority is undefined. - */ - public String getAuthority() - { - return uri.getAuthority(); - } - /** * Returns the decoded fragment component of the URI. * @@ -199,17 +186,12 @@ public class GroupURI return uri.getQuery(); } - public String getServiceIDString() + public URI getServiceID() { - return uri.getScheme() + + String serviceIDString = uri.getScheme() + "://" + uri.getAuthority() + uri.getPath(); - } - - public URI getServiceID() - { - String serviceIDString = getServiceIDString(); try { return new URI(serviceIDString); diff --git a/cadc-access-control/src/test/java/ca/nrc/cadc/ac/GroupURITest.java b/cadc-access-control/src/test/java/ca/nrc/cadc/ac/GroupURITest.java index 16b658bbefa8308e336af149285fedb6f5575f78..db202c749558b9fa17c202d7d667894105840280 100644 --- a/cadc-access-control/src/test/java/ca/nrc/cadc/ac/GroupURITest.java +++ b/cadc-access-control/src/test/java/ca/nrc/cadc/ac/GroupURITest.java @@ -58,7 +58,6 @@ public class GroupURITest { GroupURI g = new GroupURI("ivo://my.authority/gms?name"); Assert.assertEquals("ivo", g.getURI().getScheme()); - Assert.assertEquals("my.authority", g.getAuthority()); Assert.assertEquals("/gms", g.getURI().getPath()); Assert.assertEquals("name", g.getName()); Assert.assertEquals("ivo://my.authority/gms", g.getServiceID().toString()); @@ -77,7 +76,6 @@ public class GroupURITest { GroupURI g = new GroupURI("ivo://my.authority/gms#name"); Assert.assertEquals("ivo", g.getURI().getScheme()); - Assert.assertEquals("my.authority", g.getAuthority()); Assert.assertEquals("/gms", g.getURI().getPath()); Assert.assertEquals("name", g.getName()); Assert.assertEquals("ivo://my.authority/gms", g.getServiceID().toString());