jclouds-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deste...@apache.org
Subject [1/2] jclouds git commit: [JCLOUDS-1474] Adds SKU field to both LB and PublicIP
Date Fri, 28 Dec 2018 21:56:11 GMT
Repository: jclouds
Updated Branches:
  refs/heads/master 2d9bb9342 -> d621edd79


http://git-wip-us.apache.org/repos/asf/jclouds/blob/d621edd7/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApiMockTest.java
b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApiMockTest.java
index 9ab8059..882b9d6 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApiMockTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApiMockTest.java
@@ -16,6 +16,8 @@
  */
 package org.jclouds.azurecompute.arm.features;
 
+import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.API_VERSION_PREFIX;
+import static org.jclouds.azurecompute.arm.domain.publicipaddress.PublicIPAddress.SKU.SKUName.Basic;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
@@ -25,9 +27,11 @@ import static org.testng.Assert.assertTrue;
 import java.util.List;
 import java.util.Map;
 
+import org.jclouds.azurecompute.arm.AzureComputeProviderMetadata;
 import org.jclouds.azurecompute.arm.domain.DnsSettings;
-import org.jclouds.azurecompute.arm.domain.PublicIPAddress;
-import org.jclouds.azurecompute.arm.domain.PublicIPAddressProperties;
+import org.jclouds.azurecompute.arm.domain.publicipaddress.PublicIPAddress;
+import org.jclouds.azurecompute.arm.domain.publicipaddress.PublicIPAddress.SKU;
+import org.jclouds.azurecompute.arm.domain.publicipaddress.PublicIPAddressProperties;
 import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
 import org.testng.annotations.Test;
 
@@ -35,12 +39,13 @@ import com.google.common.collect.ImmutableMap;
 import com.squareup.okhttp.mockwebserver.MockResponse;
 
 
-@Test(groups = "unit", testName = "NetworkInterfaceCardApiMockTest", singleThreaded = true)
+@Test(groups = "unit", testName = "PublicIPAddressApiMockTest", singleThreaded = true)
 public class PublicIPAddressApiMockTest extends BaseAzureComputeApiMockTest {
 
    private final String subscriptionid = "SUBSCRIPTIONID";
    private final String resourcegroup = "myresourcegroup";
-   private final String apiVersion = "api-version=2015-06-15";
+   private final String apiVersion = "api-version=" + AzureComputeProviderMetadata.defaultProperties()
+         .getProperty(API_VERSION_PREFIX + LoadBalancerApi.class.getSimpleName());
    private final String location = "northeurope";
    private final String publicIpName = "mypublicaddress";
 
@@ -68,6 +73,7 @@ public class PublicIPAddressApiMockTest extends BaseAzureComputeApiMockTest
{
       assertEquals(ip.properties().dnsSettings().fqdn(), "foobar.northeurope.cloudapp.azure.com");
       assertNotNull(ip.properties().ipConfiguration());
       assertEquals(ip.properties().ipConfiguration().id(), "/subscriptions/fakeb2f5-4710-4e93-bdf4-419edbde2178/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkInterfaces/myNic/ipConfigurations/myip1");
+      assertEquals(ip.sku().name(), Basic);
    }
 
    public void getPublicIPAddressInfoEmpty() throws Exception {
@@ -139,10 +145,12 @@ public class PublicIPAddressApiMockTest extends BaseAzureComputeApiMockTest
{
       PublicIPAddressProperties properties = PublicIPAddressProperties.create(null, null,
"Static", 4, null,
               DnsSettings.create("foobar", "foobar.northeurope.cloudapp.azure.com", null));
 
-      PublicIPAddress ip = ipApi.createOrUpdate(publicIpName, location, tags, properties);
+      PublicIPAddress ip = ipApi.createOrUpdate(publicIpName, location, tags, SKU.create(Basic),
properties);
 
       String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/publicIPAddresses/%s?%s",
subscriptionid, resourcegroup, publicIpName, apiVersion);
-      String json = String.format("{ \"location\": \"%s\", \"tags\": { \"testkey\": \"testvalue\"
}, \"properties\": { \"publicIPAllocationMethod\": \"Static\", \"idleTimeoutInMinutes\": 4,
\"dnsSettings\": { \"domainNameLabel\": \"foobar\", \"fqdn\": \"foobar.northeurope.cloudapp.azure.com\"
} } }", location);
+      String json = String.format("{ \"location\": \"%s\", \"tags\": { \"testkey\": \"testvalue\"
}, \"properties\": "
+            + "{ \"publicIPAllocationMethod\": \"Static\", \"idleTimeoutInMinutes\": 4, \"dnsSettings\":
{ "
+            + "\"domainNameLabel\": \"foobar\", \"fqdn\": \"foobar.northeurope.cloudapp.azure.com\"
} }, \"sku\": {\"name\": \"Basic\" } }", location);
       assertSent(server, "PUT", path, json);
 
       assertNotNull(ip);
