You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2013/09/19 00:09:29 UTC
[2/8] JCLOUDS-236: Add CloudSigma v2 API and Providers
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java
new file mode 100644
index 0000000..39f4df1
--- /dev/null
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions;
+
+import com.google.common.collect.ImmutableList;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.google.inject.Guice;
+import org.jclouds.cloudsigma2.domain.*;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = "unit")
+public class DriveToJsonTest {
+
+ private final static DriveToJson DRIVE_TO_JSON = Guice.createInjector().getInstance(DriveToJson.class);
+
+ private final static JsonObject result = new JsonObject();
+ private DriveInfo input;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ List<String> affinities = ImmutableList.of("ssd", "sample");
+ List<String> tags =ImmutableList.of("tag_uuid_1", "tag_uuid_2");
+
+ Map<String, String> metaMap = new HashMap<String, String>();
+ metaMap.put("description", "test_description");
+ metaMap.put("install_notes", "test_install_notes");
+
+ result.addProperty("name", "test");
+ result.addProperty("size", "1024000000");
+ result.addProperty("media", "disk");
+ result.add("affinities", new JsonParser().parse(new Gson().toJson(affinities)));
+ result.add("meta", new JsonParser().parse(new Gson().toJson(metaMap)));
+ result.add("tags", new JsonParser().parse(new Gson().toJson(tags)));
+ result.addProperty("allow_multimount", false);
+
+ input = new DriveInfo.Builder()
+ .affinities(ImmutableList.of("ssd", "sample"))
+ .allowMultimount(false)
+ .jobs(new ArrayList<String>())
+ .licenses(ImmutableList.of(new DriveLicense.Builder()
+ .amount(1)
+ .license(new License.Builder()
+ .isBurstable(true)
+ .longName("sample_longname")
+ .name("sample_name")
+ .resourceUri(new URI("/api/2.0/samples/"))
+ .type("sample_type")
+ .userMetric("sample")
+ .build())
+ .build()))
+ .media(MediaType.DISK)
+ .meta(metaMap)
+ .mountedOn(ImmutableList.of(new Server.Builder()
+ .uuid("81f911f9-5152-4328-8671-02543bafbd0e")
+ .build(),
+ new Server.Builder()
+ .uuid("19163e1a-a6d6-4e73-8087-157dd302c373")
+ .build()))
+ .name("test")
+ .size(new BigInteger("1024000000"))
+ .status(DriveStatus.UNMOUNTED)
+ .tags(ImmutableList.of("tag_uuid_1", "tag_uuid_2"))
+ .uuid("e96f3c63-6f50-47eb-9401-a56c5ccf6b32")
+ .build();
+ }
+
+ public void test(){
+ Assert.assertEquals(DRIVE_TO_JSON.apply(input), result);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java
new file mode 100644
index 0000000..a30a763
--- /dev/null
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions;
+
+import com.google.common.collect.ImmutableList;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.inject.Guice;
+import org.jclouds.cloudsigma2.domain.*;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = "unit")
+public class FirewallPolicyToJsonTest {
+
+ private final static FirewallPolicyToJson FIREWALL_POLICY_TO_JSON = Guice
+ .createInjector()
+ .getInstance(FirewallPolicyToJson.class);
+
+ private FirewallPolicy input;
+ private JsonObject expected;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Map <String, String> meta = new HashMap<String, String>();
+ meta.put("description", "test firewall policy");
+ meta.put("test_key_1", "test_value_1");
+ meta.put("test_key_2", "test_value_2");
+
+ input = new FirewallPolicy.Builder()
+ .meta(meta)
+ .name("My awesome policy")
+ .resourceUri(new URI("/api/2.0/fwpolicies/cf8479b4-c98b-46c8-ab9c-108bb00c8218/"))
+ .rules(ImmutableList.of(
+ new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
+ .direction(FirewallDirection.OUT)
+ .destinationIp("23.0.0.0/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.ACCEPT)
+ .comment("Allow SSH traffic to the VM from our office in Dubai")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .sourceIp("172.66.32.0/24")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all other SSH traffic to the VM")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
+ .direction(FirewallDirection.IN)
+ .ipProtocol(FirewallIpProtocol.UDP)
+ .sourceIp("!172.66.32.55/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop any traffic, to the VM with destination port not between 1-1024")
+ .direction(FirewallDirection.IN)
+ .destinationPort("!1:1024")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()
+ ))
+ .build();
+
+ expected = new JsonObject();
+
+ expected.addProperty("name", "My awesome policy");
+
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "test firewall policy");
+ metaObject.addProperty("test_key_1", "test_value_1");
+ metaObject.addProperty("test_key_2", "test_value_2");
+
+ expected.add("meta", metaObject);
+
+ JsonObject rule1Object = new JsonObject();
+ rule1Object.addProperty("action", "drop");
+ rule1Object.addProperty("comment", "Drop traffic from the VM to IP address 23.0.0.0/32");
+ rule1Object.addProperty("direction", "out");
+ rule1Object.addProperty("dst_ip", "23.0.0.0/32");
+ JsonObject rule2Object = new JsonObject();
+ rule2Object.addProperty("action", "accept");
+ rule2Object.addProperty("comment", "Allow SSH traffic to the VM from our office in Dubai");
+ rule2Object.addProperty("direction", "in");
+ rule2Object.addProperty("dst_port", "22");
+ rule2Object.addProperty("ip_proto", "tcp");
+ rule2Object.addProperty("src_ip", "172.66.32.0/24");
+ JsonObject rule3Object = new JsonObject();
+ rule3Object.addProperty("action", "drop");
+ rule3Object.addProperty("comment", "Drop all other SSH traffic to the VM");
+ rule3Object.addProperty("direction", "in");
+ rule3Object.addProperty("dst_port", "22");
+ rule3Object.addProperty("ip_proto", "tcp");
+ JsonObject rule4Object = new JsonObject();
+ rule4Object.addProperty("action", "drop");
+ rule4Object.addProperty("comment", "Drop all UDP traffic to the VM, not originating from 172.66.32.55");
+ rule4Object.addProperty("direction", "in");
+ rule4Object.addProperty("ip_proto", "udp");
+ rule4Object.addProperty("src_ip", "!172.66.32.55/32");
+ JsonObject rule5Object = new JsonObject();
+ rule5Object.addProperty("action", "drop");
+ rule5Object.addProperty("comment", "Drop any traffic, to the VM with destination port not between 1-1024");
+ rule5Object.addProperty("direction", "in");
+ rule5Object.addProperty("dst_port", "!1:1024");
+ rule5Object.addProperty("ip_proto", "tcp");
+
+ JsonArray rulesArray = new JsonArray();
+ rulesArray.add(rule1Object);
+ rulesArray.add(rule2Object);
+ rulesArray.add(rule3Object);
+ rulesArray.add(rule4Object);
+ rulesArray.add(rule5Object);
+
+ expected.add("rules", rulesArray);
+ }
+
+ public void test(){
+ Assert.assertEquals(FIREWALL_POLICY_TO_JSON.apply(input), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java
new file mode 100644
index 0000000..f74f113
--- /dev/null
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions;
+
+import com.google.common.collect.ImmutableList;
+import com.google.gson.JsonObject;
+import com.google.inject.Guice;
+import org.jclouds.cloudsigma2.domain.IPInfo;
+import org.jclouds.cloudsigma2.domain.Owner;
+import org.jclouds.cloudsigma2.domain.Subscription;
+import org.jclouds.cloudsigma2.domain.Tag;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = "unit")
+public class IPInfoToJsonTest {
+
+ private final static IPInfoToJson IP_INFO_TO_JSON = Guice.createInjector().getInstance(IPInfoToJson.class);
+
+ private IPInfo input;
+ private JsonObject expected;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Owner owner = new Owner.Builder()
+ .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
+ .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
+ .build();
+
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "test ip");
+ meta.put("test_key_1", "test_value_1");
+ meta.put("test_key_2", "test_value_2");
+
+ input = new IPInfo.Builder()
+ .gateway("185.12.6.1")
+ .meta(meta)
+ .nameservers(ImmutableList.of(
+ "69.194.139.62",
+ "178.22.66.167",
+ "178.22.71.56"))
+ .netmask(24)
+ .owner(owner)
+ .resourceUri(new URI("/api/2.0/ips/185.12.6.183/"))
+ .server(null)
+ .subscription(new Subscription.Builder()
+ .id("7273")
+ .resourceUri(new URI("/api/2.0/subscriptions/7273/"))
+ .build())
+ .tags(new ArrayList<Tag>())
+ .uuid("185.12.6.183")
+ .build();
+
+ expected = new JsonObject();
+
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "test ip");
+ metaObject.addProperty("test_key_1", "test_value_1");
+ metaObject.addProperty("test_key_2", "test_value_2");
+
+ expected.add("meta", metaObject);
+ }
+
+ public void test(){
+ Assert.assertEquals(IP_INFO_TO_JSON.apply(input), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java
new file mode 100644
index 0000000..dc6c264
--- /dev/null
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions;
+
+import com.google.common.collect.ImmutableList;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.inject.Guice;
+import org.jclouds.cloudsigma2.domain.*;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.math.BigInteger;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = "unit")
+public class LibraryDriveToJsonTest {
+
+ private static final DriveToJson DRIVE_TO_JSON = Guice.createInjector().getInstance(DriveToJson.class);
+ private static final LibraryDriveToJson LIBRARY_DRIVE_TO_JSON = new LibraryDriveToJson(DRIVE_TO_JSON);
+
+ private JsonObject expected = new JsonObject();
+ private LibraryDrive input;
+ {
+ expected.addProperty("name", "Vyatta-6.5-32bit-Virtualization-ISO");
+ expected.addProperty("size", "1000000000");
+ expected.addProperty("media", "cdrom");
+ expected.add("meta", new JsonObject());
+ expected.add("tags", new JsonArray());
+ expected.addProperty("allow_multimount", false);
+ expected.addProperty("favourite", true);
+ expected.addProperty("description", "test_description");
+
+ try {
+ input = new LibraryDrive.Builder()
+ .allowMultimount(false)
+ .arch("32")
+ .category(ImmutableList.of("general"))
+ .description("test_description")
+ .isFavorite(true)
+ .imageType("install")
+ .installNotes("test_install_notes")
+ .jobs(new ArrayList<String>())
+ .licenses(new ArrayList<DriveLicense>())
+ .media(MediaType.CDROM)
+ .meta(new HashMap<String, String>())
+ .mountedOn(new ArrayList<Server>())
+ .name("Vyatta-6.5-32bit-Virtualization-ISO")
+ .os("linux")
+ .owner(null)
+ .isPaid(false)
+ .resourceUri(new URI("/api/2.0/libdrives/6d53b92c-42dc-472b-a7b6-7021f45f377a/"))
+ .size(new BigInteger("1000000000"))
+ .status(DriveStatus.MOUNTED)
+ .tags(new ArrayList<String>())
+ .url("http://www.vyatta.org/")
+ .uuid("6d53b92c-42dc-472b-a7b6-7021f45f377a")
+ .build();
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void test(){
+ Assert.assertEquals(LIBRARY_DRIVE_TO_JSON.apply(input), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java
new file mode 100644
index 0000000..5b1c4c2
--- /dev/null
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions;
+
+import com.google.gson.JsonObject;
+import com.google.inject.Guice;
+import org.jclouds.cloudsigma2.domain.ProfileInfo;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = "unit")
+public class ProfileInfoToJsonTest {
+
+ private static final ProfileInfoToJson PROFILE_INFO_TO_JSON = Guice.createInjector().getInstance(ProfileInfoToJson.class);
+
+ private ProfileInfo input;
+ private JsonObject expected;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "profile info");
+
+ input = new ProfileInfo.Builder()
+ .address("test_address")
+ .isApiHttpsOnly(false)
+ .autotopupAmount("0E-16")
+ .autotopupThreshold("0E-16")
+ .bankReference("jdoe123")
+ .company("Newly Set Company Name")
+ .country("GB")
+ .currency("USD")
+ .email("user@example.com")
+ .firstName("John")
+ .hasAutotopup(false)
+ .invoicing(true)
+ .isKeyAuth(false)
+ .language("en-au")
+ .lastName("Doe")
+ .isMailingListEnabled(true)
+ .meta(meta)
+ .myNotes("test notes")
+ .nickname("test nickname")
+ .phone("123456789")
+ .postcode("12345")
+ .reseller("test reseller")
+ .signupTime(new SimpleDateFormatDateService().iso8601SecondsDateParse("2013-05-28T11:57:01+00:00"))
+ .state("REGULAR")
+ .taxRate(3.14)
+ .taxName("test tax_name")
+ .title("test title")
+ .town("test town")
+ .uuid("6f670b3c-a2e6-433f-aeab-b976b1cdaf03")
+ .vat("test vat")
+ .build();
+
+ expected = new JsonObject();
+ expected.addProperty("address", "test_address");
+ expected.addProperty("bank_reference", "jdoe123");
+ expected.addProperty("company", "Newly Set Company Name");
+ expected.addProperty("country", "GB");
+ expected.addProperty("email", "user@example.com");
+ expected.addProperty("first_name", "John");
+ expected.addProperty("last_name", "Doe");
+
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "profile info");
+
+ expected.add("meta", metaObject);
+ expected.addProperty("my_notes", "test notes");
+ expected.addProperty("nickname", "test nickname");
+ expected.addProperty("phone", "123456789");
+ expected.addProperty("postcode", "12345");
+ expected.addProperty("title", "test title");
+ expected.addProperty("town", "test town");
+ }
+
+ public void test(){
+ Assert.assertEquals(PROFILE_INFO_TO_JSON.apply(input), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java
new file mode 100644
index 0000000..774260e
--- /dev/null
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions;
+
+import com.google.common.collect.ImmutableList;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.google.inject.Guice;
+import org.jclouds.cloudsigma2.domain.*;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = "unit")
+public class ServerInfoToJsonTest {
+
+ private final static ServerInfoToJson SERVER_INFO_TO_JSON = Guice.createInjector().getInstance(ServerInfoToJson.class);
+
+ private ServerInfo input;
+ private JsonObject expected = new JsonObject();
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Owner owner = new Owner.Builder()
+ .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
+ .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
+ .build();
+
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "A full server with description");
+
+ input = new ServerInfo.Builder()
+ .cpu(1000)
+ .cpusInsteadOfCores(false)
+ .drives(ImmutableList.of(
+ new ServerDrive.Builder()
+ .deviceChannel("0:0")
+ .deviceEmulationType(DeviceEmulationType.IDE)
+ .drive(new Drive.Builder()
+ .resourceUri(new URI("/api/2.0/drives/ae78e68c-9daa-4471-8878-0bb87fa80260/"))
+ .uuid("ae78e68c-9daa-4471-8878-0bb87fa80260")
+ .build())
+ .build()
+ , new ServerDrive.Builder()
+ .bootOrder(1)
+ .deviceChannel("0:0")
+ .deviceEmulationType(DeviceEmulationType.VIRTIO)
+ .drive(new Drive.Builder()
+ .resourceUri(new URI("/api/2.0/drives/22826af4-d6c8-4d39-bd41-9cea86df2976/"))
+ .uuid("22826af4-d6c8-4d39-bd41-9cea86df2976")
+ .build())
+ .build()
+ ))
+ .enableNuma(false)
+ .hvRelaxed(false)
+ .hvTsc(false)
+ .memory(new BigInteger("268435456"))
+ .meta(meta)
+ .name("test_acc_full_server")
+ .nics(ImmutableList.of(
+ new NIC.Builder()
+ .firewallPolicy(null)
+ .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
+ .ipV6Configuration(null)
+ .mac("22:a7:a0:0d:43:48")
+ .model(Model.VIRTIO)
+ .runtime(null)
+ .vlan(null)
+ .build()
+ ))
+ .owner(owner)
+ .requirements(new ArrayList<String>())
+ .resourceUri(new URI("/api/2.0/servers/a19a425f-9e92-42f6-89fb-6361203071bb/"))
+ .runtime(null)
+ .smp(1)
+ .status(ServerStatus.STOPPED)
+ .tags(ImmutableList.of("tag_uuid_1", "tag_uuid_2"))
+ .uuid("a19a425f-9e92-42f6-89fb-6361203071bb")
+ .vncPassword("tester")
+ .build();
+
+ expected.addProperty("name", "test_acc_full_server");
+ expected.addProperty("cpu", 1000);
+ expected.addProperty("mem", "268435456");
+
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "A full server with description");
+
+ expected.add("meta", metaObject);
+ expected.add("requirements", new JsonArray());
+
+ JsonArray tagsArray = new JsonArray();
+ tagsArray.add(new JsonPrimitive("tag_uuid_1"));
+ tagsArray.add(new JsonPrimitive("tag_uuid_2"));
+ expected.add("tags", tagsArray);
+ expected.addProperty("vnc_password", "tester");
+
+ JsonObject nicJson = new JsonObject();
+
+ JsonObject ipv4ConfObject = new JsonObject();
+ ipv4ConfObject.addProperty("conf", "dhcp");
+ nicJson.add("ip_v4_conf", ipv4ConfObject);
+ nicJson.addProperty("model", "virtio");
+ nicJson.addProperty("mac", "22:a7:a0:0d:43:48");
+
+ JsonArray nicsArray = new JsonArray();
+ nicsArray.add(nicJson);
+
+ expected.add("nics", nicsArray);
+
+ JsonArray drivesArray = new JsonArray();
+ JsonObject driveJson1 = new JsonObject();
+ driveJson1.addProperty("boot_order", 0);
+ driveJson1.addProperty("dev_channel", "0:0");
+ driveJson1.addProperty("device", "ide");
+ driveJson1.addProperty("drive", "ae78e68c-9daa-4471-8878-0bb87fa80260");
+
+ JsonObject driveJson2 = new JsonObject();
+ driveJson2.addProperty("boot_order", 1);
+ driveJson2.addProperty("dev_channel", "0:0");
+ driveJson2.addProperty("device", "virtio");
+ driveJson2.addProperty("drive", "22826af4-d6c8-4d39-bd41-9cea86df2976");
+
+ drivesArray.add(driveJson1);
+ drivesArray.add(driveJson2);
+
+ expected.add("drives", drivesArray);
+ }
+
+ public void test(){
+ Assert.assertEquals(SERVER_INFO_TO_JSON.apply(input), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java
new file mode 100644
index 0000000..5526adf
--- /dev/null
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions;
+
+import com.google.common.collect.ImmutableList;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.google.inject.Guice;
+import org.jclouds.cloudsigma2.domain.Owner;
+import org.jclouds.cloudsigma2.domain.Tag;
+import org.jclouds.cloudsigma2.domain.TagResource;
+import org.jclouds.cloudsigma2.domain.TagResourceType;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = "unit")
+public class TagToJsonTest {
+
+ private static final TagToJson TAG_TO_JSON = Guice.createInjector().getInstance(TagToJson.class);
+
+ private Tag input;
+ private JsonObject expected;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Owner owner = new Owner.Builder()
+ .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
+ .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
+ .build();
+
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "test tag");
+
+ input = new Tag.Builder()
+ .meta(meta)
+ .name("TagCreatedWithResource")
+ .resources(ImmutableList.of(
+ new TagResource.Builder()
+ .uuid("96537817-f4b6-496b-a861-e74192d3ccb0")
+ .build()
+ , new TagResource.Builder()
+ .uuid("61bcc398-c034-42f1-81c9-f6d7f62c4ea0")
+ .build()
+ , new TagResource.Builder()
+ .uuid("3610d935-514a-4552-acf3-a40dd0a5f961")
+ .build()
+ , new TagResource.Builder()
+ .resourceType(TagResourceType.IPS)
+ .resourceUri(new URI("/api/2.0/ips/185.12.6.183/"))
+ .uuid("185.12.6.183")
+ .owner(owner)
+ .build()
+ ))
+ .build();
+
+ expected = new JsonObject();
+
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "test tag");
+
+ expected.add("meta", metaObject);
+ expected.addProperty("name", "TagCreatedWithResource");
+
+ JsonArray resourcesArray = new JsonArray();
+ resourcesArray.add(new JsonPrimitive("96537817-f4b6-496b-a861-e74192d3ccb0"));
+ resourcesArray.add(new JsonPrimitive("61bcc398-c034-42f1-81c9-f6d7f62c4ea0"));
+ resourcesArray.add(new JsonPrimitive("3610d935-514a-4552-acf3-a40dd0a5f961"));
+ resourcesArray.add(new JsonPrimitive("185.12.6.183"));
+
+ expected.add("resources", resourcesArray);
+ }
+
+ public void test(){
+ Assert.assertEquals(TAG_TO_JSON.apply(input), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java
new file mode 100644
index 0000000..8a940c8
--- /dev/null
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions;
+
+import com.google.common.collect.ImmutableList;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.google.inject.Guice;
+import org.jclouds.cloudsigma2.domain.Server;
+import org.jclouds.cloudsigma2.domain.Subscription;
+import org.jclouds.cloudsigma2.domain.Tag;
+import org.jclouds.cloudsigma2.domain.VLANInfo;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = "unit")
+public class VLANInfoToJsonTest {
+
+ private static final VLANInfoToJson VLAN_INFO_TO_JSON = Guice.createInjector().getInstance(VLANInfoToJson.class);
+
+ private VLANInfo input;
+ private JsonObject expected;
+ {
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "test vlan");
+ meta.put("test_key_1", "test_value_1");
+ meta.put("test_key_2", "test_value_2");
+
+ try {
+ input = new VLANInfo.Builder()
+ .meta(meta)
+ .resourceUri(new URI("/api/2.0/vlans/96537817-f4b6-496b-a861-e74192d3ccb0/"))
+ .servers(ImmutableList.of(
+ new Server.Builder()
+ .uuid("81f911f9-5152-4328-8671-02543bafbd0e")
+ .resourceUri(new URI("/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"))
+ .build()
+ , new Server.Builder()
+ .uuid("19163e1a-a6d6-4e73-8087-157dd302c373")
+ .resourceUri(new URI("/api/2.0/servers/19163e1a-a6d6-4e73-8087-157dd302c373/"))
+ .build()
+ ))
+ .subscription(new Subscription.Builder()
+ .id("7272")
+ .resourceUri(new URI("/api/2.0/subscriptions/7272/"))
+ .build())
+ .tags(new ArrayList<Tag>())
+ .uuid("96537817-f4b6-496b-a861-e74192d3ccb0")
+ .build();
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+
+ expected = new JsonObject();
+ expected.add("meta", new JsonParser().parse(new Gson().toJson(meta)));
+ }
+
+ public void test(){
+ Assert.assertEquals(VLAN_INFO_TO_JSON.apply(input), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/balance.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/balance.json b/cloudsigma2/src/test/resources/balance.json
new file mode 100644
index 0000000..9d28795
--- /dev/null
+++ b/cloudsigma2/src/test/resources/balance.json
@@ -0,0 +1,4 @@
+{
+ "balance": "128.20175975233523933736",
+ "currency": "USD"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/currentusage.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/currentusage.json b/cloudsigma2/src/test/resources/currentusage.json
new file mode 100644
index 0000000..8fbda22
--- /dev/null
+++ b/cloudsigma2/src/test/resources/currentusage.json
@@ -0,0 +1,63 @@
+{
+ "balance": {
+ "balance": "128.20175975233523933736",
+ "currency": "USD"
+ },
+ "usage": {
+ "cpu": {
+ "burst": 0,
+ "subscribed": 8000,
+ "using": 0
+ },
+ "dssd": {
+ "burst": 57783091200,
+ "subscribed": 32212254720,
+ "using": 89995345920
+ },
+ "ip": {
+ "burst": 0,
+ "subscribed": 1,
+ "using": 0
+ },
+ "mem": {
+ "burst": 0,
+ "subscribed": 17179869184,
+ "using": 0
+ },
+ "msft_lwa_00135": {
+ "burst": 0,
+ "subscribed": 0,
+ "using": 0
+ },
+ "msft_p73_04837": {
+ "burst": 0,
+ "subscribed": 0,
+ "using": 0
+ },
+ "msft_tfa_00009": {
+ "burst": 0,
+ "subscribed": 0,
+ "using": 0
+ },
+ "sms": {
+ "burst": 0,
+ "subscribed": 0,
+ "using": 0
+ },
+ "ssd": {
+ "burst": 0,
+ "subscribed": 0,
+ "using": 0
+ },
+ "tx": {
+ "burst": 0,
+ "subscribed": 0,
+ "using": 0
+ },
+ "vlan": {
+ "burst": 0,
+ "subscribed": 1,
+ "using": 0
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/discount.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/discount.json b/cloudsigma2/src/test/resources/discount.json
new file mode 100644
index 0000000..4282cef
--- /dev/null
+++ b/cloudsigma2/src/test/resources/discount.json
@@ -0,0 +1,29 @@
+{
+ "meta": {
+ "limit": 0,
+ "offset": 0,
+ "total_count": 5
+ },
+ "objects": [
+ {
+ "period": "3 months",
+ "value": "0.0300000000"
+ },
+ {
+ "period": "6 months",
+ "value": "0.1000000000"
+ },
+ {
+ "period": "1 year",
+ "value": "0.2500000000"
+ },
+ {
+ "period": "2 years",
+ "value": "0.3500000000"
+ },
+ {
+ "period": "3 years",
+ "value": "0.4500000000"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/drives-create-multiple-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives-create-multiple-request.json b/cloudsigma2/src/test/resources/drives-create-multiple-request.json
new file mode 100644
index 0000000..0cae6e1
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives-create-multiple-request.json
@@ -0,0 +1 @@
+{"objects":[{"name":"test_drive_0","size":"1024000000","media":"disk","allow_multimount":false},{"name":"test_drive_1","size":"1024000000","media":"disk","allow_multimount":false},{"name":"test_drive_2","size":"1024000000","media":"disk","allow_multimount":false}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/drives-create-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives-create-request.json b/cloudsigma2/src/test/resources/drives-create-request.json
new file mode 100644
index 0000000..f746478
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives-create-request.json
@@ -0,0 +1 @@
+{"name":"test_drive_0","size":"1024000000","media":"disk","allow_multimount":false}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/drives-delete-multiple.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives-delete-multiple.json b/cloudsigma2/src/test/resources/drives-delete-multiple.json
new file mode 100644
index 0000000..07997e9
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives-delete-multiple.json
@@ -0,0 +1 @@
+{"objects":[{"uuid":"b137e217-42b6-4ecf-8575-d72efc2d3dbd"},{"uuid":"e035a488-8587-4a15-ab25-9b7343236bc9"},{"uuid":"feded33c-106f-49fa-a1c4-be5c718ad1b5"}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/drives-detail.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives-detail.json b/cloudsigma2/src/test/resources/drives-detail.json
new file mode 100644
index 0000000..6e3acbb
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives-detail.json
@@ -0,0 +1,110 @@
+{
+ "meta": {
+ "limit": 0,
+ "offset": 0,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "affinities": [
+ "ssd",
+ "sample"
+ ],
+ "allow_multimount": true,
+ "jobs": [],
+ "licenses": [
+ {
+ "amount" : 1,
+ "license" : {
+ "burstable" : true,
+ "long_name" : "sample_longname",
+ "name" : "sample_name",
+ "resource_uri" : "/api/2.0/samples/",
+ "type" : "sample_type",
+ "user_metric" : sample
+ },
+ "user" : {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ }
+ }
+ ],
+ "media": "disk",
+ "meta": {
+ "description": "",
+ "install_notes": ""
+ },
+ "mounted_on": [
+ {
+ "uuid" : "81f911f9-5152-4328-8671-02543bafbd0e",
+ "resource_uri" : "/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"
+ },
+ {
+ "uuid" : "19163e1a-a6d6-4e73-8087-157dd302c373",
+ "resource_uri" : "/api/2.0/servers/19163e1a-a6d6-4e73-8087-157dd302c373/"
+ }
+ ],
+ "name": "atom-sol3",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/92ca1450-417e-4cc1-983b-1015777e2591/",
+ "size": 12348030976,
+ "status": "unmounted",
+ "tags": [
+ "tag_uuid_1",
+ "tag_uuid_2"
+ ],
+ "uuid": "92ca1450-417e-4cc1-983b-1015777e2591"
+ },
+ {
+ "affinities": [
+ "ssd"
+ ],
+ "allow_multimount": false,
+ "jobs": [],
+ "licenses": [],
+ "media": "disk",
+ "meta": {},
+ "mounted_on": [
+ {
+ "uuid" : "81f911f9-5152-4328-8671-02543bafbd0e",
+ "resource_uri" : "/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"
+ }
+ ],
+ "name": "test_drive_3",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/414ad24b-ba41-47c0-9751-ef5060b6c391/",
+ "size": 1024000000,
+ "status": "unmounted",
+ "tags": [],
+ "uuid": "414ad24b-ba41-47c0-9751-ef5060b6c391"
+ },
+ {
+ "affinities": [],
+ "allow_multimount": false,
+ "jobs": [],
+ "licenses": [],
+ "media": "disk",
+ "meta": {
+ "description": "",
+ "install_notes": ""
+ },
+ "mounted_on": [],
+ "name": "otom",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/7bc04bc5-bd09-4269-b45d-16b58d6f71b4/",
+ "size": 11811160064,
+ "status": "unmounted",
+ "tags": [],
+ "uuid": "7bc04bc5-bd09-4269-b45d-16b58d6f71b4"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/drives-single.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives-single.json b/cloudsigma2/src/test/resources/drives-single.json
new file mode 100644
index 0000000..a4f9472
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives-single.json
@@ -0,0 +1,27 @@
+{
+ "objects": [
+ {
+ "affinities": [
+ "ssd",
+ "sample"
+ ],
+ "allow_multimount": true,
+ "jobs": [],
+ "licenses": [],
+ "media": "disk",
+ "meta": {},
+ "mounted_on": [
+ ],
+ "name": "test_drive_y",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/e96f3c63-6f50-47eb-9401-a56c5ccf6b32/",
+ "size": 1024000000,
+ "status": "unmounted",
+ "tags": [],
+ "uuid": "e96f3c63-6f50-47eb-9401-a56c5ccf6b32"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/drives.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives.json b/cloudsigma2/src/test/resources/drives.json
new file mode 100644
index 0000000..a842121
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives.json
@@ -0,0 +1,36 @@
+{
+ "meta": {
+ "limit": 0,
+ "offset": 0,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/92ca1450-417e-4cc1-983b-1015777e2591/",
+ "status": "unmounted",
+ "uuid": "92ca1450-417e-4cc1-983b-1015777e2591"
+ },
+ {
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/414ad24b-ba41-47c0-9751-ef5060b6c391/",
+ "status": "unmounted",
+ "uuid": "414ad24b-ba41-47c0-9751-ef5060b6c391"
+ },
+ {
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/7bc04bc5-bd09-4269-b45d-16b58d6f71b4/",
+ "status": "mounted",
+ "uuid": "7bc04bc5-bd09-4269-b45d-16b58d6f71b4"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/fwpolicies-create-multiple-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/fwpolicies-create-multiple-request.json b/cloudsigma2/src/test/resources/fwpolicies-create-multiple-request.json
new file mode 100644
index 0000000..ed34a38
--- /dev/null
+++ b/cloudsigma2/src/test/resources/fwpolicies-create-multiple-request.json
@@ -0,0 +1 @@
+{"objects":[{"name":"New policy","rules":[{"action":"accept","comment":"Test comment","direction":"in","dst_ip":"192.168.1.132/32","dst_port":"1233","ip_proto":"tcp","src_ip":"255.255.255.12/32","src_port":"321"}]},{"name":"My awesome policy","rules":[{"action":"drop","comment":"Drop traffic from the VM to IP address 23.0.0.0/32","direction":"out","dst_ip":"23.0.0.0/32"},{"action":"accept","comment":"Allow SSH traffic to the VM from our office in Dubai","direction":"in","dst_port":"22","ip_proto":"tcp","src_ip":"172.66.32.0/24"},{"action":"drop","comment":"Drop all other SSH traffic to the VM","direction":"in","dst_port":"22","ip_proto":"tcp"},{"action":"drop","comment":"Drop all UDP traffic to the VM, not originating from 172.66.32.55","direction":"in","ip_proto":"udp","src_ip":"!172.66.32.55/32"},{"action":"drop","comment":"Drop any traffic, to the VM with destination port not between 1-1024","direction":"in","dst_port":"!1:1024","ip_proto":"tcp"}]}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/fwpolicies-create-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/fwpolicies-create-request.json b/cloudsigma2/src/test/resources/fwpolicies-create-request.json
new file mode 100644
index 0000000..bf5fb91
--- /dev/null
+++ b/cloudsigma2/src/test/resources/fwpolicies-create-request.json
@@ -0,0 +1 @@
+{"name":"My awesome policy","rules":[{"action":"drop","comment":"Drop traffic from the VM to IP address 23.0.0.0/32","direction":"out","dst_ip":"23.0.0.0/32"},{"action":"accept","comment":"Allow SSH traffic to the VM from our office in Dubai","direction":"in","dst_port":"22","ip_proto":"tcp","src_ip":"172.66.32.0/24"},{"action":"drop","comment":"Drop all other SSH traffic to the VM","direction":"in","dst_port":"22","ip_proto":"tcp"},{"action":"drop","comment":"Drop all UDP traffic to the VM, not originating from 172.66.32.55","direction":"in","ip_proto":"udp","src_ip":"!172.66.32.55/32"},{"action":"drop","comment":"Drop any traffic, to the VM with destination port not between 1-1024","direction":"in","dst_port":"!1:1024","ip_proto":"tcp"}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/fwpolicies-detail.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/fwpolicies-detail.json b/cloudsigma2/src/test/resources/fwpolicies-detail.json
new file mode 100644
index 0000000..120ed6e
--- /dev/null
+++ b/cloudsigma2/src/test/resources/fwpolicies-detail.json
@@ -0,0 +1,104 @@
+{
+ "meta" : {
+ "limit": 20,
+ "next": null,
+ "offset": 0,
+ "previous": null,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "meta": {},
+ "name": "New policy",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/fwpolicies/b68dd907-69fc-4b3c-b954-c39d0046525b/",
+ "rules": [
+ {
+ "action": "accept",
+ "comment": "Test comment",
+ "direction": "in",
+ "dst_ip": "192.168.1.132/32",
+ "dst_port": "1233",
+ "ip_proto": "tcp",
+ "src_ip": "255.255.255.12/32",
+ "src_port": "321"
+ }
+ ],
+ "servers": [],
+ "uuid": "b68dd907-69fc-4b3c-b954-c39d0046525b"
+ },
+ {
+ "meta": {
+ "description" : "test firewall policy"
+ },
+ "name": "My awesome policy",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/fwpolicies/cf8479b4-c98b-46c8-ab9c-108bb00c8218/",
+ "rules": [
+ {
+ "action": "drop",
+ "comment": "Drop traffic from the VM to IP address 23.0.0.0/32",
+ "direction": "out",
+ "dst_ip": "23.0.0.0/32",
+ "dst_port": null,
+ "ip_proto": null,
+ "src_ip": null,
+ "src_port": null
+ },
+ {
+ "action": "accept",
+ "comment": "Allow SSH traffic to the VM from our office in Dubai",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "22",
+ "ip_proto": "tcp",
+ "src_ip": "172.66.32.0/24",
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop all other SSH traffic to the VM",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "22",
+ "ip_proto": "tcp",
+ "src_ip": null,
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop all UDP traffic to the VM, not originating from 172.66.32.55",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": null,
+ "ip_proto": "udp",
+ "src_ip": "!172.66.32.55/32",
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop any traffic, to the VM with destination port not between 1-1024",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "!1:1024",
+ "ip_proto": "tcp",
+ "src_ip": null,
+ "src_port": null
+ }
+ ],
+ "servers": [
+ {
+ "uuid" : "81f911f9-5152-4328-8671-02543bafbd0e",
+ "resource_uri" : "/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"
+ }
+ ],
+ "uuid": "cf8479b4-c98b-46c8-ab9c-108bb00c8218"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/fwpolicies-single.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/fwpolicies-single.json b/cloudsigma2/src/test/resources/fwpolicies-single.json
new file mode 100644
index 0000000..267ca28
--- /dev/null
+++ b/cloudsigma2/src/test/resources/fwpolicies-single.json
@@ -0,0 +1,74 @@
+{
+ "objects": [
+ {
+ "meta": {
+ "description" : "test firewall policy"
+ },
+ "name": "My awesome policy",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/fwpolicies/cf8479b4-c98b-46c8-ab9c-108bb00c8218/",
+ "rules": [
+ {
+ "action": "drop",
+ "comment": "Drop traffic from the VM to IP address 23.0.0.0/32",
+ "direction": "out",
+ "dst_ip": "23.0.0.0/32",
+ "dst_port": null,
+ "ip_proto": null,
+ "src_ip": null,
+ "src_port": null
+ },
+ {
+ "action": "accept",
+ "comment": "Allow SSH traffic to the VM from our office in Dubai",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "22",
+ "ip_proto": "tcp",
+ "src_ip": "172.66.32.0/24",
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop all other SSH traffic to the VM",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "22",
+ "ip_proto": "tcp",
+ "src_ip": null,
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop all UDP traffic to the VM, not originating from 172.66.32.55",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": null,
+ "ip_proto": "udp",
+ "src_ip": "!172.66.32.55/32",
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop any traffic, to the VM with destination port not between 1-1024",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "!1:1024",
+ "ip_proto": "tcp",
+ "src_ip": null,
+ "src_port": null
+ }
+ ],
+ "servers": [
+ {
+ "uuid" : "81f911f9-5152-4328-8671-02543bafbd0e",
+ "resource_uri" : "/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"
+ }
+ ],
+ "uuid": "cf8479b4-c98b-46c8-ab9c-108bb00c8218"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/ips-edit-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/ips-edit-request.json b/cloudsigma2/src/test/resources/ips-edit-request.json
new file mode 100644
index 0000000..25e0aa2
--- /dev/null
+++ b/cloudsigma2/src/test/resources/ips-edit-request.json
@@ -0,0 +1 @@
+{"meta":{"test_key_2":"test_value_2","description":"test vlan","test_key_1":"test_value_1"}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/ips-single.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/ips-single.json b/cloudsigma2/src/test/resources/ips-single.json
new file mode 100644
index 0000000..f93d4fb
--- /dev/null
+++ b/cloudsigma2/src/test/resources/ips-single.json
@@ -0,0 +1,24 @@
+{
+ "gateway": "185.12.6.1",
+ "meta": {
+ "description": "test ip"
+ },
+ "nameservers": [
+ "69.194.139.62",
+ "178.22.66.167",
+ "178.22.71.56"
+ ],
+ "netmask": 24,
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/ips/185.12.6.183/",
+ "server": null,
+ "subscription": {
+ "id": 7273,
+ "resource_uri": "/api/2.0/subscriptions/7273/"
+ },
+ "tags": [],
+ "uuid": "185.12.6.183"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/ips.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/ips.json b/cloudsigma2/src/test/resources/ips.json
new file mode 100644
index 0000000..44004a0
--- /dev/null
+++ b/cloudsigma2/src/test/resources/ips.json
@@ -0,0 +1,52 @@
+{
+ "meta": {
+ "limit": 0,
+ "offset": 0,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "gateway": "185.12.6.1",
+ "meta": {
+ "description": "test ip"
+ },
+ "nameservers": [
+ "69.194.139.62",
+ "178.22.66.167",
+ "178.22.71.56"
+ ],
+ "netmask": 24,
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/ips/185.12.6.183/",
+ "server": null,
+ "subscription": {
+ "id": 7273,
+ "resource_uri": "/api/2.0/subscriptions/7273/"
+ },
+ "tags": [],
+ "uuid": "185.12.6.183"
+ },
+ {
+ "gateway": "185.12.5.1",
+ "meta": {},
+ "nameservers": [
+ "178.22.66.167",
+ "178.22.71.56",
+ "8.8.8.8"
+ ],
+ "netmask": 24,
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/ips/185.12.5.233/",
+ "server": null,
+ "subscription": null,
+ "tags": [],
+ "uuid": "185.12.5.233"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/ledger.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/ledger.json b/cloudsigma2/src/test/resources/ledger.json
new file mode 100644
index 0000000..efe75eb
--- /dev/null
+++ b/cloudsigma2/src/test/resources/ledger.json
@@ -0,0 +1,47 @@
+{
+ "meta": {
+ "limit": 20,
+ "next": "/api/2.0/ledger/?limit=20&offset=20",
+ "offset": 0,
+ "previous": null,
+ "total_count": 9921
+ },
+ "objects": [
+ {
+ "amount": "0.00173818150273075810",
+ "billing_cycle": 68844,
+ "end": "128.20175975233523933736",
+ "id": "11042920",
+ "initial": "128.20349793383797009546",
+ "reason": "Burst: 57783091200 of dssd for 299 seconds at 2013-07-09 07:49:06+00:00",
+ "time": "2013-07-09T07:49:54+00:00"
+ },
+ {
+ "amount": "0.00174399481879340278",
+ "billing_cycle": 68844,
+ "end": "128.20349793383797009546",
+ "id": "11042919",
+ "initial": "128.20524192865676349824",
+ "reason": "Burst: 57783091200 of dssd for 300 seconds at 2013-07-09 07:44:06+00:00",
+ "time": "2013-07-09T07:49:54+00:00"
+ },
+ {
+ "amount": "0.00173818150273075810",
+ "billing_cycle": 68843,
+ "end": "128.20524192865676349824",
+ "id": "11042661",
+ "initial": "128.20698011015949425634",
+ "reason": "Burst: 57783091200 of dssd for 299 seconds at 2013-07-09 07:39:06+00:00",
+ "time": "2013-07-09T07:40:05+00:00"
+ },
+ {
+ "amount": "0.00174399481879340278",
+ "billing_cycle": 68843,
+ "end": "128.20698011015949425634",
+ "id": "11042660",
+ "initial": "128.20872410497828765912",
+ "reason": "Burst: 57783091200 of dssd for 300 seconds at 2013-07-09 07:34:06+00:00",
+ "time": "2013-07-09T07:40:04+00:00"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/libdrives-create-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/libdrives-create-request.json b/cloudsigma2/src/test/resources/libdrives-create-request.json
new file mode 100644
index 0000000..e897244
--- /dev/null
+++ b/cloudsigma2/src/test/resources/libdrives-create-request.json
@@ -0,0 +1 @@
+{"name":"test_drive_0","size":"1024000000","media":"disk","allow_multimount":false,"favourite":false}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/libdrives-single.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/libdrives-single.json b/cloudsigma2/src/test/resources/libdrives-single.json
new file mode 100644
index 0000000..2e2a419
--- /dev/null
+++ b/cloudsigma2/src/test/resources/libdrives-single.json
@@ -0,0 +1,27 @@
+{
+ "affinities": [],
+ "allow_multimount": false,
+ "arch": "32",
+ "category": [
+ "general"
+ ],
+ "description": "test_description",
+ "favourite": true,
+ "image_type": "install",
+ "install_notes": "test_install_notes",
+ "jobs": [],
+ "licenses": [],
+ "media": "cdrom",
+ "meta": {},
+ "mounted_on": [],
+ "name": "Vyatta-6.5-32bit-Virtualization-ISO",
+ "os": "linux",
+ "owner": null,
+ "paid": false,
+ "resource_uri": "/api/2.0/libdrives/6d53b92c-42dc-472b-a7b6-7021f45f377a/",
+ "size": 1000000000,
+ "status": "mounted",
+ "tags": [],
+ "url": "http://www.vyatta.org/",
+ "uuid": "6d53b92c-42dc-472b-a7b6-7021f45f377a"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/libdrives.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/libdrives.json b/cloudsigma2/src/test/resources/libdrives.json
new file mode 100644
index 0000000..78bcccf
--- /dev/null
+++ b/cloudsigma2/src/test/resources/libdrives.json
@@ -0,0 +1,95 @@
+{
+ "meta": {
+ "limit": 3,
+ "next": "/api/2.0/libdrives/?limit=5&offset=5",
+ "offset": 0,
+ "previous": null,
+ "total_count": 97
+ },
+ "objects": [
+ {
+ "affinities": [],
+ "allow_multimount": false,
+ "arch": "32",
+ "category": [
+ "general"
+ ],
+ "description": "test_description",
+ "favourite": true,
+ "image_type": "install",
+ "install_notes": "test_install_notes",
+ "jobs": [],
+ "licenses": [],
+ "media": "cdrom",
+ "meta": {},
+ "mounted_on": [],
+ "name": "ZeroShell 1.3 Linux Install CD",
+ "os": "linux",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "paid": false,
+ "resource_uri": "/api/2.0/libdrives/8c45d8d9-4efd-44ec-9833-8d52004b4298/",
+ "size": 1000000000,
+ "status": "unmounted",
+ "tags": [],
+ "url": "test_url",
+ "uuid": "8c45d8d9-4efd-44ec-9833-8d52004b4298"
+ },
+ {
+ "affinities": [],
+ "allow_multimount": false,
+ "arch": "64",
+ "category": [
+ "general"
+ ],
+ "description": "test_description",
+ "favourite": true,
+ "image_type": "install",
+ "install_notes": "test_install_notes",
+ "jobs": [],
+ "licenses": [],
+ "media": "cdrom",
+ "meta": {},
+ "mounted_on": [],
+ "name": "Windows_Server_2003_r2_standard_x64_with_sp2_cd2.iso pub",
+ "os": "windows",
+ "owner": null,
+ "paid": false,
+ "resource_uri": "/api/2.0/libdrives/d1ec9f26-ba44-4002-bbdf-82a31a84b611/",
+ "size": 1000000000,
+ "status": "unmounted",
+ "tags": [],
+ "url": "test_url",
+ "uuid": "d1ec9f26-ba44-4002-bbdf-82a31a84b611"
+ },
+ {
+ "affinities": [],
+ "allow_multimount": false,
+ "arch": "64",
+ "category": [
+ "general"
+ ],
+ "description": "",
+ "favourite": true,
+ "image_type": "install",
+ "install_notes": "",
+ "jobs": [],
+ "licenses": [],
+ "media": "cdrom",
+ "meta": {},
+ "mounted_on": [],
+ "name": "Windows_Server_2003_r2_standard_x64_with_sp2_cd1.iso pub",
+ "os": "windows",
+ "owner": null,
+ "paid": false,
+ "resource_uri": "/api/2.0/libdrives/dd9da460-b1ab-419a-9fa1-804540eee4c3/",
+ "size": 1000000000,
+ "status": "unmounted",
+ "tags": [],
+ "url": "test_url",
+ "uuid": "dd9da460-b1ab-419a-9fa1-804540eee4c3"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/licences.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/licences.json b/cloudsigma2/src/test/resources/licences.json
new file mode 100644
index 0000000..2b210a7
--- /dev/null
+++ b/cloudsigma2/src/test/resources/licences.json
@@ -0,0 +1,35 @@
+{
+ "meta": {
+ "limit": 20,
+ "next": null,
+ "offset": 0,
+ "previous": null,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "burstable": false,
+ "long_name": "Microsoft Windows Web Server 2008",
+ "name": "msft_lwa_00135",
+ "resource_uri": "/api/2.0/licenses/9/",
+ "type": "instance",
+ "user_metric": ""
+ },
+ {
+ "burstable": false,
+ "long_name": "Windows Server 2008 Standard",
+ "name": "msft_p73_04837",
+ "resource_uri": "/api/2.0/licenses/10/",
+ "type": "instance",
+ "user_metric": ""
+ },
+ {
+ "burstable": false,
+ "long_name": "SQL Server Standard 2008",
+ "name": "msft_tfa_00009",
+ "resource_uri": "/api/2.0/licenses/11/",
+ "type": "instance",
+ "user_metric": ""
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/pricing.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/pricing.json b/cloudsigma2/src/test/resources/pricing.json
new file mode 100644
index 0000000..a53eb7a
--- /dev/null
+++ b/cloudsigma2/src/test/resources/pricing.json
@@ -0,0 +1,82 @@
+{
+ "current": {
+ "cpu": 6,
+ "dssd": 1,
+ "ip": 1,
+ "mem": 6,
+ "msft_lwa_00135": 1,
+ "msft_p73_04837": 1,
+ "msft_tfa_00009": 1,
+ "sms": 1,
+ "ssd": 1,
+ "tx": 6,
+ "vlan": 1
+ },
+ "meta": {
+ "limit": 5,
+ "next": "/api/2.0/pricing/?limit=5&offset=5",
+ "offset": 0,
+ "previous": null,
+ "total_count": 284
+ },
+ "next": {
+ "cpu": 6,
+ "dssd": 1,
+ "ip": 1,
+ "mem": 6,
+ "msft_lwa_00135": 1,
+ "msft_p73_04837": 1,
+ "msft_tfa_00009": 1,
+ "sms": 1,
+ "ssd": 1,
+ "tx": 5,
+ "vlan": 1
+ },
+ "objects": [
+ {
+ "currency": "USD",
+ "id": "568",
+ "level": 1,
+ "multiplier": 2783138807808000,
+ "price": "0.28000000000000000000",
+ "resource": "dssd",
+ "unit": "GB/month"
+ },
+ {
+ "currency": "GBP",
+ "id": "567",
+ "level": 1,
+ "multiplier": 2783138807808000,
+ "price": "0.18200000000000000000",
+ "resource": "dssd",
+ "unit": "GB/month"
+ },
+ {
+ "currency": "EUR",
+ "id": "566",
+ "level": 1,
+ "multiplier": 2783138807808000,
+ "price": "0.21000000000000000000",
+ "resource": "dssd",
+ "unit": "GB/month"
+ },
+ {
+ "currency": "CHF",
+ "id": "565",
+ "level": 1,
+ "multiplier": 2783138807808000,
+ "price": "0.26600000000000000000",
+ "resource": "dssd",
+ "unit": "GB/month"
+ },
+ {
+ "currency": "CHF",
+ "id": "304",
+ "level": 0,
+ "multiplier": 2783138807808000,
+ "price": "0.13300000000000000000",
+ "resource": "dssd",
+ "unit": "GB/month"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/profile-edit-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/profile-edit-request.json b/cloudsigma2/src/test/resources/profile-edit-request.json
new file mode 100644
index 0000000..94eed89
--- /dev/null
+++ b/cloudsigma2/src/test/resources/profile-edit-request.json
@@ -0,0 +1 @@
+{"address":"test_address","bank_reference":"jdoe123","company":"Newly Set Company Name","country":"GB","email":"user@example.com","first_name":"John","last_name":"Doe","meta":{"description":"profile info"},"my_notes":"test notes","nickname":"test nickname","phone":"123456789","postcode":"12345","title":"test title","town":"test town"}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/profile.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/profile.json b/cloudsigma2/src/test/resources/profile.json
new file mode 100644
index 0000000..44ddb96
--- /dev/null
+++ b/cloudsigma2/src/test/resources/profile.json
@@ -0,0 +1,34 @@
+{
+ "address": "test_address",
+ "api_https_only": false,
+ "autotopup_amount": "0E-16",
+ "autotopup_threshold": "0E-16",
+ "bank_reference": "jdoe123",
+ "company": "Newly Set Company Name",
+ "country": "GB",
+ "currency": "USD",
+ "email": "user@example.com",
+ "first_name": "John",
+ "has_autotopup": false,
+ "invoicing": true,
+ "key_auth": false,
+ "language": "en-au",
+ "last_name": "Doe",
+ "mailing_list": true,
+ "meta": {
+ "description": "profile info"
+ },
+ "my_notes": "test notes",
+ "nickname": "test nickname",
+ "phone": "123456789",
+ "postcode": "12345",
+ "reseller": "test reseller",
+ "signup_time": "2013-05-28T11:57:01+00:00",
+ "state": "REGULAR",
+ "tax_name": "test tax_name",
+ "tax_rate": 3.14,
+ "title": "test title",
+ "town": "test town",
+ "uuid": "6f670b3c-a2e6-433f-aeab-b976b1cdaf03",
+ "vat": "test vat"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/server-availability-group.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/server-availability-group.json b/cloudsigma2/src/test/resources/server-availability-group.json
new file mode 100644
index 0000000..d132a47
--- /dev/null
+++ b/cloudsigma2/src/test/resources/server-availability-group.json
@@ -0,0 +1,4 @@
+[
+ "313e73a4-592f-48cf-81c4-a6c079d005a5",
+ "e035a488-8587-4a15-ab25-9b7343236bc9"
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/server-detail.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/server-detail.json b/cloudsigma2/src/test/resources/server-detail.json
new file mode 100644
index 0000000..9d8fe62
--- /dev/null
+++ b/cloudsigma2/src/test/resources/server-detail.json
@@ -0,0 +1,120 @@
+{
+ "meta": {
+ "limit": 0,
+ "offset": 0,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "cpu": 1000,
+ "cpus_instead_of_cores": false,
+ "drives": [
+ {
+ "boot_order": null,
+ "dev_channel": "0:0",
+ "device": "ide",
+ "drive": {
+ "resource_uri": "/api/2.0/drives/ae78e68c-9daa-4471-8878-0bb87fa80260/",
+ "uuid": "ae78e68c-9daa-4471-8878-0bb87fa80260"
+ }
+ },
+ {
+ "boot_order": 1,
+ "dev_channel": "0:0",
+ "device": "virtio",
+ "drive": {
+ "resource_uri": "/api/2.0/drives/22826af4-d6c8-4d39-bd41-9cea86df2976/",
+ "uuid": "22826af4-d6c8-4d39-bd41-9cea86df2976"
+ }
+ }
+ ],
+ "enable_numa": false,
+ "hv_relaxed": false,
+ "hv_tsc": false,
+ "mem": 268435456,
+ "meta": {
+ "description": "A full server with description"
+ },
+ "name": "test_acc_full_server",
+ "nics": [
+ {
+ "boot_order": null,
+ "firewall_policy": null,
+ "ip_v4_conf": {
+ "conf": "dhcp",
+ "ip": null
+ },
+ "ip_v6_conf": null,
+ "mac": "22:a7:a0:0d:43:48",
+ "model": "virtio",
+ "runtime": null,
+ "vlan": null
+ }
+ ],
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "requirements": [],
+ "resource_uri": "/api/2.0/servers/a19a425f-9e92-42f6-89fb-6361203071bb/",
+ "runtime": null,
+ "smp": 1,
+ "status": "stopped",
+ "tags": [
+ "tag_uuid_1",
+ "tag_uuid_2"
+ ],
+ "uuid": "a19a425f-9e92-42f6-89fb-6361203071bb",
+ "vnc_password": "tester"
+ },
+ {
+ "cpu": 1000,
+ "cpus_instead_of_cores": false,
+ "drives": [],
+ "enable_numa": false,
+ "hv_relaxed": false,
+ "hv_tsc": false,
+ "mem": 536870912,
+ "meta": {},
+ "name": "test_server_3",
+ "nics": [],
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "requirements": [],
+ "resource_uri": "/api/2.0/servers/61d61337-884b-4c87-b4de-f7f48f9cfc84/",
+ "runtime": null,
+ "smp": 1,
+ "status": "stopped",
+ "tags": [],
+ "uuid": "61d61337-884b-4c87-b4de-f7f48f9cfc84",
+ "vnc_password": "testserver"
+ },
+ {
+ "cpu": 1000,
+ "cpus_instead_of_cores": false,
+ "drives": [],
+ "enable_numa": false,
+ "hv_relaxed": false,
+ "hv_tsc": false,
+ "mem": 536870912,
+ "meta": {},
+ "name": "test_server_1",
+ "nics": [],
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "requirements": [],
+ "resource_uri": "/api/2.0/servers/33e71c37-0d0a-4a3a-a1ea-dc7265c9a154/",
+ "runtime": null,
+ "smp": 1,
+ "status": "stopped",
+ "tags": [],
+ "uuid": "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154",
+ "vnc_password": "testserver"
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/servers-availability-groups.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/servers-availability-groups.json b/cloudsigma2/src/test/resources/servers-availability-groups.json
new file mode 100644
index 0000000..4616678
--- /dev/null
+++ b/cloudsigma2/src/test/resources/servers-availability-groups.json
@@ -0,0 +1,10 @@
+[
+ [
+ "313e73a4-592f-48cf-81c4-a6c079d005a5",
+ "e035a488-8587-4a15-ab25-9b7343236bc9"
+ ],
+ [
+ "313e73a4-592f-48cf-81c4-a6c079d005a5",
+ "e035a488-8587-4a15-ab25-9b7343236bc9"
+ ]
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/servers-create-multiple-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/servers-create-multiple-request.json b/cloudsigma2/src/test/resources/servers-create-multiple-request.json
new file mode 100644
index 0000000..0bb397d
--- /dev/null
+++ b/cloudsigma2/src/test/resources/servers-create-multiple-request.json
@@ -0,0 +1 @@
+{"objects":[{"name":"test_server_0","cpu":100,"mem":"536870912","vnc_password":"testserver","nics":[],"drives":[]},{"name":"test_server_1","cpu":100,"mem":"536870912","vnc_password":"testserver","nics":[],"drives":[]},{"name":"test_server_2","cpu":100,"mem":"536870912","vnc_password":"testserver","nics":[],"drives":[]}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/test/resources/servers-create-request.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/servers-create-request.json b/cloudsigma2/src/test/resources/servers-create-request.json
new file mode 100644
index 0000000..7322cfa
--- /dev/null
+++ b/cloudsigma2/src/test/resources/servers-create-request.json
@@ -0,0 +1 @@
+{"name":"testServerAcc","cpu":100,"mem":"536870912","vnc_password":"testserver","nics":[],"drives":[]}
\ No newline at end of file