@Test public void testExpandAzureResourceId() { when(environmentNetworkResponse.getAzure().getResourceGroupName()).thenReturn(RESOURCE_GROUP); when(environmentNetworkResponse.getAzure().getNetworkId()).thenReturn(NETWORK_ID); CloudSubnet expandedSubnet = SubnetListerService.expandAzureResourceId(subnet1, detailedEnvironmentResponse, SUBSCRIPTION_ID); String expectedId = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s/subnets/%s", SUBSCRIPTION_ID, RESOURCE_GROUP, NETWORK_ID, subnet1.getId()); assertEquals(expectedId, expandedSubnet.getId()); }
@VisibleForTesting static CloudSubnet expandAzureResourceId(CloudSubnet meta, DetailedEnvironmentResponse environmentResponse, String subscriptionId) { StringBuilder expandedId = new StringBuilder("/subscriptions/"); expandedId.append(subscriptionId); expandedId.append("/resourceGroups/").append(environmentResponse.getNetwork().getAzure().getResourceGroupName()); expandedId.append("/providers/Microsoft.Network/virtualNetworks/").append(environmentResponse.getNetwork().getAzure().getNetworkId()); expandedId.append("/subnets/").append(meta.getId()); return meta.withId(expandedId.toString()); }
SubnetListerService { @VisibleForTesting static CloudSubnet expandAzureResourceId(CloudSubnet meta, DetailedEnvironmentResponse environmentResponse, String subscriptionId) { StringBuilder expandedId = new StringBuilder("/subscriptions/"); expandedId.append(subscriptionId); expandedId.append("/resourceGroups/").append(environmentResponse.getNetwork().getAzure().getResourceGroupName()); expandedId.append("/providers/Microsoft.Network/virtualNetworks/").append(environmentResponse.getNetwork().getAzure().getNetworkId()); expandedId.append("/subnets/").append(meta.getId()); return meta.withId(expandedId.toString()); } }
SubnetListerService { @VisibleForTesting static CloudSubnet expandAzureResourceId(CloudSubnet meta, DetailedEnvironmentResponse environmentResponse, String subscriptionId) { StringBuilder expandedId = new StringBuilder("/subscriptions/"); expandedId.append(subscriptionId); expandedId.append("/resourceGroups/").append(environmentResponse.getNetwork().getAzure().getResourceGroupName()); expandedId.append("/providers/Microsoft.Network/virtualNetworks/").append(environmentResponse.getNetwork().getAzure().getNetworkId()); expandedId.append("/subnets/").append(meta.getId()); return meta.withId(expandedId.toString()); }  }
SubnetListerService { @VisibleForTesting static CloudSubnet expandAzureResourceId(CloudSubnet meta, DetailedEnvironmentResponse environmentResponse, String subscriptionId) { StringBuilder expandedId = new StringBuilder("/subscriptions/"); expandedId.append(subscriptionId); expandedId.append("/resourceGroups/").append(environmentResponse.getNetwork().getAzure().getResourceGroupName()); expandedId.append("/providers/Microsoft.Network/virtualNetworks/").append(environmentResponse.getNetwork().getAzure().getNetworkId()); expandedId.append("/subnets/").append(meta.getId()); return meta.withId(expandedId.toString()); }  List<CloudSubnet> listSubnets(DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform); }
SubnetListerService { @VisibleForTesting static CloudSubnet expandAzureResourceId(CloudSubnet meta, DetailedEnvironmentResponse environmentResponse, String subscriptionId) { StringBuilder expandedId = new StringBuilder("/subscriptions/"); expandedId.append(subscriptionId); expandedId.append("/resourceGroups/").append(environmentResponse.getNetwork().getAzure().getResourceGroupName()); expandedId.append("/providers/Microsoft.Network/virtualNetworks/").append(environmentResponse.getNetwork().getAzure().getNetworkId()); expandedId.append("/subnets/").append(meta.getId()); return meta.withId(expandedId.toString()); }  List<CloudSubnet> listSubnets(DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform);  }