@@ -158,6 +166,7 @@ public class PublicIPAddressApiMockTest extends BaseAzureComputeApiMockTest
{
       assertNotNull(ip.properties().dnsSettings());
       assertEquals(ip.properties().dnsSettings().domainNameLabel(), "foobar");
       assertEquals(ip.properties().dnsSettings().fqdn(), "foobar.northeurope.cloudapp.azure.com");
+      assertEquals(ip.sku().name(), Basic);
    }
 
    @Test(expectedExceptions = IllegalArgumentException.class)
@@ -172,7 +181,7 @@ public class PublicIPAddressApiMockTest extends BaseAzureComputeApiMockTest
{
       PublicIPAddressProperties properties = PublicIPAddressProperties.create(null, null,
"Static", 4, null,
               DnsSettings.create("foobar", "foobar.northeurope.cloudapp.azure.com", null));
 
-      ipApi.createOrUpdate(publicIpName, location, tags, properties);
+      ipApi.createOrUpdate(publicIpName, location, tags, null, properties);
    }
 
    public void deletePublicIPAddress() throws InterruptedException {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d621edd7/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
index 27ea354..6fde059 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
@@ -30,11 +30,11 @@ import org.jclouds.azurecompute.arm.domain.FrontendIPConfigurations;
 import org.jclouds.azurecompute.arm.domain.FrontendIPConfigurationsProperties;
 import org.jclouds.azurecompute.arm.domain.IdReference;
 import org.jclouds.azurecompute.arm.domain.IpAddressAvailabilityResult;
-import org.jclouds.azurecompute.arm.domain.LoadBalancer;
-import org.jclouds.azurecompute.arm.domain.LoadBalancerProperties;
 import org.jclouds.azurecompute.arm.domain.Subnet;
 import org.jclouds.azurecompute.arm.domain.Subnet.SubnetProperties;
 import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
+import org.jclouds.azurecompute.arm.domain.loadbalancer.LoadBalancer;
+import org.jclouds.azurecompute.arm.domain.loadbalancer.LoadBalancerProperties;
 import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiLiveTest;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -138,7 +138,7 @@ public class VirtualNetworkApiLiveTest extends BaseAzureComputeApiLiveTest
{
       LoadBalancerProperties props = LoadBalancerProperties.builder()
             .frontendIPConfigurations(ImmutableList.of(frontendIps)).build();
 
-      LoadBalancer lbCreated = lbApi().createOrUpdate("lbName", LOCATION, null, props);
+      LoadBalancer lbCreated = lbApi().createOrUpdate("lbName", LOCATION, null, null, props);
       assertNotNull(lbCreated);
       return lbCreated;
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d621edd7/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
index e1dfad8..396b2d8 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
@@ -29,10 +29,10 @@ import java.util.Collections;
 
 import org.jclouds.azurecompute.arm.domain.IdReference;
 import org.jclouds.azurecompute.arm.domain.IpAllocationMethod;
-import org.jclouds.azurecompute.arm.domain.PublicIPAddress;
-import org.jclouds.azurecompute.arm.domain.PublicIPAddressProperties;
 import org.jclouds.azurecompute.arm.domain.Subnet;
 import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
+import org.jclouds.azurecompute.arm.domain.publicipaddress.PublicIPAddress;
+import org.jclouds.azurecompute.arm.domain.publicipaddress.PublicIPAddressProperties;
 import org.jclouds.azurecompute.arm.domain.vpn.SKU;
 import org.jclouds.azurecompute.arm.domain.vpn.SKU.SKUName;
 import org.jclouds.azurecompute.arm.domain.vpn.SKU.SKUTier;
@@ -71,7 +71,7 @@ public class VirtualNetworkGatewayApiLiveTest extends BaseAzureComputeApiLiveTes
       PublicIPAddressProperties props = PublicIPAddressProperties.builder()
             .publicIPAllocationMethod(IpAllocationMethod.Dynamic.name()).idleTimeoutInMinutes(4).build();
       publicIp = api.getPublicIPAddressApi(resourceGroupName).createOrUpdate(name + "-publicip",
LOCATION,
-            Collections.<String, String> emptyMap(), props);
+            Collections.<String, String> emptyMap(), null, props);
    }
 
    @Test

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d621edd7/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java
b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java
index b16250a..1cef5a3 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java
@@ -32,10 +32,10 @@ import org.jclouds.azurecompute.arm.domain.AddressSpace;
 import org.jclouds.azurecompute.arm.domain.IdReference;
 import org.jclouds.azurecompute.arm.domain.IpAllocationMethod;
 import org.jclouds.azurecompute.arm.domain.Provisionable;
