private List<Object> args(URI location) { String[] locationArgs = location.getPath().split("/"); List<Object> args = new ArrayList<Object>(); args.add(root.getFragment()); Collections.addAll(args, locationArgs); args.add(includeStyle); String implemented = URIUtil.getAttribute(location, "implemented"); args.add(implemented == null ? Boolean.valueOf(true) : Boolean.valueOf(implemented)); return args; } }
public AtlassianRepository(String... args) { this.root = URI.create(URIUtil.raw(args[0])); String includeAtt = URIUtil.getAttribute(root, "includeStyle"); includeStyle = includeAtt == null ? true : Boolean.valueOf(includeAtt); if (args.length == 3) { username = args[1]; password = args[2]; } }
public LivingDocRepository(String... args) throws IllegalArgumentException { if (args.length == 0) { throw new IllegalArgumentException("No root specified"); } this.root = URI.create(URIUtil.raw(args[0])); String includeAtt = URIUtil.getAttribute(root, "includeStyle"); includeStyle = includeAtt == null || Boolean.valueOf(includeAtt); String implementedAtt = URIUtil.getAttribute(root, "implemented"); if (implementedAtt != null) { implemented = Boolean.parseBoolean(implementedAtt); } handler = URIUtil.getAttribute(root, "handler"); if (handler == null) { throw new IllegalArgumentException("No handler specified"); } sut = URIUtil.getAttribute(root, "sut"); if (sut == null) { throw new IllegalArgumentException("No sut specified"); } String postExecutionResultAtt = URIUtil.getAttribute(root, "postExecutionResult"); if (postExecutionResultAtt != null) { postExecutionResult = Boolean.parseBoolean(postExecutionResultAtt); } if (args.length == 3) { username = args[1]; password = args[2]; } }
@Test public void testWeCanRetrieveTheAttributesFromAnUri() { URI myUri = URI.create("http://domain:port/context/path?att1=attribute1&att2=attribute2&att3=attribute3"); assertEquals("attribute1", URIUtil.getAttribute(myUri, "att1")); assertEquals("attribute2", URIUtil.getAttribute(myUri, "att2")); assertEquals("attribute3", URIUtil.getAttribute(myUri, "att3")); }