use of com.vmware.photon.controller.model.adapters.azure.ea.enumeration.AzureSubscriptionEndpointCreationService.AzureSubscriptionEndpointCreationRequest in project photon-model by vmware.
the class AzureSubscriptionEndpointCreationServiceTest method testSubscriptionEndpointCreation.
@Test
public void testSubscriptionEndpointCreation() throws Throwable {
AzureSubscriptionEndpointCreationRequest request = new AzureSubscriptionEndpointCreationRequest();
request.resourceReference = UriUtils.buildUri(this.host, this.eaEndPointLink);
request.subscriptionId = SUBSCRIPTION_ID;
request.accountId = ACCOUNT_ID;
Operation endPointCreationOp = Operation.createPatch(this.host, AzureSubscriptionEndpointCreationService.SELF_LINK);
endPointCreationOp.setBody(request);
TestRequestSender sender = new TestRequestSender(this.host);
EndpointState subscriptionEndpoint = sender.sendAndWait(endPointCreationOp, EndpointState.class);
// Assert the subscriptionEndpoint created
Assert.assertEquals(this.eaEndPointLink, subscriptionEndpoint.parentLink);
Assert.assertNotNull(subscriptionEndpoint.endpointProperties.get(EndpointConfigRequest.USER_LINK_KEY));
Assert.assertEquals(SUBSCRIPTION_ID, subscriptionEndpoint.endpointProperties.get(EndpointConfigRequest.USER_LINK_KEY));
ComputeState cs = getServiceSynchronously(subscriptionEndpoint.computeLink, ComputeState.class);
Assert.assertNotNull(cs.customProperties.get(AzureConstants.AZURE_ACCOUNT_OWNER_EMAIL_ID));
Assert.assertEquals(ACCOUNT_ID, cs.customProperties.get(AzureConstants.AZURE_ACCOUNT_OWNER_EMAIL_ID));
Assert.assertNotNull(cs.customProperties.get(AzureConstants.AZURE_SUBSCRIPTION_ID_KEY));
Assert.assertEquals(SUBSCRIPTION_ID, cs.customProperties.get(AzureConstants.AZURE_SUBSCRIPTION_ID_KEY));
}
use of com.vmware.photon.controller.model.adapters.azure.ea.enumeration.AzureSubscriptionEndpointCreationService.AzureSubscriptionEndpointCreationRequest in project photon-model by vmware.
the class AzureSubscriptionEndpointsEnumerationService method createSubscriptionEndpointCreationRequest.
private AzureSubscriptionEndpointCreationRequest createSubscriptionEndpointCreationRequest(AzureSubscriptionEndpointsEnumerationContext context, AzureSubscription subscription) {
AzureSubscriptionEndpointCreationRequest request = new AzureSubscriptionEndpointCreationRequest();
request.accountId = subscription.parentEntityId;
request.subscriptionId = subscription.entityId;
request.resourceReference = UriUtils.extendUri(ClusterUtil.getClusterUri(getHost(), ServiceTypeCluster.INVENTORY_SERVICE), context.parent.endpointLink);
return request;
}
Aggregations