-import org.jclouds.azurecompute.arm.domain.PublicIPAddress;
-import org.jclouds.azurecompute.arm.domain.PublicIPAddressProperties;
 import org.jclouds.azurecompute.arm.domain.Subnet;
 import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
+import org.jclouds.azurecompute.arm.domain.publicipaddress.PublicIPAddress;
+import org.jclouds.azurecompute.arm.domain.publicipaddress.PublicIPAddressProperties;
 import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGateway;
 import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGatewayProperties;
 import org.jclouds.azurecompute.arm.domain.vpn.SKU;
@@ -98,7 +98,7 @@ public class VirtualNetworkGatewayConnectionApiLiveTest extends BaseAzureCompute
       PublicIPAddressProperties props = PublicIPAddressProperties.builder()
             .publicIPAllocationMethod(IpAllocationMethod.Dynamic.name()).idleTimeoutInMinutes(4).build();
       PublicIPAddress publicIp = api.getPublicIPAddressApi(resourceGroupName).createOrUpdate(name
+ "-publicip",
-            LOCATION, Collections.<String, String> emptyMap(), props);
+            LOCATION, Collections.<String, String> emptyMap(), null, props);
 
       IpConfigurationProperties ipprops = IpConfigurationProperties.builder(IpAllocationMethod.Dynamic)
             .subnet(IdReference.create(subnet.id())).publicIPAddress(IdReference.create(publicIp.id())).build();

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d621edd7/providers/azurecompute-arm/src/test/resources/PublicIPAddressCreate.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/PublicIPAddressCreate.json b/providers/azurecompute-arm/src/test/resources/PublicIPAddressCreate.json
index d9e06aa..d61fdbb 100644
--- a/providers/azurecompute-arm/src/test/resources/PublicIPAddressCreate.json
+++ b/providers/azurecompute-arm/src/test/resources/PublicIPAddressCreate.json
@@ -16,5 +16,8 @@
       "domainNameLabel": "foobar",
       "fqdn": "foobar.northeurope.cloudapp.azure.com"
     }
+  },
+  "sku": {
+    "name": "Basic"
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d621edd7/providers/azurecompute-arm/src/test/resources/PublicIPAddressGetInfo.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/PublicIPAddressGetInfo.json b/providers/azurecompute-arm/src/test/resources/PublicIPAddressGetInfo.json
index 00ca989..526d926 100644
--- a/providers/azurecompute-arm/src/test/resources/PublicIPAddressGetInfo.json
+++ b/providers/azurecompute-arm/src/test/resources/PublicIPAddressGetInfo.json
@@ -20,5 +20,8 @@
     "ipConfiguration": {
       "id": "/subscriptions/fakeb2f5-4710-4e93-bdf4-419edbde2178/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkInterfaces/myNic/ipConfigurations/myip1"
     }
+  },
+  "sku": {
+    "name": "Basic"
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d621edd7/providers/azurecompute-arm/src/test/resources/loadbalancercreate.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/loadbalancercreate.json b/providers/azurecompute-arm/src/test/resources/loadbalancercreate.json
index b3fa339..40e5a0f 100644
--- a/providers/azurecompute-arm/src/test/resources/loadbalancercreate.json
+++ b/providers/azurecompute-arm/src/test/resources/loadbalancercreate.json
@@ -4,6 +4,9 @@
   "etag": "W/\"406af4e7-b24b-4c00-b42f-b3c4399bf61d\"",
   "type": "Microsoft.Network/loadBalancers",
   "location": "westeurope",
+  "sku": {
+    "name": "Basic"
+  },
   "properties": {
     "provisioningState": "Succeeded",
     "resourceGuid": "112b7e75-f287-4789-9f6a-9a55a6fbe47c",
@@ -25,4 +28,4 @@
     "outboundNatRules": [],
     "inboundNatPools": []
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d621edd7/providers/azurecompute-arm/src/test/resources/loadbalancerget.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/loadbalancerget.json b/providers/azurecompute-arm/src/test/resources/loadbalancerget.json
index ef4e390..4e6e2af 100644
--- a/providers/azurecompute-arm/src/test/resources/loadbalancerget.json
+++ b/providers/azurecompute-arm/src/test/resources/loadbalancerget.json
@@ -4,6 +4,9 @@
   "etag": "W/\"b2cfb60e-4ada-4546-a336-dd71e574ead6\"",
   "type": "Microsoft.Network/loadBalancers",
   "location": "westeurope",
+  "sku": {
+    "name": "Basic"
+  },
   "properties": {
     "provisioningState": "Succeeded",
     "resourceGuid": "0d53b121-95cc-47b5-bbc6-0391f5991028",
@@ -51,4 +54,4 @@
     "outboundNatRules": [],
     "inboundNatPools": []
   }
-}
\ No newline at end of file
+}


Mime
View raw message