public void testGetDomainWhenResponseIs2xx() { DomainDomainClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listDomains&listAll=true&id=1&apiKey=identity&signature=M16YxHWKST/cIRUHvWhfWovJugU%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/getdomainresponse.json")) .build()); assertEquals(client.getDomainById("1"), Domain.builder().id("1").name("ROOT").level(0).hasChild(true).build()); }
public void testGetDomainWhenResponseIs2xx() { DomainDomainApi client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listDomains&listAll=true&id=1&apiKey=identity&signature=M16YxHWKST/cIRUHvWhfWovJugU%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/getdomainresponse.json")) .build()); assertEquals(client.getDomainById("1"), Domain.builder().id("1").name("ROOT").level(0).hasChild(true).build()); }
public void testUpdateDomainWhenResponseIs2xx() { GlobalDomainClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=updateDomain&id=10&name=test-2&apiKey=identity&signature=5t1eUf2Eyf/aB6qt%2BqIj%2BmcwFIo%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/updatedomainresponse.json")) .build()); assertEquals(client.updateDomain("10", name("test-2")), Domain.builder().id("10").name("test-2").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build()); }
public void testListDomainChildrenWhenResponseIs2xx() { DomainDomainApi client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listDomainChildren&listAll=true&id=1&isrecursive=true&apiKey=identity&signature=Jn6kFkloRvfaaivlJiHd0F5J3Jk%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/listdomainchildrenresponse.json")) .build()); assertEquals(client.listDomainChildren(parentDomainId("1").isRecursive(true)), ImmutableSet.of( Domain.builder().id("2").name("jclouds1").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build(), Domain.builder().id("3").name("jclouds2").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build() )); }
public void testListDomainsWhenResponseIs2xx() { DomainDomainApi client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listDomains&listAll=true&apiKey=identity&signature=sVFaGTu0DNSTVtWy3wtRt7KTx0w%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/listdomainsresponse.json")) .build()); assertEquals(client.listDomains(), ImmutableSet.of( Domain.builder().id("1").name("ROOT").level(0).hasChild(true).build(), Domain.builder().id("2").name("jclouds1").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build() )); }
public void testListDomainChildrenWhenResponseIs2xx() { DomainDomainClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listDomainChildren&listAll=true&id=1&isrecursive=true&apiKey=identity&signature=Jn6kFkloRvfaaivlJiHd0F5J3Jk%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/listdomainchildrenresponse.json")) .build()); assertEquals(client.listDomainChildren(parentDomainId("1").isRecursive(true)), ImmutableSet.of( Domain.builder().id("2").name("jclouds1").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build(), Domain.builder().id("3").name("jclouds2").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build() )); }
public void testUpdateDomainWhenResponseIs2xx() { GlobalDomainApi client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=updateDomain&id=10&name=test-2&apiKey=identity&signature=5t1eUf2Eyf/aB6qt%2BqIj%2BmcwFIo%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/updatedomainresponse.json")) .build()); assertEquals(client.updateDomain("10", name("test-2")), Domain.builder().id("10").name("test-2").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build()); }
public void testCreateDomainWhenResponseIs2xx() { GlobalDomainApi client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&command=createDomain&" + "name=test&apiKey=identity&signature=6cxzEo7h63G0hgTTMLm4lGsSDK8%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/createdomainresponse.json")) .build()); assertEquals(client.createDomain("test"), Domain.builder().id("10").name("test").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build()); }
public void testListDomainsWhenResponseIs2xx() { DomainDomainClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listDomains&listAll=true&apiKey=identity&signature=sVFaGTu0DNSTVtWy3wtRt7KTx0w%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/listdomainsresponse.json")) .build()); assertEquals(client.listDomains(), ImmutableSet.of( Domain.builder().id("1").name("ROOT").level(0).hasChild(true).build(), Domain.builder().id("2").name("jclouds1").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build() )); }
public void testCreateDomainWhenResponseIs2xx() { GlobalDomainClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&command=createDomain&" + "name=test&apiKey=identity&signature=6cxzEo7h63G0hgTTMLm4lGsSDK8%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/createdomainresponse.json")) .build()); assertEquals(client.createDomain("test"), Domain.builder().id("10").name("test").level(1).parentDomainId("1") .parentDomainName("ROOT").hasChild(false).build()); }
public T fromDomain(Domain in) { return this .id(in.getId()) .hasChild(in.hasChild()) .level(in.getLevel()) .name(in.getName()) .networkDomain(in.getNetworkDomain()) .parentDomainId(in.getParentDomainId()) .parentDomainName(in.getParentDomainName()); } }
public T fromDomain(Domain in) { return this .id(in.getId()) .hasChild(in.hasChild()) .level(in.getLevel()) .name(in.getName()) .networkDomain(in.getNetworkDomain()) .parentDomainId(in.getParentDomainId()) .parentDomainName(in.getParentDomainName()); } }
public T fromDomain(Domain in) { return this .id(in.getId()) .hasChild(in.hasChild()) .level(in.getLevel()) .name(in.getName()) .networkDomain(in.getNetworkDomain()) .parentDomainId(in.getParentDomainId()) .parentDomainName(in.getParentDomainName()); } }