catch (IllegalArgumentException e) {
fail("testParse failed: " + e.toString());
}
try { // Test given node ID ...
SessionName tmp = new SessionName(glob, new NodeId("avalon"), "client/jack");
SessionName sessionName = new SessionName(glob, tmp, -4);
System.out.println("AbsoluteName=" + sessionName.getAbsoluteName() + " RelativeName=" + sessionName.getRelativeName());
if (SessionName.useSessionMarker())
assertEquals("Expected /node/avalon/client/jack/session/-4 but was:" + sessionName.getAbsoluteName(), "/node/avalon/client/jack/session/-4", sessionName.getAbsoluteName());
else
assertEquals("Expected /node/avalon/client/jack/-4 but was:" + sessionName.getAbsoluteName(), "/node/avalon/client/jack/-4", sessionName.getAbsoluteName());
assertEquals("", "avalon", sessionName.getNodeId().getId());
if (SessionName.useSessionMarker())
assertEquals("", "client/jack/session/-4", sessionName.getRelativeName());
else
assertEquals("", "client/jack/-4", sessionName.getRelativeName());
assertEquals("", "jack", sessionName.getLoginName());
assertEquals("", -4L, sessionName.getPublicSessionId());
}
catch (IllegalArgumentException e) {
fail("testParse failed: " + e.toString());
}
try { // Test given node ID ...
SessionName tmp = new SessionName(glob, new NodeId("/node/avalon"), "client/jack");
SessionName sessionName = new SessionName(glob, tmp, -4);
System.out.println("AbsoluteName=" + sessionName.getAbsoluteName() + " RelativeName=" + sessionName.getRelativeName());
if (SessionName.useSessionMarker())
assertEquals("", "/node/avalon/client/jack/session/-4", sessionName.getAbsoluteName());
else
assertEquals("", "/node/avalon/client/jack/-4", sessionName.getAbsoluteName());
assertEquals("", "avalon", sessionName.getNodeId().getId());
if (SessionName.useSessionMarker())
assertEquals("", "client/jack/session/-4", sessionName.getRelativeName());
else
assertEquals("", "client/jack/-4", sessionName.getRelativeName());
assertEquals("", "jack", sessionName.getLoginName());
assertEquals("", -4L, sessionName.getPublicSessionId());
}
catch (IllegalArgumentException e) {
fail("testParse failed: " + e.toString());
}
try { // Test given node ID ...
SessionName sessionName = new SessionName(glob, new NodeId("/node/sauron/client/jack/99"), "/node/heron/client/jack/99");
System.out.println("AbsoluteName=" + sessionName.getAbsoluteName() + " RelativeName=" + sessionName.getRelativeName());
if (SessionName.useSessionMarker())
assertEquals("", "/node/sauron/client/jack/session/99", sessionName.getAbsoluteName());
else
assertEquals("", "/node/sauron/client/jack/99", sessionName.getAbsoluteName());
assertEquals("", "sauron", sessionName.getNodeId().getId());
if (SessionName.useSessionMarker())
assertEquals("", "client/jack/session/99", sessionName.getRelativeName());
else
assertEquals("", "client/jack/99", sessionName.getRelativeName());
assertEquals("", "jack", sessionName.getLoginName());
assertEquals("", 99L, sessionName.getPublicSessionId());
}
catch (IllegalArgumentException e) {
fail("testParse failed: " + e.toString());
}
try { // Test given node ID ...
new SessionName(glob, new NodeId("/avalon"), "client/jack");
fail("testParse failed, nodeId is invalid.");
}
catch (IllegalArgumentException e) {
System.out.println("SUCCESS: " + e.toString());
}