Repository: jclouds Updated Branches: refs/heads/1.9.x cc3167c3f -> a0ada77ee
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a0ada77e/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestBlockDeviceTemplateGroupParseTest.java ---------------------------------------------------------------------- diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestBlockDeviceTemplateGroupParseTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestBlockDeviceTemplateGroupParseTest.java new file mode 100644 index 0000000..babdc88 --- /dev/null +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestBlockDeviceTemplateGroupParseTest.java @@ -0,0 +1,212 @@ +/* + * 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.softlayer.parse; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.softlayer.domain.SoftwareDescription; +import org.jclouds.softlayer.domain.VirtualDiskImage; +import org.jclouds.softlayer.domain.VirtualDiskImageSoftware; +import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplate; +import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplateGroup; +import org.jclouds.softlayer.internal.BaseSoftLayerParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class + VirtualGuestBlockDeviceTemplateGroupParseTest extends + BaseSoftLayerParseTest<VirtualGuestBlockDeviceTemplateGroup> { + + @Override + public String resource() { + return "/virtual_guest_block_device_template_group_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public VirtualGuestBlockDeviceTemplateGroup expected() { + return VirtualGuestBlockDeviceTemplateGroup.builder() + .id(402456) + .name("DST_Windows-2008_R2DC_x86-64_Base_ICOv2") + .globalIdentifier("8df677d9-02a0-43b0-9cc8-88015fcb6ad7") + .statusId(1) + .accountId(278462) + .summary("DST_Windows-2008_R2DC_x86-64_Base with preparation for ICO 2.4") + .children(VirtualGuestBlockDeviceTemplateGroup.builder() + .id(402458) + .name("DST_Windows-2008_R2DC_x86-64_Base_ICOv2") + .statusId(1) + .accountId(278462) + .parentId(402456) + .summary("DST_Windows-2008_R2DC_x86-64_Base with preparation for ICO 2.4") + .blockDevices(ImmutableSet.of( + VirtualGuestBlockDeviceTemplate.builder() + .id(508130) + .device("0") + .diskSpace(20926382592f) + .diskImageId(6865056) + .groupId(402458) + .units("B") + .diskImage(VirtualDiskImage.builder() + .id(6865056) + .uuid("00c9bb78-9ac0-4f43-b4d8-35a6568c7db8") + .capacity(25f) + .units("GB") + .typeId(241) + .description("rrm-2k8r2dc-ico.dstdev.sl.edst.ibm.com") + .name("rrm-2k8r2dc-ico.dstdev.sl.edst.ibm.com") + .storageRepositoryId(2330744) + .softwareReferences(ImmutableSet.of( + VirtualDiskImageSoftware.builder() + .id(4259392) + .softwareDescriptionId(727) + .softwareDescription( + SoftwareDescription.builder() + .id(727) + .longDescription("Nimsoft / Nimsoft Robot / 5.0") + .manufacturer("Nimsoft") + .name("Nimsoft Robot") + .operatingSystem(0) + .requiredUser("administrator") + .version("5.0") + .controlPanel(0) + .virtualLicense("0") + .virtualizationPlatform("0") + .build()) + .build(), + VirtualDiskImageSoftware.builder() + .id(4259394) + .softwareDescriptionId(829) + .softwareDescription( + SoftwareDescription.builder() + .id(829) + .longDescription("Microsoft / Windows 2008 FULL DC 64 bit R2 SP1 / DC 64 bit") + .manufacturer("Microsoft") + .name("Windows 2008 FULL DC 64 bit R2 SP1") + .operatingSystem(1) + .referenceCode("WIN_2008-DC-R2-SP1_64") + .requiredUser("Administrator") + .version("DC 64 bit") + .controlPanel(0) + .virtualLicense("0") + .virtualizationPlatform("0") + .build()) + .build())) + .build()) + .build(), + VirtualGuestBlockDeviceTemplate.builder() + .id(508136) + .device("1") + .diskImageId(6865060) + .groupId(402458) + .diskImage(VirtualDiskImage.builder() + .id(6865060) + .name("7903014-SWAP") + .uuid("38eb1c23-0cf9-4325-b78a-95545829a36d") + .capacity(2f) + .units("GB") + .typeId(246) + .description("7903014-SWAP") + .storageRepositoryId(2330744) + .build()) + .build())) + .build(), + VirtualGuestBlockDeviceTemplateGroup.builder() + .id(402460) + .name("DST_Windows-2008_R2DC_x86-64_Base_ICOv2") + .statusId(1) + .accountId(278462) + .parentId(402456) + .summary("DST_Windows-2008_R2DC_x86-64_Base with preparation for ICO 2.4") + .blockDevices( + VirtualGuestBlockDeviceTemplate.builder() + .id(508132) + .device("0") + .diskSpace(20926382592f) + .diskImageId(6865054) + .groupId(402460) + .units("B") + .diskImage(VirtualDiskImage.builder() + .id(6865054) + .capacity(25f) + .description("rrm-2k8r2dc-ico.dstdev.sl.edst.ibm.com") + .name("rrm-2k8r2dc-ico.dstdev.sl.edst.ibm.com") + .storageRepositoryId(2330746) + .units("GB") + .typeId(241) + .uuid("ef20e61c-6814-47bf-8cd9-9d26f84d3789") + .softwareReferences(ImmutableSet.of( + VirtualDiskImageSoftware.builder() + .id(4259396) + .softwareDescriptionId(727) + .softwareDescription( + SoftwareDescription.builder() + .id(727) + .longDescription("Nimsoft / Nimsoft Robot / 5.0") + .manufacturer("Nimsoft") + .name("Nimsoft Robot") + .operatingSystem(0) + .requiredUser("administrator") + .version("5.0") + .controlPanel(0) + .virtualLicense("0") + .virtualizationPlatform("0") + .build()) + .build(), + VirtualDiskImageSoftware.builder() + .id(4259398) + .softwareDescriptionId(829) + .softwareDescription( + SoftwareDescription.builder() + .id(829) + .longDescription("Microsoft / Windows 2008 FULL DC 64 bit R2 SP1 / DC 64 bit") + .manufacturer("Microsoft") + .name("Windows 2008 FULL DC 64 bit R2 SP1") + .operatingSystem(1) + .referenceCode("WIN_2008-DC-R2-SP1_64") + .requiredUser("Administrator") + .version("DC 64 bit") + .controlPanel(0) + .virtualLicense("0") + .virtualizationPlatform("0") + .build()) + .build())) + .build()) + .build(), + VirtualGuestBlockDeviceTemplate.builder() + .id(508134) + .device("1") + .diskImageId(6865058) + .groupId(402460) + .diskImage(VirtualDiskImage.builder() + .id(6865058) + .name("7903014-SWAP") + .capacity(2f) + .description("7903014-SWAP") + .storageRepositoryId(2330746) + .typeId(246) + .units("GB") + .uuid("c84edb86-a9ce-4932-bf2c-c3e4b2b44ae9") + .build()) + .build()) + .build()) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/a0ada77e/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestBlockDeviceTemplateGroupsParseTest.java ---------------------------------------------------------------------- diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestBlockDeviceTemplateGroupsParseTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestBlockDeviceTemplateGroupsParseTest.java new file mode 100644 index 0000000..e8d5069 --- /dev/null +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestBlockDeviceTemplateGroupsParseTest.java @@ -0,0 +1,131 @@ +/* + * 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.softlayer.parse; + +import java.util.Set; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.softlayer.domain.SoftwareDescription; +import org.jclouds.softlayer.domain.VirtualDiskImage; +import org.jclouds.softlayer.domain.VirtualDiskImageSoftware; +import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplate; +import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplateGroup; +import org.jclouds.softlayer.internal.BaseSoftLayerParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class + VirtualGuestBlockDeviceTemplateGroupsParseTest extends + BaseSoftLayerParseTest<Set<VirtualGuestBlockDeviceTemplateGroup>> { + + @Override + public String resource() { + return "/account_get_block_devices_template_groups.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Set<VirtualGuestBlockDeviceTemplateGroup> expected() { + return ImmutableSet.of(VirtualGuestBlockDeviceTemplateGroup.builder() + .id(82898) + .name("Backup template for disk migration of 'ljvsilauncher1.scic.ibm.com'.") + .globalIdentifier("e4055a07-13f5-4fa9-ab46-b023b65c47d2") + .statusId(1) + .accountId(278184) + .children(VirtualGuestBlockDeviceTemplateGroup.builder() + .id(82900) + .name("Backup template for disk migration of 'ljvsilauncher1.scic.ibm.com'.") + .statusId(1) + .accountId(278184) + .parentId(82898) + .blockDevices(ImmutableSet.of( + VirtualGuestBlockDeviceTemplate.builder() + .id(108100) + .device("0") + .diskSpace(21832020480f) + .diskImageId(2190750) + .groupId(82900) + .units("B") + .diskImage(VirtualDiskImage.builder() + .id(2190750) + .uuid("42423638-a54e-4d82-9b23-25af5fb13547") + .capacity(25f) + .units("GB") + .typeId(241) + .description("ljvsilauncher1.scic.ibm.com") + .name("ljvsilauncher1.scic.ibm.com") + .storageRepositoryId(906427) + .softwareReferences(ImmutableSet.of( + VirtualDiskImageSoftware.builder() + .id(1498856) + .softwareDescriptionId(1076) + .softwareDescription( + SoftwareDescription.builder() + .id(1076) + .longDescription("Microsoft / Windows 2012 FULL STD 64 bit / STD x64") + .manufacturer("Microsoft") + .name("Windows 2012 FULL STD 64 bit") + .operatingSystem(1) + .referenceCode("WIN_2012-STD_64") + .requiredUser("Administrator") + .version("STD x64") + .controlPanel(0) + .virtualLicense("0") + .virtualizationPlatform("0") + .build()) + .build(), + VirtualDiskImageSoftware.builder() + .id(1498858) + .softwareDescriptionId(106) + .softwareDescription( + SoftwareDescription.builder() + .id(106) + .longDescription("Microsoft / Windows Firewall / 1") + .manufacturer("Microsoft") + .name("Windows Firewall") + .operatingSystem(0) + .version("1") + .controlPanel(0) + .virtualLicense("0") + .virtualizationPlatform("0") + .build()) + .build())) + .build()) + .build(), VirtualGuestBlockDeviceTemplate.builder() + .id(108102) + .device("1") + .diskImageId(2190752) + .groupId(82900) + .diskImage(VirtualDiskImage.builder() + .id(2190752) + .name("3334230-SWAP") + .uuid("9f087bfb-3ed4-4985-a8b7-ac67bd8316e6") + .capacity(2f) + .units("GB") + .typeId(246) + .description("3334230-SWAP") + .storageRepositoryId(906427) + .build()) + .build())) + .build()) + .build()); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/a0ada77e/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestParseTest.java ---------------------------------------------------------------------- diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestParseTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestParseTest.java new file mode 100644 index 0000000..dccdc62 --- /dev/null +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestParseTest.java @@ -0,0 +1,65 @@ +/* + * 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.softlayer.parse; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.softlayer.domain.VirtualGuest; +import org.jclouds.softlayer.internal.BaseSoftLayerParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class VirtualGuestParseTest extends BaseSoftLayerParseTest<VirtualGuest> { + + @Override + public String resource() { + return "/virtual_guest_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public VirtualGuest expected() { + return VirtualGuest.builder() + .accountId(278184) + .createDate(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:08:21.552-07:00")) + .dedicatedAccountHostOnly(false) + .domain("test.com") + .fullyQualifiedDomainName("my.test.com") + .hostname("my") + .id(3001812) + .lastVerifiedDate(null) + .maxCpu(1) + .maxCpuUnits("CORE") + .maxMemory(1024) + .metricPollDate(null) + .modifyDate(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:10:21.552-07:00")) + .privateNetworkOnlyFlag(false) + .startCpus(1) + .statusId(1001) + .uuid("92102aff-93c9-05f1-b3f2-50787e865344") + .primaryBackendIpAddress("10.32.23.74") + .primaryIpAddress("174.37.252.118") + .billingItemId(0) + .operatingSystem(null) + .datacenter(null) + .powerState(null) + .softwareLicense(null) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/a0ada77e/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestsParseTest.java ---------------------------------------------------------------------- diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestsParseTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestsParseTest.java new file mode 100644 index 0000000..792e08e --- /dev/null +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestsParseTest.java @@ -0,0 +1,70 @@ +/* + * 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.softlayer.parse; + +import java.util.Set; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.softlayer.domain.VirtualGuest; +import org.jclouds.softlayer.internal.BaseSoftLayerParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class VirtualGuestsParseTest extends BaseSoftLayerParseTest<Set<VirtualGuest>> { + + @Override + public String resource() { + return "/account_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Set<VirtualGuest> expected() { + return ImmutableSet.of( + VirtualGuest.builder() + .accountId(278184) + .createDate(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:08:21.552-07:00")) + .dedicatedAccountHostOnly(false) + .domain("test.com") + .fullyQualifiedDomainName("my.test.com") + .hostname("my") + .id(3001812) + .lastVerifiedDate(null) + .maxCpu(1) + .maxCpuUnits("CORE") + .maxMemory(1024) + .metricPollDate(null) + .modifyDate(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:10:21.552-07:00")) + .privateNetworkOnlyFlag(false) + .startCpus(1) + .statusId(1001) + .uuid("92102aff-93c9-05f1-b3f2-50787e865344") + .primaryBackendIpAddress("10.32.23.74") + .primaryIpAddress("174.37.252.118") + .billingItemId(0) + .operatingSystem(null) + .datacenter(null) + .powerState(null) + .softwareLicense(null) + .build()); + } +}