mirror of https://github.com/apache/jclouds.git
Revert to HttpR* builders
This commit is contained in:
parent
6b7478f724
commit
7b7063176f
|
@ -116,9 +116,21 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCatalogMetadata() {
|
public void testGetCatalogMetadata() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
HttpRequest catalogRequest = HttpRequest.builder()
|
||||||
getStandardRequest("GET", "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"),
|
.method("GET")
|
||||||
getStandardPayloadResponse("/catalog/catalogMetadata.xml", VCloudDirectorMediaType.METADATA));
|
.endpoint(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||||
|
.headers(ImmutableMultimap.<String, String> builder()
|
||||||
|
.put("Accept", "*/*")
|
||||||
|
.put("x-vcloud-authorization", token)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse catalogResponse = HttpResponse.builder()
|
||||||
|
.statusCode(200)
|
||||||
|
.payload(payloadFromResourceWithContentType("/catalog/catalogMetadata.xml", VCloudDirectorMediaType.METADATA))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
|
||||||
|
|
||||||
Reference catalogRef = Reference.builder()
|
Reference catalogRef = Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||||
|
@ -142,9 +154,21 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCatalogMetadataEntry() {
|
public void testGetCatalogMetadataEntry() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
HttpRequest catalogRequest = HttpRequest.builder()
|
||||||
getStandardRequest("GET", "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY"),
|
.method("GET")
|
||||||
getStandardPayloadResponse("/catalog/catalogMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
.endpoint(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY"))
|
||||||
|
.headers(ImmutableMultimap.<String, String> builder()
|
||||||
|
.put("Accept", "*/*")
|
||||||
|
.put("x-vcloud-authorization", token)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse catalogResponse = HttpResponse.builder()
|
||||||
|
.statusCode(200)
|
||||||
|
.payload(payloadFromResourceWithContentType("/catalog/catalogMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
|
||||||
|
|
||||||
Reference catalogRef = Reference.builder()
|
Reference catalogRef = Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||||
|
@ -159,9 +183,21 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCatalogItem() {
|
public void testGetCatalogItem() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||||
getStandardRequest("GET", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"),
|
.method("GET")
|
||||||
getStandardPayloadResponse("/catalog/catalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM));
|
.endpoint(URI.create(endpoint + "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||||
|
.headers(ImmutableMultimap.<String, String> builder()
|
||||||
|
.put("Accept", "*/*")
|
||||||
|
.put("x-vcloud-authorization", token)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||||
|
.statusCode(200)
|
||||||
|
.payload(payloadFromResourceWithContentType("/catalog/catalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||||
|
|
||||||
Reference catalogItemReference = Reference.builder()
|
Reference catalogItemReference = Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||||
|
@ -232,9 +268,21 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCatalogItemMetadata() {
|
public void testGetCatalogItemMetadata() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||||
getStandardRequest("GET", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"),
|
.method("GET")
|
||||||
getStandardPayloadResponse("/catalog/catalogItemMetadata.xml", VCloudDirectorMediaType.METADATA));
|
.endpoint(URI.create(endpoint + "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"))
|
||||||
|
.headers(ImmutableMultimap.<String, String> builder()
|
||||||
|
.put("Accept", "*/*")
|
||||||
|
.put("x-vcloud-authorization", token)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||||
|
.statusCode(200)
|
||||||
|
.payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadata.xml", VCloudDirectorMediaType.METADATA))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||||
|
|
||||||
Reference catalogItemReference = Reference.builder()
|
Reference catalogItemReference = Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||||
|
@ -290,9 +338,21 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCatalogItemMetadataEntry() {
|
public void testGetCatalogItemMetadataEntry() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||||
getStandardRequest("GET", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY"),
|
.method("GET")
|
||||||
getStandardPayloadResponse("/catalog/catalogItemMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
.endpoint(URI.create(endpoint + "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY"))
|
||||||
|
.headers(ImmutableMultimap.<String, String> builder()
|
||||||
|
.put("Accept", "*/*")
|
||||||
|
.put("x-vcloud-authorization", token)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||||
|
.statusCode(200)
|
||||||
|
.payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY + ";version=1.5"))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||||
|
|
||||||
Reference catalogItemReference = Reference.builder()
|
Reference catalogItemReference = Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||||
|
@ -307,10 +367,22 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetCatalogItemMetadataEntry() {
|
public void testSetCatalogItemMetadataEntry() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||||
getStandardRequestWithPayload("PUT", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY", VCloudDirectorMediaType.TASK,
|
.method("PUT")
|
||||||
"/catalog/setCatalogItemMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE),
|
.endpoint(URI.create(endpoint + "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY"))
|
||||||
getStandardPayloadResponse("/catalog/setMetadataValueTask.xml", VCloudDirectorMediaType.TASK));
|
.headers(ImmutableMultimap.<String, String> builder()
|
||||||
|
.put("Accept", "application/vnd.vmware.vcloud.task+xml")
|
||||||
|
.put("x-vcloud-authorization", token)
|
||||||
|
.build())
|
||||||
|
.payload(payloadFromResourceWithContentType("/catalog/setCatalogItemMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||||
|
.statusCode(200)
|
||||||
|
.payload(payloadFromResourceWithContentType("/catalog/setMetadataValueTask.xml", VCloudDirectorMediaType.TASK + ";version=1.5"))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||||
|
|
||||||
Reference catalogItemReference = Reference.builder()
|
Reference catalogItemReference = Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||||
|
@ -323,14 +395,25 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
||||||
Task expected = setMetadataValueTask();
|
Task expected = setMetadataValueTask();
|
||||||
|
|
||||||
assertEquals(client.getCatalogClient().setCatalogItemMetadataEntry(catalogItemReference, "KEY", value), expected);
|
assertEquals(client.getCatalogClient().setCatalogItemMetadataEntry(catalogItemReference, "KEY", value), expected);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteCatalogItemMetadataEntry() {
|
public void testDeleteCatalogItemMetadataEntry() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||||
getStandardRequest("DELETE", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY", VCloudDirectorMediaType.TASK),
|
.method("DELETE")
|
||||||
getStandardPayloadResponse("/catalog/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK));
|
.endpoint(URI.create(endpoint + "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY"))
|
||||||
|
.headers(ImmutableMultimap.<String, String> builder()
|
||||||
|
.put("Accept", "*/*")
|
||||||
|
.put("x-vcloud-authorization", token)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||||
|
.statusCode(200)
|
||||||
|
.payload(payloadFromResourceWithContentType("/catalog/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||||
|
|
||||||
Reference catalogItemReference = Reference.builder()
|
Reference catalogItemReference = Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||||
|
|
Loading…
Reference in New Issue