Loading cadc-access-control/src/main/java/ca/nrc/cadc/ac/GroupURI.java +17 −9 Original line number Diff line number Diff line Loading @@ -156,16 +156,19 @@ public class GroupURI } @Override public boolean equals(Object rhs) public boolean equals(Object other) { if (rhs == null) if (other == null) return false; if (this == rhs) if (this == other) return true; if (rhs instanceof GroupURI) if (other instanceof GroupURI) { GroupURI vu = (GroupURI) rhs; return uri.toString().equals(vu.uri.toString()); GroupURI oID = (GroupURI) other; String otherURI = getServiceIDString() + "?" + oID.getName(); String thisURI = getServiceIDString() + "?" + this.getName(); return thisURI.equals(otherURI); } return false; } Loading Loading @@ -200,15 +203,20 @@ public class GroupURI return name; } public URI getServiceID() public String getServiceIDString() { String serviceID = uri.getScheme() + return uri.getScheme() + "://" + uri.getAuthority() + uri.getPath(); } public URI getServiceID() { String serviceIDString = getServiceIDString(); try { return new URI(serviceID); return new URI(serviceIDString); } catch (URISyntaxException e) { Loading cadc-access-control/src/test/java/ca/nrc/cadc/ac/GroupURITest.java +12 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,18 @@ public class GroupURITest Log4jInit.setLevel("ca.nrc.cadc.ac", Level.DEBUG); } @Test public void testEquals() { GroupURI uri1 = new GroupURI("ivo://example.org/gms?name"); GroupURI uri2 = new GroupURI("ivo://example.org/gms?name"); Assert.assertTrue(uri1.equals(uri2)); uri1 = new GroupURI("ivo://example.org/gms?name"); uri2 = new GroupURI("ivo://example.org/gms#name"); Assert.assertTrue(uri1.equals(uri2)); } @Test public void testMalformed() { Loading Loading
cadc-access-control/src/main/java/ca/nrc/cadc/ac/GroupURI.java +17 −9 Original line number Diff line number Diff line Loading @@ -156,16 +156,19 @@ public class GroupURI } @Override public boolean equals(Object rhs) public boolean equals(Object other) { if (rhs == null) if (other == null) return false; if (this == rhs) if (this == other) return true; if (rhs instanceof GroupURI) if (other instanceof GroupURI) { GroupURI vu = (GroupURI) rhs; return uri.toString().equals(vu.uri.toString()); GroupURI oID = (GroupURI) other; String otherURI = getServiceIDString() + "?" + oID.getName(); String thisURI = getServiceIDString() + "?" + this.getName(); return thisURI.equals(otherURI); } return false; } Loading Loading @@ -200,15 +203,20 @@ public class GroupURI return name; } public URI getServiceID() public String getServiceIDString() { String serviceID = uri.getScheme() + return uri.getScheme() + "://" + uri.getAuthority() + uri.getPath(); } public URI getServiceID() { String serviceIDString = getServiceIDString(); try { return new URI(serviceID); return new URI(serviceIDString); } catch (URISyntaxException e) { Loading
cadc-access-control/src/test/java/ca/nrc/cadc/ac/GroupURITest.java +12 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,18 @@ public class GroupURITest Log4jInit.setLevel("ca.nrc.cadc.ac", Level.DEBUG); } @Test public void testEquals() { GroupURI uri1 = new GroupURI("ivo://example.org/gms?name"); GroupURI uri2 = new GroupURI("ivo://example.org/gms?name"); Assert.assertTrue(uri1.equals(uri2)); uri1 = new GroupURI("ivo://example.org/gms?name"); uri2 = new GroupURI("ivo://example.org/gms#name"); Assert.assertTrue(uri1.equals(uri2)); } @Test public void testMalformed() { Loading