You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2014/03/31 09:13:14 UTC
[01/52] [partial] Moving jclouds dependencies to accurate parent
directories
Repository: incubator-stratos
Updated Branches:
refs/heads/master eadddc1f6 -> de87ec626
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiExpectTest.java
deleted file mode 100644
index 4f0ac08..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiExpectTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.date.DateService;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.domain.HostAggregate;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-
-/**
- * Tests HostAggregateApi guice wiring and parsing
- *
- * @author Adam Lowe
- */
-@Test(groups = "unit", testName = "HostAggregateApiExpectTest")
-public class HostAggregateApiExpectTest extends BaseNovaApiExpectTest {
- private DateService dateService = new SimpleDateFormatDateService();
-
- public void testList() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_list.json")).build())
- .getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- HostAggregate result = Iterables.getOnlyElement(api.list());
- assertEquals(result, exampleHostAggregate());
- }
-
- public void testGet() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_with_host_details.json")).build())
- .getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.get("1"), exampleHostAggregateWithHost());
- }
-
- public void testGetFailNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(404).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertNull(api.get("1"));
- }
-
- public void testCreateAggregate() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("POST")
- .payload(payloadFromStringWithContentType("{\"aggregate\":{\"name\":\"ubuntu1\",\"availability_zone\":\"nova\"}}", MediaType.APPLICATION_JSON))
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build())
- .getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.createInAvailabilityZone("ubuntu1", "nova"), exampleHostAggregate());
- }
-
- public void testDeleteAggregate() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("DELETE").build(),
- HttpResponse.builder().statusCode(200).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.delete("1"));
- }
-
- public void testDeleteAggregateFailNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("DELETE").build(),
- HttpResponse.builder().statusCode(404).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.delete("1"));
- }
-
- public void testUpdateName() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("POST")
- .payload(payloadFromStringWithContentType("{\"aggregate\":{\"name\":\"newaggregatename\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.updateName("1", "newaggregatename"), exampleHostAggregate());
- }
-
- public void testUpdateAvailabilityZone() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("POST")
- .payload(payloadFromStringWithContentType("{\"aggregate\":{\"availability_zone\":\"zone1\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.updateAvailabilityZone("1", "zone1"), exampleHostAggregate());
- }
-
- public void testAddHost() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("POST")
- .payload(payloadFromStringWithContentType("{\"add_host\":{\"host\":\"ubuntu\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.addHost("1", "ubuntu"), exampleHostAggregate());
- }
-
- public void testRemoveHost() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("POST")
- .payload(payloadFromStringWithContentType("{\"remove_host\":{\"host\":\"ubuntu\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.removeHost("1", "ubuntu"), exampleHostAggregate());
- }
-
-
- public void testSetMetadata() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
- HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("POST")
- .payload(payloadFromStringWithContentType("{\"set_metadata\":{\"metadata\":{\"mykey\":\"some value or other\"}}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.setMetadata("1", ImmutableMap.of("mykey", "some value or other")), exampleHostAggregate());
- }
-
- public HostAggregate exampleHostAggregate() {
- return HostAggregate.builder().name("jclouds-test-a").availabilityZone("nova")
- .created(dateService.iso8601SecondsDateParse("2012-05-11 11:40:17"))
- .updated(dateService.iso8601SecondsDateParse("2012-05-11 11:46:44"))
- .state("created").id("1").metadata(ImmutableMap.of("somekey", "somevalue", "anotherkey", "another val")).build();
- }
-
- public HostAggregate exampleHostAggregateWithHost() {
- return exampleHostAggregate().toBuilder().hosts("ubuntu").build();
- }
-}
[12/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java
deleted file mode 100644
index 8b36fc9..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.extensions;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.notNull;
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.nameIn;
-import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleCidr;
-import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleEndPort;
-import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleGroup;
-import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleProtocol;
-import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleStartPort;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.Constants;
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.compute.extensions.SecurityGroupExtension;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.domain.Location;
-import org.jclouds.location.Zone;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.net.domain.IpProtocol;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.Ingress;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
-import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Supplier;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * An extension to compute service to allow for the manipulation of {@link org.jclouds.compute.domain.SecurityGroup}s. Implementation
- * is optional by providers.
- *
- * @author Andrew Bayer
- */
-public class NovaSecurityGroupExtension implements SecurityGroupExtension {
-
- protected final NovaApi api;
- protected final ListeningExecutorService userExecutor;
- protected final Supplier<Set<String>> zoneIds;
- protected final Function<SecurityGroupInZone, SecurityGroup> groupConverter;
- protected final LoadingCache<ZoneAndName, SecurityGroupInZone> groupCreator;
- protected final GroupNamingConvention.Factory namingConvention;
-
- @Inject
- public NovaSecurityGroupExtension(NovaApi api,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- @Zone Supplier<Set<String>> zoneIds,
- Function<SecurityGroupInZone, SecurityGroup> groupConverter,
- LoadingCache<ZoneAndName, SecurityGroupInZone> groupCreator,
- GroupNamingConvention.Factory namingConvention) {
-
- this.api = checkNotNull(api, "api");
- this.userExecutor = checkNotNull(userExecutor, "userExecutor");
- this.zoneIds = checkNotNull(zoneIds, "zoneIds");
- this.groupConverter = checkNotNull(groupConverter, "groupConverter");
- this.groupCreator = checkNotNull(groupCreator, "groupCreator");
- this.namingConvention = checkNotNull(namingConvention, "namingConvention");
- }
-
- @Override
- public Set<SecurityGroup> listSecurityGroups() {
- Iterable<? extends SecurityGroupInZone> rawGroups = pollSecurityGroups();
- Iterable<SecurityGroup> groups = transform(filter(rawGroups, notNull()),
- groupConverter);
- return ImmutableSet.copyOf(groups);
- }
-
-
- @Override
- public Set<SecurityGroup> listSecurityGroupsInLocation(final Location location) {
- String zone = location.getId();
- if (zone == null) {
- return ImmutableSet.of();
- }
- return listSecurityGroupsInLocation(zone);
- }
-
- public Set<SecurityGroup> listSecurityGroupsInLocation(String zone) {
- Iterable<? extends SecurityGroupInZone> rawGroups = pollSecurityGroupsByZone(zone);
- Iterable<SecurityGroup> groups = transform(filter(rawGroups, notNull()),
- groupConverter);
- return ImmutableSet.copyOf(groups);
- }
-
- @Override
- public Set<SecurityGroup> listSecurityGroupsForNode(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(checkNotNull(id, "id"));
- String zone = zoneAndId.getZone();
- String instanceId = zoneAndId.getId();
-
- Optional<? extends ServerWithSecurityGroupsApi> serverApi = api.getServerWithSecurityGroupsExtensionForZone(zone);
- Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
-
- if (!serverApi.isPresent() || !sgApi.isPresent()) {
- return ImmutableSet.of();
- }
-
- ServerWithSecurityGroups instance = serverApi.get().get(instanceId);
- if (instance == null) {
- return ImmutableSet.of();
- }
-
- Set<String> groupNames = instance.getSecurityGroupNames();
- Set<? extends SecurityGroupInZone> rawGroups =
- sgApi.get().list().filter(nameIn(groupNames)).transform(groupToGroupInZone(zone)).toSet();
-
- return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
- }
-
- @Override
- public SecurityGroup getSecurityGroupById(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(checkNotNull(id, "id"));
- String zone = zoneAndId.getZone();
- String groupId = zoneAndId.getId();
-
- Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
-
- if (!sgApi.isPresent()) {
- return null;
- }
-
- SecurityGroupInZone rawGroup = new SecurityGroupInZone(sgApi.get().get(groupId), zone);
-
- return groupConverter.apply(rawGroup);
- }
-
- @Override
- public SecurityGroup createSecurityGroup(String name, Location location) {
- String zone = location.getId();
- if (zone == null) {
- return null;
- }
- return createSecurityGroup(name, zone);
- }
-
- public SecurityGroup createSecurityGroup(String name, String zone) {
- String markerGroup = namingConvention.create().sharedNameForGroup(name);
- ZoneSecurityGroupNameAndPorts zoneAndName = new ZoneSecurityGroupNameAndPorts(zone, markerGroup, ImmutableSet.<Integer> of());
-
- SecurityGroupInZone rawGroup = groupCreator.apply(zoneAndName);
- return groupConverter.apply(rawGroup);
- }
-
- @Override
- public boolean removeSecurityGroup(String id) {
- checkNotNull(id, "id");
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- String zone = zoneAndId.getZone();
- String groupId = zoneAndId.getId();
-
- Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
-
- if (!sgApi.isPresent()) {
- return false;
- }
-
- if (sgApi.get().get(groupId) == null) {
- return false;
- }
-
- sgApi.get().delete(groupId);
- // TODO: test this clear happens
- groupCreator.invalidate(new ZoneSecurityGroupNameAndPorts(zone, groupId, ImmutableSet.<Integer> of()));
- return true;
- }
-
- @Override
- public SecurityGroup addIpPermission(IpPermission ipPermission, SecurityGroup group) {
- String zone = group.getLocation().getId();
- ZoneAndId groupZoneAndId = ZoneAndId.fromSlashEncoded(group.getId());
- String id = groupZoneAndId.getId();
- Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
-
- if (!sgApi.isPresent()) {
- return null;
- }
-
- if (ipPermission.getCidrBlocks().size() > 0) {
- for (String cidr : ipPermission.getCidrBlocks()) {
- sgApi.get().createRuleAllowingCidrBlock(id,
- Ingress.builder()
- .ipProtocol(ipPermission.getIpProtocol())
- .fromPort(ipPermission.getFromPort())
- .toPort(ipPermission.getToPort())
- .build(),
- cidr);
- }
- }
-
- if (ipPermission.getGroupIds().size() > 0) {
- for (String zoneAndGroupRaw : ipPermission.getGroupIds()) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(zoneAndGroupRaw);
- String groupId = zoneAndId.getId();
- sgApi.get().createRuleAllowingSecurityGroupId(id,
- Ingress.builder()
- .ipProtocol(ipPermission.getIpProtocol())
- .fromPort(ipPermission.getFromPort())
- .toPort(ipPermission.getToPort())
- .build(),
- groupId);
- }
- }
-
- return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode());
- }
-
- @Override
- public SecurityGroup addIpPermission(IpProtocol protocol, int startPort, int endPort,
- Multimap<String, String> tenantIdGroupNamePairs,
- Iterable<String> ipRanges,
- Iterable<String> groupIds, SecurityGroup group) {
- IpPermission.Builder permBuilder = IpPermission.builder();
- permBuilder.ipProtocol(protocol);
- permBuilder.fromPort(startPort);
- permBuilder.toPort(endPort);
- permBuilder.tenantIdGroupNamePairs(tenantIdGroupNamePairs);
- permBuilder.cidrBlocks(ipRanges);
- permBuilder.groupIds(groupIds);
-
- return addIpPermission(permBuilder.build(), group);
- }
-
- @Override
- public SecurityGroup removeIpPermission(IpPermission ipPermission, SecurityGroup group) {
- String zone = group.getLocation().getId();
- ZoneAndId groupZoneAndId = ZoneAndId.fromSlashEncoded(group.getId());
- String id = groupZoneAndId.getId();
-
- Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
-
- if (!sgApi.isPresent()) {
- return null;
- }
-
- org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroup = sgApi.get().get(id);
-
- if (ipPermission.getCidrBlocks().size() > 0) {
- for (String cidr : ipPermission.getCidrBlocks()) {
- for (SecurityGroupRule rule : filter(securityGroup.getRules(),
- and(ruleCidr(cidr), ruleProtocol(ipPermission.getIpProtocol()),
- ruleStartPort(ipPermission.getFromPort()),
- ruleEndPort(ipPermission.getToPort())))) {
- sgApi.get().deleteRule(rule.getId());
- }
- }
- }
-
- if (ipPermission.getGroupIds().size() > 0) {
- for (String groupId : ipPermission.getGroupIds()) {
- for (SecurityGroupRule rule : filter(securityGroup.getRules(),
- and(ruleGroup(groupId), ruleProtocol(ipPermission.getIpProtocol()),
- ruleStartPort(ipPermission.getFromPort()),
- ruleEndPort(ipPermission.getToPort())))) {
- sgApi.get().deleteRule(rule.getId());
- }
-
- }
- }
-
- return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode());
- }
-
- @Override
- public SecurityGroup removeIpPermission(IpProtocol protocol, int startPort, int endPort,
- Multimap<String, String> tenantIdGroupNamePairs,
- Iterable<String> ipRanges,
- Iterable<String> groupIds, SecurityGroup group) {
- IpPermission.Builder permBuilder = IpPermission.builder();
- permBuilder.ipProtocol(protocol);
- permBuilder.fromPort(startPort);
- permBuilder.toPort(endPort);
- permBuilder.tenantIdGroupNamePairs(tenantIdGroupNamePairs);
- permBuilder.cidrBlocks(ipRanges);
- permBuilder.groupIds(groupIds);
-
- return removeIpPermission(permBuilder.build(), group);
- }
-
- @Override
- public boolean supportsTenantIdGroupNamePairs() {
- return false;
- }
-
- @Override
- public boolean supportsTenantIdGroupIdPairs() {
- return false;
- }
-
- @Override
- public boolean supportsGroupIds() {
- return true;
- }
-
- @Override
- public boolean supportsPortRangesForGroups() {
- return false;
- }
-
- protected Iterable<? extends SecurityGroupInZone> pollSecurityGroups() {
- Iterable<? extends Set<? extends SecurityGroupInZone>> groups
- = transform(zoneIds.get(), allSecurityGroupsInZone());
-
- return concat(groups);
- }
-
-
- protected Iterable<? extends SecurityGroupInZone> pollSecurityGroupsByZone(String zone) {
- return allSecurityGroupsInZone().apply(zone);
- }
-
- protected Function<String, Set<? extends SecurityGroupInZone>> allSecurityGroupsInZone() {
- return new Function<String, Set<? extends SecurityGroupInZone>>() {
-
- @Override
- public Set<? extends SecurityGroupInZone> apply(final String from) {
- Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(from);
-
- if (!sgApi.isPresent()) {
- return ImmutableSet.of();
- }
-
-
- return sgApi.get().list().transform(groupToGroupInZone(from)).toSet();
- }
-
- };
- }
-
- protected Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroupInZone> groupToGroupInZone(final String zone) {
- return new Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroupInZone>() {
- @Override
- public SecurityGroupInZone apply(org.jclouds.openstack.nova.v2_0.domain.SecurityGroup group) {
- return new SecurityGroupInZone(group, zone);
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java
deleted file mode 100644
index f7c18ee..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
-import org.jclouds.rest.InsufficientResourcesException;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-/**
- * A function for adding and allocating an ip to a node
- *
- * @author Adrian Cole
- */
-public class AllocateAndAddFloatingIpToNode implements
- Function<AtomicReference<NodeMetadata>, AtomicReference<NodeMetadata>> {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final Predicate<AtomicReference<NodeMetadata>> nodeRunning;
- private final NovaApi novaApi;
- private final LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache;
-
- @Inject
- public AllocateAndAddFloatingIpToNode(@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
- NovaApi novaApi, @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache) {
- this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
- this.novaApi = checkNotNull(novaApi, "novaApi");
- this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
- }
-
- @Override
- public AtomicReference<NodeMetadata> apply(AtomicReference<NodeMetadata> input) {
- checkState(nodeRunning.apply(input), "node never achieved state running %s", input.get());
- NodeMetadata node = input.get();
- // node's location is a host
- String zoneId = node.getLocation().getParent().getId();
- FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(zoneId).get();
-
- FloatingIP ip = null;
- try {
- logger.debug(">> allocating or reassigning floating ip for node(%s)", node.getId());
- ip = floatingIpApi.create();
- } catch (InsufficientResourcesException e) {
- logger.trace("<< [%s] allocating a new floating ip for node(%s)", e.getMessage(), node.getId());
- logger.trace(">> searching for existing, unassigned floating ip for node(%s)", node.getId());
- ArrayList<FloatingIP> unassignedIps = Lists.newArrayList(Iterables.filter(floatingIpApi.list(),
- new Predicate<FloatingIP>() {
-
- @Override
- public boolean apply(FloatingIP arg0) {
- return arg0.getFixedIp() == null;
- }
-
- }));
- // try to prevent multiple parallel launches from choosing the same ip.
- Collections.shuffle(unassignedIps);
- ip = Iterables.getLast(unassignedIps);
- }
- logger.debug(">> adding floatingIp(%s) to node(%s)", ip.getIp(), node.getId());
-
- floatingIpApi.addToServer(ip.getIp(), node.getProviderId());
- input.set(NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of(ip.getIp())).build());
- floatingIpCache.invalidate(ZoneAndId.fromSlashEncoded(node.getId()));
- return input;
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper("AllocateAndAddFloatingIpToNode").toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java
deleted file mode 100644
index 6b5d519..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.find;
-import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.nameEquals;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.net.domain.IpProtocol;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.Ingress;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
-import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-
-/**
- *
- * @author Adrian Cole
- */
-@Singleton
-public class CreateSecurityGroupIfNeeded implements Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
- protected final NovaApi novaApi;
-
- @Inject
- public CreateSecurityGroupIfNeeded(NovaApi novaApi) {
- this.novaApi = checkNotNull(novaApi, "novaApi");
- }
-
- @Override
- public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts zoneSecurityGroupNameAndPorts) {
- checkNotNull(zoneSecurityGroupNameAndPorts, "zoneSecurityGroupNameAndPorts");
-
- String zoneId = zoneSecurityGroupNameAndPorts.getZone();
- Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(zoneId);
- checkArgument(api.isPresent(), "Security groups are required, but the extension is not availablein zone %s!", zoneId);
- logger.debug(">> creating securityGroup %s", zoneSecurityGroupNameAndPorts);
- try {
-
- SecurityGroup securityGroup = api.get().createWithDescription(
- zoneSecurityGroupNameAndPorts.getName(), zoneSecurityGroupNameAndPorts.getName());
-
- logger.debug("<< created securityGroup(%s)", securityGroup);
- for (int port : zoneSecurityGroupNameAndPorts.getPorts()) {
- authorizeGroupToItselfAndAllIPsToTCPPort(api.get(), securityGroup, port);
- }
- return new SecurityGroupInZone(api.get().get(securityGroup.getId()), zoneId);
- } catch (IllegalStateException e) {
- logger.trace("<< trying to find securityGroup(%s): %s", zoneSecurityGroupNameAndPorts, e.getMessage());
- SecurityGroup group = find(api.get().list(), nameEquals(zoneSecurityGroupNameAndPorts
- .getName()));
- logger.debug("<< reused securityGroup(%s)", group.getId());
- return new SecurityGroupInZone(group, zoneId);
- }
- }
-
- private void authorizeGroupToItselfAndAllIPsToTCPPort(SecurityGroupApi securityGroupApi,
- SecurityGroup securityGroup, int port) {
- logger.debug(">> authorizing securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port);
- securityGroupApi.createRuleAllowingCidrBlock(securityGroup.getId(), Ingress.builder().ipProtocol(
- IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0");
- logger.debug("<< authorized securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardware.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardware.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardware.java
deleted file mode 100644
index 160944b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardware.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.internal.VolumeImpl;
-import org.jclouds.domain.Location;
-import org.jclouds.openstack.nova.v2_0.domain.Flavor;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.FlavorInZone;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-/**
- * A function for transforming the nova specific FlavorInZone object to the generic Hardware object.
- *
- * @author Matt Stephenson
- */
-public class FlavorInZoneToHardware implements Function<FlavorInZone, Hardware> {
-
- private final Supplier<Map<String, Location>> locationIndex;
-
- @Inject
- public FlavorInZoneToHardware(Supplier<Map<String, Location>> locationIndex) {
- this.locationIndex = checkNotNull(locationIndex, "locationIndex");
- }
-
- @Override
- public Hardware apply(FlavorInZone flavorInZone) {
- Location location = locationIndex.get().get(flavorInZone.getZone());
- checkState(location != null, "location %s not in locationIndex: %s", flavorInZone.getZone(), locationIndex.get());
- Flavor flavor = flavorInZone.getFlavor();
- return new HardwareBuilder().id(flavorInZone.slashEncode()).providerId(flavor.getId()).name(flavor.getName())
- .ram(flavor.getRam()).processor(new Processor(flavor.getVcpus(), 1.0)).volume(
- new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true)).location(location).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImage.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImage.java
deleted file mode 100644
index 109da29..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImage.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.domain.Location;
-import org.jclouds.openstack.nova.v2_0.domain.Image.Status;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Supplier;
-
-/**
- * A function for transforming a nova-specific Image into a generic Image object.
- *
- * @author Matt Stephenson
- */
-public class ImageInZoneToImage implements Function<ImageInZone, Image> {
- private final Map<Status, org.jclouds.compute.domain.Image.Status> toPortableImageStatus;
- private final Function<org.jclouds.openstack.nova.v2_0.domain.Image, OperatingSystem> imageToOs;
- private final Supplier<Map<String, Location>> locationIndex;
-
- @Inject
- public ImageInZoneToImage(Map<org.jclouds.openstack.nova.v2_0.domain.Image.Status, Image.Status> toPortableImageStatus,
- Function<org.jclouds.openstack.nova.v2_0.domain.Image, OperatingSystem> imageToOs,
- Supplier<Map<String, Location>> locationIndex) {
- this.toPortableImageStatus = checkNotNull(toPortableImageStatus, "toPortableImageStatus");
- this.imageToOs = checkNotNull(imageToOs, "imageToOs");
- this.locationIndex = checkNotNull(locationIndex, "locationIndex");
- }
-
- @Override
- public Image apply(ImageInZone imageInZone) {
- Location location = locationIndex.get().get(imageInZone.getZone());
- checkState(location != null, "location %s not in locationIndex: %s", imageInZone.getZone(), locationIndex.get());
- org.jclouds.openstack.nova.v2_0.domain.Image image = imageInZone.getImage();
- return new ImageBuilder().id(imageInZone.slashEncode()).providerId(image.getId()).name(image.getName())
- .userMetadata(image.getMetadata()).operatingSystem(imageToOs.apply(image)).description(image.getName())
- .location(location).status(toPortableImageStatus.get(image.getStatus())).build();
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper(this).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystem.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystem.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystem.java
deleted file mode 100644
index f26c4e0..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystem.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Predicates.containsPattern;
-import static com.google.common.base.Predicates.equalTo;
-import static com.google.common.base.Predicates.not;
-import static com.google.common.collect.Iterables.any;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.find;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.util.ComputeServiceUtils;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.base.Splitter;
-
-/**
- * A function for transforming a nova specific Image into a generic OperatingSystem object.
- *
- * @author Matt Stephenson
- */
-public class ImageToOperatingSystem implements Function<Image, OperatingSystem> {
- public static final Pattern DEFAULT_PATTERN = Pattern.compile("(([^ ]*) ([0-9.]+) ?.*)");
- // Windows Server 2008 R2 x64
- public static final Pattern WINDOWS_PATTERN = Pattern.compile("Windows (.*) (x[86][64])");
-
- @javax.annotation.Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final Map<OsFamily, Map<String, String>> osVersionMap;
-
- @Inject
- public ImageToOperatingSystem(Map<OsFamily, Map<String, String>> osVersionMap) {
- this.osVersionMap = osVersionMap;
- }
-
- public OperatingSystem apply(final Image from) {
- OsFamily osFamily = null;
- String osVersion = null;
-
- String imageName = Objects.firstNonNull(from.getName(), "unspecified");
-
- boolean is64Bit = true;
-
- if (imageName.indexOf("Windows") != -1) {
- osFamily = OsFamily.WINDOWS;
- Matcher matcher = WINDOWS_PATTERN.matcher(from.getName());
- if (matcher.find()) {
- osVersion = ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(1), osVersionMap);
- is64Bit = matcher.group(2).equals("x64");
- }
- } else {
- if (imageName.contains("Red Hat EL")) {
- osFamily = OsFamily.RHEL;
- } else if (imageName.contains("Oracle EL")) {
- osFamily = OsFamily.OEL;
- } else {
- final Iterable<String> imageNameParts = Splitter.on(CharMatcher.WHITESPACE).trimResults().split(
- imageName.toLowerCase());
-
- try {
- osFamily = find(Arrays.asList(OsFamily.values()), new Predicate<OsFamily>() {
- @Override
- public boolean apply(OsFamily osFamily) {
- return any(imageNameParts, equalTo(osFamily.name().toLowerCase()));
- }
- });
- } catch (NoSuchElementException e) {
- String ubuntuVersion = startsWithUbuntuVersion(imageNameParts);
- if (ubuntuVersion != null) {
- osFamily = OsFamily.UBUNTU;
- osVersion = ubuntuVersion;
- } else {
- logger.trace("could not parse operating system family for image(%s): %s", from.getId(), imageNameParts);
- osFamily = OsFamily.UNRECOGNIZED;
- }
- }
- }
- Matcher matcher = DEFAULT_PATTERN.matcher(imageName);
- if (matcher.find() && matcher.groupCount() >= 3) {
- osVersion = ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(3), osVersionMap);
- }
- }
- return new OperatingSystem(osFamily, imageName, osVersion, null, imageName, is64Bit);
- }
-
- String startsWithUbuntuVersion(final Iterable<String> imageNameParts) {
- Map<String, String> ubuntuVersions = osVersionMap.get(OsFamily.UBUNTU);
- for (String ubuntuKey : filter(ubuntuVersions.keySet(), not(equalTo("")))) {
- if (any(imageNameParts, containsPattern("^" + ubuntuKey + ".*"))) {
- return ubuntuVersions.get(ubuntuKey);
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroup.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroup.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroup.java
deleted file mode 100644
index fc772df..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroup.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.compute.domain.SecurityGroupBuilder;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.inject.Inject;
-
-
-/**
- * A function for transforming a Nova-specific SecurityGroup into a generic
- * SecurityGroup object.
- *
- * @author Andrew Bayer
- */
-@Singleton
-public class NovaSecurityGroupInZoneToSecurityGroup implements Function<SecurityGroupInZone, SecurityGroup> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- protected final Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroup> baseConverter;
- protected final Supplier<Map<String, Location>> locationIndex;
-
- @Inject
- public NovaSecurityGroupInZoneToSecurityGroup(Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroup> baseConverter,
- Supplier<Map<String, Location>> locationIndex) {
- this.baseConverter = checkNotNull(baseConverter, "baseConverter");
- this.locationIndex = checkNotNull(locationIndex, "locationIndex");
- }
-
- @Override
- public SecurityGroup apply(SecurityGroupInZone group) {
- SecurityGroupBuilder builder = SecurityGroupBuilder.fromSecurityGroup(baseConverter.apply(group.getSecurityGroup()));
-
- Location zone = locationIndex.get().get(group.getZone());
- checkState(zone != null, "location %s not in locationIndex: %s", group.getZone(), locationIndex.get());
-
- builder.location(zone);
-
- builder.id(group.getZone() + "/" + group.getSecurityGroup().getId());
-
- return builder.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroup.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroup.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroup.java
deleted file mode 100644
index d39f849..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroup.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.collect.Iterables.transform;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.compute.domain.SecurityGroupBuilder;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-
-import com.google.common.base.Function;
-import com.google.inject.Inject;
-
-
-/**
- * A function for transforming a Nova-specific SecurityGroup into a generic
- * SecurityGroup object.
- *
- * @author Andrew Bayer
- */
-@Singleton
-public class NovaSecurityGroupToSecurityGroup implements Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroup> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- protected Function<SecurityGroupRule,IpPermission> ruleToPermission;
-
- @Inject
- public NovaSecurityGroupToSecurityGroup(Function<SecurityGroupRule,IpPermission> ruleToPermission) {
- this.ruleToPermission = ruleToPermission;
- }
-
- @Override
- public SecurityGroup apply(org.jclouds.openstack.nova.v2_0.domain.SecurityGroup group) {
- SecurityGroupBuilder builder = new SecurityGroupBuilder();
-
- builder.id(group.getId());
- builder.providerId(group.getId());
- builder.ownerId(group.getTenantId());
- builder.name(group.getName());
- if (group.getRules() != null) {
- builder.ipPermissions(transform(group.getRules(), ruleToPermission));
- }
-
- return builder.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneId.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneId.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneId.java
deleted file mode 100644
index 4993f0c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneId.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.collect.Sets.filter;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.predicates.NodePredicates;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.openstack.nova.v2_0.compute.predicates.AllNodesInGroupTerminated;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
-
-/**
- *
- * @author Adrian Cole
- */
-public class OrphanedGroupsByZoneId implements Function<Set<? extends NodeMetadata>, Multimap<String, String>> {
- private final Predicate<ZoneAndName> allNodesInGroupTerminated;
-
- @Inject
- protected OrphanedGroupsByZoneId(ComputeService computeService) {
- this(new AllNodesInGroupTerminated(checkNotNull(computeService, "computeService")));
- }
-
- @VisibleForTesting
- OrphanedGroupsByZoneId(Predicate<ZoneAndName> allNodesInGroupTerminated) {
- this.allNodesInGroupTerminated = checkNotNull(allNodesInGroupTerminated, "allNodesInGroupTerminated");
- }
-
- public Multimap<String, String> apply(Set<? extends NodeMetadata> deadNodes) {
- Iterable<? extends NodeMetadata> nodesWithGroup = filter(deadNodes, NodePredicates.hasGroup());
- Set<ZoneAndName> zoneAndGroupNames = ImmutableSet.copyOf(filter(transform(nodesWithGroup,
- new Function<NodeMetadata, ZoneAndName>() {
-
- @Override
- public ZoneAndName apply(NodeMetadata input) {
- String zoneId = input.getLocation().getScope() == LocationScope.HOST ? input.getLocation()
- .getParent().getId() : input.getLocation().getId();
- return ZoneAndName.fromZoneAndName(zoneId, input.getGroup());
- }
-
- }), allNodesInGroupTerminated));
- Multimap<String, String> zoneToZoneAndGroupNames = Multimaps.transformValues(Multimaps.index(zoneAndGroupNames,
- ZoneAndName.ZONE_FUNCTION), ZoneAndName.NAME_FUNCTION);
- return zoneToZoneAndGroupNames;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java
deleted file mode 100644
index 269a333..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.cache.LoadingCache;
-
-/**
- * A function for removing and deallocating an ip address from a node
- *
- * @author Adrian Cole
- */
-public class RemoveFloatingIpFromNodeAndDeallocate implements Function<ZoneAndId, ZoneAndId> {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final NovaApi novaApi;
- private final LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache;
-
- @Inject
- public RemoveFloatingIpFromNodeAndDeallocate(NovaApi novaApi,
- @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache) {
- this.novaApi = checkNotNull(novaApi, "novaApi");
- this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
- }
-
- @Override
- public ZoneAndId apply(ZoneAndId id) {
- FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(id.getZone()).get();
- for (FloatingIP ip : floatingIpCache.getUnchecked(id)) {
- logger.debug(">> removing floatingIp(%s) from node(%s)", ip, id);
- floatingIpApi.removeFromServer(ip.getIp(), id.getId());
- logger.debug(">> deallocating floatingIp(%s)", ip);
- floatingIpApi.delete(ip.getId());
- }
- floatingIpCache.invalidate(id);
- return id;
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper("RemoveFloatingIpFromNodeAndDecreate").toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermission.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermission.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermission.java
deleted file mode 100644
index a98a62b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermission.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.getFirst;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.logging.Logger;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.cache.LoadingCache;
-import com.google.common.util.concurrent.Atomics;
-
-
-/**
- * A function for transforming a nova-specific SecurityGroupRule into a generic
- * IpPermission object.
- *
- * @author Andrew Bayer
- */
-public class SecurityGroupRuleToIpPermission implements Function<SecurityGroupRule, IpPermission> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
- protected final Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone;
- protected final Supplier<Map<String, Location>> locationIndex;
- LoadingCache<ZoneAndName, SecurityGroupInZone> groupMap;
-
- @Inject
- public SecurityGroupRuleToIpPermission(@Named("SECURITYGROUP_PRESENT") Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone,
- Supplier<Map<String, Location>> locationIndex,
- LoadingCache<ZoneAndName, SecurityGroupInZone> groupMap) {
- this.returnSecurityGroupExistsInZone = checkNotNull(returnSecurityGroupExistsInZone,
- "returnSecurityGroupExistsInZone");
- this.locationIndex = checkNotNull(locationIndex, "locationIndex");
- this.groupMap = checkNotNull(groupMap, "groupMap");
- }
-
- @Override
- public IpPermission apply(SecurityGroupRule rule) {
- IpPermission.Builder builder = IpPermission.builder();
- builder.ipProtocol(rule.getIpProtocol());
- builder.fromPort(rule.getFromPort());
- builder.toPort(rule.getToPort());
- if (rule.getGroup() != null) {
- String zone = getFirst(filter(locationIndex.get().keySet(), isSecurityGroupInZone(rule.getGroup().getName())),
- null);
- if (zone != null) {
- SecurityGroupInZone group = groupMap.getUnchecked(ZoneAndName.fromZoneAndName(zone, rule.getGroup().getName()));
- builder.groupId(zone + "/" + group.getSecurityGroup().getId());
- }
- }
- if (rule.getIpRange() != null)
- builder.cidrBlock(rule.getIpRange());
-
- return builder.build();
- }
-
- protected Predicate<String> isSecurityGroupInZone(final String groupName) {
- return new Predicate<String>() {
-
- @Override
- public boolean apply(String zone) {
- AtomicReference<ZoneAndName> securityGroupInZoneRef = Atomics.newReference(ZoneAndName.fromZoneAndName(zone, groupName));
- return returnSecurityGroupExistsInZone.apply(securityGroupInZoneRef);
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadata.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadata.java
deleted file mode 100644
index 23035c2..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadata.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.base.Predicates.not;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.collect.Sets.newHashSet;
-import static org.jclouds.compute.util.ComputeServiceUtils.addMetadataAndParseTagsFromCommaDelimitedValue;
-import static org.jclouds.compute.util.ComputeServiceUtils.groupFromMapOrName;
-import static org.jclouds.openstack.nova.v2_0.domain.Address.createV4;
-import static org.jclouds.openstack.nova.v2_0.domain.Address.createV6;
-
-import java.net.Inet4Address;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.ComputeMetadata;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.domain.Address;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.util.InetAddresses2;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.net.InetAddresses;
-
-/**
- * A function for transforming a nova-specific Server into a generic
- * NodeMetadata object.
- *
- * @author Matt Stephenson, Adam Lowe, Adrian Cole
- */
-public class ServerInZoneToNodeMetadata implements Function<ServerInZone, NodeMetadata> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- protected Map<Status, org.jclouds.compute.domain.NodeMetadata.Status> toPortableNodeStatus;
- protected final Supplier<Map<String, Location>> locationIndex;
- protected final Supplier<Set<? extends Image>> images;
- protected final Supplier<Set<? extends Hardware>> hardwares;
- protected final GroupNamingConvention nodeNamingConvention;
-
- @Inject
- public ServerInZoneToNodeMetadata(Map<Server.Status, NodeMetadata.Status> toPortableNodeStatus,
- Supplier<Map<String, Location>> locationIndex, @Memoized Supplier<Set<? extends Image>> images,
- @Memoized Supplier<Set<? extends Hardware>> hardwares, GroupNamingConvention.Factory namingConvention) {
- this.toPortableNodeStatus = checkNotNull(toPortableNodeStatus, "toPortableNodeStatus");
- this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
- this.locationIndex = checkNotNull(locationIndex, "locationIndex");
- this.images = checkNotNull(images, "images");
- this.hardwares = checkNotNull(hardwares, "hardwares");
- }
-
- @Override
- public NodeMetadata apply(ServerInZone serverInZone) {
- Location zone = locationIndex.get().get(serverInZone.getZone());
- checkState(zone != null, "location %s not in locationIndex: %s", serverInZone.getZone(), locationIndex.get());
- Server from = serverInZone.getServer();
-
- NodeMetadataBuilder builder = new NodeMetadataBuilder();
- builder.id(serverInZone.slashEncode());
- builder.providerId(from.getId());
- builder.name(from.getName());
- builder.hostname(from.getName());
- builder.location(from.getHostId() != null ? new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId())
- .description(from.getHostId()).parent(zone).build() : zone);
- builder.group(groupFromMapOrName(from.getMetadata(), from.getName(), nodeNamingConvention));
- addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
- builder.imageId(ZoneAndId.fromZoneAndId(serverInZone.getZone(), from.getImage().getId()).slashEncode());
- builder.operatingSystem(findOperatingSystemForServerOrNull(serverInZone));
- builder.hardware(findHardwareForServerOrNull(serverInZone));
- builder.status(toPortableNodeStatus.get(from.getStatus()));
-
- Set<Address> addresses = newHashSet(from.getAddresses().values());
- if (from.getAccessIPv4() != null) {
- addresses.add(createV4(from.getAccessIPv4()));
- }
- if (from.getAccessIPv6() != null) {
- addresses.add(createV6(from.getAccessIPv6()));
- }
-
- builder.publicAddresses(
- filter(
- transform(
- filter(addresses, not(isPrivateAddress)),
- AddressToStringTransformationFunction.INSTANCE),
- isInet4Address));
-
- builder.privateAddresses(
- filter(
- transform(
- filter(addresses, isPrivateAddress),
- AddressToStringTransformationFunction.INSTANCE),
- isInet4Address));
-
- for (Link link: from.getLinks()) {
- if (link.getRelation().equals(Link.Relation.SELF)) {
- builder.uri(link.getHref());
- }
- }
-
- return builder.build();
- }
-
- private static final Predicate<Address> isPrivateAddress = new Predicate<Address>() {
- public boolean apply(Address in) {
- return InetAddresses2.IsPrivateIPAddress.INSTANCE.apply(in.getAddr());
- }
- };
-
- public static final Predicate<String> isInet4Address = new Predicate<String>() {
- @Override
- public boolean apply(String input) {
- try {
- // Note we can do this, as InetAddress is now on the white list
- return InetAddresses.forString(input) instanceof Inet4Address;
- } catch (IllegalArgumentException e) {
- // could be a hostname
- return true;
- }
- }
-
- };
-
- private enum AddressToStringTransformationFunction implements Function<Address, String> {
- INSTANCE;
- @Override
- public String apply(Address address) {
- return address.getAddr();
- }
- }
-
- protected Hardware findHardwareForServerOrNull(ServerInZone serverInZone) {
- return findObjectOfTypeForServerOrNull(hardwares.get(), "hardware", serverInZone.getServer().getFlavor().getId(),
- serverInZone);
- }
-
- protected OperatingSystem findOperatingSystemForServerOrNull(ServerInZone serverInZone) {
- Image image = findObjectOfTypeForServerOrNull(images.get(), "image", serverInZone.getServer().getImage().getId(),
- serverInZone);
- return (image != null) ? image.getOperatingSystem() : null;
- }
-
- public <T extends ComputeMetadata> T findObjectOfTypeForServerOrNull(Set<? extends T> supply, String type,
- final String objectId, final ZoneAndId serverInZone) {
- try {
- return find(supply, new Predicate<T>() {
- @Override
- public boolean apply(T input) {
- return input.getId().equals(ZoneAndId.fromZoneAndId(serverInZone.getZone(), objectId).slashEncode());
- }
- });
- } catch (NoSuchElementException e) {
- logger.trace("could not find %s with id(%s) for server(%s)", type, objectId, serverInZone);
- }
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java
deleted file mode 100644
index 18096fe..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.loaders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
-
-import com.google.common.base.Optional;
-import com.google.common.cache.CacheLoader;
-import com.google.inject.Inject;
-
-/**
- * @author Adam Lowe
- */
-@Singleton
-public class CreateUniqueKeyPair extends CacheLoader<ZoneAndName, KeyPair> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
- protected final NovaApi novaApi;
- protected final GroupNamingConvention.Factory namingConvention;
-
- @Inject
- public CreateUniqueKeyPair(NovaApi novaApi, GroupNamingConvention.Factory namingConvention) {
- this.novaApi = checkNotNull(novaApi, "novaApi");
- this.namingConvention = checkNotNull(namingConvention, "namingConvention");
- }
-
- @Override
- public KeyPair load(ZoneAndName zoneAndName) {
- String zoneId = checkNotNull(zoneAndName, "zoneAndName").getZone();
- String prefix = zoneAndName.getName();
-
- Optional<? extends KeyPairApi> api = novaApi.getKeyPairExtensionForZone(zoneId);
- checkArgument(api.isPresent(), "Key pairs are required, but the extension is not available in zone %s!",
- zoneId);
-
- logger.debug(">> creating keyPair zone(%s) prefix(%s)", zoneId, prefix);
-
- KeyPair keyPair = null;
- while (keyPair == null) {
- try {
- keyPair = api.get().create(namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix));
- } catch (IllegalStateException e) {
-
- }
- }
-
- logger.debug("<< created keyPair(%s)", keyPair.getName());
- return keyPair;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreate.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreate.java
deleted file mode 100644
index 71951cd..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreate.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.loaders;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.cache.CacheLoader;
-import com.google.common.util.concurrent.Atomics;
-
-/**
- *
- * @author Adrian Cole
- */
-public class FindSecurityGroupOrCreate extends CacheLoader<ZoneAndName, SecurityGroupInZone> {
-
- protected final Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone;
- protected final Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator;
-
- @Inject
- public FindSecurityGroupOrCreate(
- @Named("SECURITYGROUP_PRESENT") Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone,
- Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator) {
- this.returnSecurityGroupExistsInZone = checkNotNull(returnSecurityGroupExistsInZone,
- "returnSecurityGroupExistsInZone");
- this.groupCreator = checkNotNull(groupCreator, "groupCreator");
- }
-
- @Override
- public SecurityGroupInZone load(ZoneAndName in) {
- AtomicReference<ZoneAndName> securityGroupInZoneRef = Atomics.newReference(checkNotNull(in,
- "zoneSecurityGroupNameAndPorts"));
- if (returnSecurityGroupExistsInZone.apply(securityGroupInZoneRef)) {
- return returnExistingSecurityGroup(securityGroupInZoneRef);
- } else {
- return createNewSecurityGroup(in);
- }
- }
-
- private SecurityGroupInZone returnExistingSecurityGroup(AtomicReference<ZoneAndName> securityGroupInZoneRef) {
- ZoneAndName securityGroupInZone = securityGroupInZoneRef.get();
- checkState(securityGroupInZone instanceof SecurityGroupInZone,
- "programming error: predicate %s should update the atomic reference to the actual security group found",
- returnSecurityGroupExistsInZone);
- return SecurityGroupInZone.class.cast(securityGroupInZone);
- }
-
- private SecurityGroupInZone createNewSecurityGroup(ZoneAndName in) {
- checkState(
- checkNotNull(in, "zoneSecurityGroupNameAndPorts") instanceof ZoneSecurityGroupNameAndPorts,
- "programming error: when issuing get to this cacheloader, you need to pass an instance of ZoneSecurityGroupNameAndPorts, not %s",
- in);
- ZoneSecurityGroupNameAndPorts zoneSecurityGroupNameAndPorts = ZoneSecurityGroupNameAndPorts.class.cast(in);
- return groupCreator.apply(zoneSecurityGroupNameAndPorts);
- }
-
- @Override
- public String toString() {
- return "returnExistingSecurityGroupInZoneOrCreateAsNeeded()";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java
deleted file mode 100644
index 1c0ae8a..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.loaders;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.cache.CacheLoader;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Each zone may or may not have the floating ip function present. In order to safely proceed, we
- * must allow the user to determine if a zone has floating ip services before attempting to use
- * them.
- *
- * @author Adam Lowe
- */
-@Singleton
-public class LoadFloatingIpsForInstance extends CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>> {
- private final NovaApi api;
-
- @Inject
- public LoadFloatingIpsForInstance(NovaApi api) {
- this.api = api;
- }
-
- @Override
- public Iterable<? extends FloatingIP> load(final ZoneAndId key) throws Exception {
- String zone = key.getZone();
- Optional<? extends FloatingIPApi> ipApiOptional = api.getFloatingIPExtensionForZone(zone);
- if (ipApiOptional.isPresent()) {
- return ipApiOptional.get().list().filter(
- new Predicate<FloatingIP>() {
- @Override
- public boolean apply(FloatingIP input) {
- return key.getId().equals(input.getInstanceId());
- }
- });
- }
- return ImmutableSet.of();
- }
-}
[39/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiExpectTest.java
new file mode 100644
index 0000000..32c4617
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiExpectTest.java
@@ -0,0 +1,350 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.BackupType;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests parsing and guice wiring of AdminActionsApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "AdminActionsApiExpectTest")
+public class AdminActionsApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testSuspend() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.suspend("1"));
+ }
+
+ public void testSuspendFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.suspend("1"));
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testSuspendFailsNotAuthorized() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
+ HttpResponse.builder().statusCode(403).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.suspend("1");
+ }
+
+ public void testResume() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.resume("1"));
+ }
+
+ public void testResumeFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.resume("1"));
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testResumeFailsNotAuthorized() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
+ HttpResponse.builder().statusCode(403).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.resume("1");
+ }
+
+ public void testLock() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "lock").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.lock("1"));
+ }
+
+ public void testLockFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "lock").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.lock("1"));
+ }
+
+ public void testUnlock() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "unlock").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.unlock("1"));
+ }
+
+ public void testUnlockFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "unlock").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.unlock("1"));
+ }
+
+ public void testPause() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "pause").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.pause("1"));
+ }
+
+ public void testPauseFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "pause").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.pause("1"));
+ }
+
+ public void testUnpause() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "unpause").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.unpause("1"));
+ }
+
+ public void testUnpauseFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "unpause").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.unpause("1"));
+ }
+
+ public void testMigrateServer() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "migrate").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.migrate("1"));
+ }
+
+
+ public void testMigrateServerFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "migrate").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.migrate("1"));
+ }
+
+ public void testResetNetworkOfServer() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "resetNetwork").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.resetNetwork("1"));
+ }
+
+ public void testResetNetworkOfServerFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "resetNetwork").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.resetNetwork("1"));
+ }
+
+ public void testInjectNetworkInfoIntoServer() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "injectNetworkInfo").build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.injectNetworkInfo("1"));
+ }
+
+ public void testInjectNetworkInfoIntoServerFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "injectNetworkInfo").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.injectNetworkInfo("1"));
+ }
+
+ public void testBackupServer() {
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action").method("POST")
+ .payload(payloadFromStringWithContentType("{\"createBackup\":{\"backup_type\":\"weekly\",\"rotation\":3,\"name\":\"mybackup\",\"metadata\":{\"some\":\"data or other\"}}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(202).addHeader("Location", "http://172.16.89.149:8774/v2/images/1976b3b3-409a-468d-b16c-a9172c341b46").build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ String imageId = api.createBackup("1", "mybackup", BackupType.WEEKLY, 3, CreateBackupOfServerOptions.Builder.metadata(ImmutableMap.of("some", "data or other")));
+ assertEquals(imageId, "1976b3b3-409a-468d-b16c-a9172c341b46");
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testBackupServerFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"createBackup\":{\"backup_type\":\"weekly\",\"rotation\":3,\"name\":\"mybackup\",\"metadata\":{\"some\":\"data or other\"}}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.createBackup("1", "mybackup", BackupType.WEEKLY, 3, CreateBackupOfServerOptions.Builder.metadata(ImmutableMap.of("some", "data or other")));
+ }
+
+ public void testLiveMigrateServer() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "GONNAOVERWRITE")
+ .payload(payloadFromStringWithContentType("{\"os-migrateLive\":{\"host\":\"bighost\",\"block_migration\":true,\"disk_over_commit\":false}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(202).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.liveMigrate("1", "bighost", true, false));
+ }
+
+ public void testLiveMigrateServerFailsNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
+ ServerAdminApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ standardActionRequestBuilderVoidResponse(endpoint, "GONNAOVERWRITE")
+ .payload(payloadFromStringWithContentType("{\"os-migrateLive\":{\"host\":\"bighost\",\"block_migration\":true,\"disk_over_commit\":false}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.liveMigrate("1", "bighost", true, false));
+ }
+
+ protected HttpRequest.Builder<?> standardActionRequestBuilderVoidResponse(URI endpoint, String actionName) {
+ return HttpRequest.builder()
+ .method("POST")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"" + actionName + "\":null}", MediaType.APPLICATION_JSON))
+ .endpoint(endpoint);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java
new file mode 100644
index 0000000..1d15058
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java
@@ -0,0 +1,195 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.openstack.nova.v2_0.domain.BackupType;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
+import org.jclouds.openstack.nova.v2_0.features.ImageApi;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions;
+import org.jclouds.openstack.v2_0.features.ExtensionApi;
+import org.testng.SkipException;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of HostAdministrationApi
+ *
+ * TODO test migration methods
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "AdminActionsApiLiveTest", singleThreaded = true)
+public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest {
+ private ImageApi imageApi;
+ private ServerApi serverApi;
+ private ExtensionApi extensionApi;
+ private Optional<? extends ServerAdminApi> apiOption;
+ private String zone;
+
+ private String testServerId;
+ private String backupImageId;
+
+ @BeforeClass(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ serverApi = api.getServerApiForZone(zone);
+ extensionApi = api.getExtensionApiForZone(zone);
+ imageApi = api.getImageApiForZone(zone);
+ apiOption = api.getServerAdminExtensionForZone(zone);
+ if (apiOption.isPresent()) {
+ testServerId = createServerInZone(zone).getId();
+ }
+ }
+
+ @AfterClass(groups = { "integration", "live" })
+ @Override
+ protected void tearDown() {
+ if (apiOption.isPresent()) {
+ if (testServerId != null) {
+ assertTrue(api.getServerApiForZone(zone).delete(testServerId));
+ }
+ if (backupImageId != null) {
+ imageApi.delete(backupImageId);
+ }
+ }
+ super.tearDown();
+ }
+
+ protected void skipOnAdminExtensionAbsent() {
+ if (!apiOption.isPresent()) {
+ throw new SkipException("Test depends on ServerAdminApi extension");
+ }
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void ensureServerIsActiveAgain() {
+ if (apiOption.isPresent())
+ blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);
+ }
+
+ public void testSuspendAndResume() {
+ skipOnAdminExtensionAbsent();
+ ServerAdminApi api = apiOption.get();
+
+ // Suspend-resume
+ try {
+ api.resume(testServerId);
+ fail("Resumed an active server!");
+ } catch (HttpResponseException e) {
+ }
+ assertTrue(api.suspend(testServerId));
+ blockUntilServerInState(testServerId, serverApi, Status.SUSPENDED);
+ try {
+ api.suspend(testServerId);
+ fail("Suspended an already suspended server!");
+ } catch (HttpResponseException e) {
+ }
+ assertTrue(api.resume(testServerId));
+ blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);
+ try {
+ api.resume(testServerId);
+ fail("Resumed an already resumed server!");
+ } catch (HttpResponseException e) {
+ }
+
+ }
+
+ public void testLockAndUnlock() {
+ skipOnAdminExtensionAbsent();
+ ServerAdminApi api = apiOption.get();
+
+ // TODO should we be able to double-lock (as it were)
+ assertTrue(api.unlock(testServerId));
+ assertTrue(api.unlock(testServerId));
+ assertTrue(api.lock(testServerId));
+ assertTrue(api.lock(testServerId));
+ assertTrue(api.unlock(testServerId));
+ assertTrue(api.unlock(testServerId));
+
+ }
+
+ public void testResetNetworkAndInjectNetworkInfo() {
+ skipOnAdminExtensionAbsent();
+ ServerAdminApi api = apiOption.get();
+ assertTrue(api.resetNetwork(testServerId));
+ assertTrue(api.injectNetworkInfo(testServerId));
+ }
+
+ @Test
+ public void testPauseAndUnpause() {
+ skipOnAdminExtensionAbsent();
+ ServerAdminApi api = apiOption.get();
+
+ // Unlock and lock (double-checking error contitions too)
+ try {
+ api.unpause(testServerId);
+ fail("Unpaused active server!");
+ } catch (HttpResponseException e) {
+ }
+ assertTrue(api.pause(testServerId));
+ blockUntilServerInState(testServerId, serverApi, Status.PAUSED);
+ try {
+ api.pause(testServerId);
+ fail("paused a paused server!");
+ } catch (HttpResponseException e) {
+ }
+ assertTrue(api.unpause(testServerId));
+ blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);
+ try {
+ api.unpause(testServerId);
+ fail("Unpaused a server we just unpaused!");
+ } catch (HttpResponseException e) {
+ }
+
+ }
+
+ @Test
+ public void testCreateBackupOfServer() throws InterruptedException {
+ skipOnAdminExtensionAbsent();
+ backupImageId = apiOption.get().createBackup(testServerId, "jclouds-test-backup", BackupType.DAILY, 0,
+ CreateBackupOfServerOptions.Builder.metadata(ImmutableMap.of("test", "metadata")));
+
+ assertNotNull(backupImageId);
+
+ // If we don't have extended task status, we'll have to wait here!
+ if (extensionApi.get("OS-EXT-STS") == null) {
+ Thread.sleep(30000);
+ }
+
+ blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);
+
+ Image backupImage = imageApi.get(backupImageId);
+ assertEquals(backupImage.getId(), backupImageId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
new file mode 100644
index 0000000..f033a1b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.extensions;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @author Inbar Stolberg
+ */
+@Test(groups = "unit", testName = "AvailabilityZoneApiExpectTest")
+public class AvailabilityZoneApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testLAvailabilityZonesList() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-availability-zone")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/listAvailabilityZones.json")).build();
+
+ NovaApi availabilityZonesApi = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
+
+ assertEquals(availabilityZonesApi.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ FluentIterable<? extends AvailabilityZone> zones = availabilityZonesApi.getAvailabilityZoneApi("az-1.region-a.geo-1").list();
+
+ Optional<? extends AvailabilityZone> zone = zones.first();
+
+ assertTrue(zone.isPresent(), "Couldn't find zone");
+ assertTrue(zone.get().getName().equals("nova"), "Expected zone name to be nova but it was: " + zone.get().getName());
+ assertTrue(zone.get().getState().available(), "Zone: "+ zone.get().getName() + " is not available.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
new file mode 100644
index 0000000..a7ad44f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.extensions;
+
+import com.google.common.collect.FluentIterable;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @author inbar stolberg
+ */
+@Test(groups = "live", testName = "AvailabilityZonesApiLiveTest")
+public class AvailabilityZonesApiLiveTest extends BaseNovaApiLiveTest {
+
+ @Test
+ public void testListAvailabilityZones() throws Exception {
+
+ AvailabilityZoneAPI availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne");
+ FluentIterable<? extends AvailabilityZone> zones = availabilityZoneApi.list();
+
+ for (AvailabilityZone zone : zones) {
+ assertNotNull(zone.getName());
+ assertTrue(zone.getState().available(), "zone: " + zone.getName() + " is not available.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiExpectTest.java
new file mode 100644
index 0000000..b04b5f2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiExpectTest.java
@@ -0,0 +1,142 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests guice wiring and parsing of FlavorExtraSpecsApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "FlavorExtraSpecsApiExpectTest")
+public class FlavorExtraSpecsApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testGetAllExtraSpecs() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
+ FlavorExtraSpecsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_extra_specs.json")).build()
+ ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.getMetadata("9"), ImmutableMap.of("test", "value1"));
+ }
+
+ public void testGetAllExtraSpecsFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
+ FlavorExtraSpecsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.getMetadata("9").isEmpty());
+ }
+
+ public void testSetAllExtraSpecs() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
+ FlavorExtraSpecsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint)
+ .method("POST")
+ .payload(payloadFromStringWithContentType("{\"extra_specs\":{\"test1\":\"somevalue\"}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).build()
+ ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.updateMetadata("9", ImmutableMap.of("test1", "somevalue")));
+ }
+
+ public void testSetExtraSpec() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
+ FlavorExtraSpecsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint)
+ .method("PUT")
+ .payload(payloadFromStringWithContentType("{\"test1\":\"somevalue\"}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).build()
+ ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.updateMetadataEntry("5", "test1", "somevalue"));
+ }
+
+ public void testGetExtraSpec() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
+ FlavorExtraSpecsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"test1\":\"another value\"}", MediaType.APPLICATION_JSON)).build()
+ ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.getMetadataKey("5", "test1"), "another value");
+ }
+
+ public void testGetExtraSpecFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
+ FlavorExtraSpecsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertNull(api.getMetadataKey("5", "test1"));
+ }
+
+ public void testDeleteExtraSpec() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
+ FlavorExtraSpecsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).build()
+ ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.deleteMetadataKey("5", "test1"));
+ }
+
+ public void testDeleteExtraSpecFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
+ FlavorExtraSpecsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.deleteMetadataKey("5", "test1"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java
new file mode 100644
index 0000000..d958324
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Map;
+
+import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+
+/**
+ * Tests behavior of FlavorExtraSpecsApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "FlavorExtraSpecsApiLiveTest", singleThreaded = true)
+public class FlavorExtraSpecsApiLiveTest extends BaseNovaApiLiveTest {
+ private FlavorApi flavorApi;
+ private Optional<? extends FlavorExtraSpecsApi> apiOption;
+ private String zone;
+
+ private Resource testFlavor;
+ private Map<String, String> testSpecs = ImmutableMap.of("jclouds-test", "some data", "jclouds-test2", "more data!");
+
+ @BeforeClass(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ flavorApi = api.getFlavorApiForZone(zone);
+ apiOption = api.getFlavorExtraSpecsExtensionForZone(zone);
+ }
+
+ @AfterClass(groups = { "integration", "live" })
+ @Override
+ protected void tearDown() {
+ if (apiOption.isPresent() && testFlavor != null) {
+ for (String key : testSpecs.keySet()) {
+ assertTrue(apiOption.get().deleteMetadataKey(testFlavor.getId(), key));
+ }
+ }
+ super.tearDown();
+ }
+
+ public void testCreateExtraSpecs() {
+ if (apiOption.isPresent()) {
+ FlavorExtraSpecsApi api = apiOption.get();
+ testFlavor = Iterables.getLast(flavorApi.list().concat());
+ Map<String, String> before = api.getMetadata(testFlavor.getId());
+ assertNotNull(before);
+ Map<String, String> specs = Maps.newHashMap(before);
+ specs.putAll(testSpecs);
+ assertTrue(api.updateMetadata(testFlavor.getId(), specs));
+ assertEquals(api.getMetadata(testFlavor.getId()), specs);
+ for (Map.Entry<String, String> entry : specs.entrySet()) {
+ assertEquals(api.getMetadataKey(testFlavor.getId(), entry.getKey()), entry.getValue());
+ }
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateExtraSpecs")
+ public void testListExtraSpecs() {
+ if (apiOption.isPresent()) {
+ FlavorExtraSpecsApi api = apiOption.get();
+ for (String key : testSpecs.keySet()) {
+ assertTrue(api.getMetadata(testFlavor.getId()).containsKey(key));
+ }
+ for (Resource flavor : flavorApi.list().concat()) {
+ Map<String, String> specs = api.getMetadata(flavor.getId());
+ assertNotNull(specs);
+ for (Map.Entry<String, String> entry : specs.entrySet()) {
+ assertEquals(api.getMetadataKey(flavor.getId(), entry.getKey()), entry.getValue());
+ }
+ }
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateExtraSpecs")
+ public void testTwiddleIndividualSpecs() {
+ if (apiOption.isPresent()) {
+ FlavorExtraSpecsApi api = apiOption.get();
+ for (String key : testSpecs.keySet()) {
+ assertTrue(api.updateMetadataEntry(testFlavor.getId(), key, "new value"));
+ }
+ for (String key : testSpecs.keySet()) {
+ assertEquals(api.getMetadataKey(testFlavor.getId(), key), "new value");
+ }
+ for (Resource flavor : flavorApi.list().concat()) {
+ Map<String, String> specs = api.getMetadata(flavor.getId());
+ assertNotNull(specs);
+ for (Map.Entry<String, String> entry : specs.entrySet()) {
+ assertEquals(api.getMetadataKey(flavor.getId(), entry.getKey()), entry.getValue());
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java
new file mode 100644
index 0000000..65cf1d4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java
@@ -0,0 +1,191 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPListTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests annotation parsing of {@code FloatingIPAsyncApi}
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "FloatingIPApiExpectTest")
+public class FloatingIPApiExpectTest extends BaseNovaApiExpectTest {
+ public void testWhenNamespaceInExtensionsListFloatingIpPresent() throws Exception {
+
+ NovaApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse);
+
+ assertEquals(apiWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertTrue(apiWhenExtensionNotInList.getFloatingIPExtensionForZone("az-1.region-a.geo-1").isPresent());
+
+ }
+
+ public void testWhenNamespaceNotInExtensionsListFloatingIpNotPresent() throws Exception {
+
+ NovaApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, unmatchedExtensionsOfNovaResponse);
+
+ assertEquals(apiWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertFalse(apiWhenExtensionNotInList.getFloatingIPExtensionForZone("az-1.region-a.geo-1").isPresent());
+
+ }
+
+ public void testListFloatingIPsWhenResponseIs2xx() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/floatingip_list.json")).build();
+
+ NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
+
+ assertEquals(apiWhenFloatingIPsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().list()
+ .toString(), new ParseFloatingIPListTest().expected().toString());
+ }
+
+ public void testListFloatingIPsWhenResponseIs404() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
+
+ assertTrue(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().list().isEmpty());
+ }
+
+ public void testGetFloatingIPWhenResponseIs2xx() throws Exception {
+ HttpRequest get = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips/1")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/floatingip_details.json")).build();
+
+ NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse);
+
+ assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().get("1")
+ .toString(), new ParseFloatingIPTest().expected().toString());
+ }
+
+ public void testGetFloatingIPWhenResponseIs404() throws Exception {
+ HttpRequest get = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips/1")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse);
+
+ assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().get("1"));
+ }
+
+ public void testAllocateWhenResponseIs2xx() throws Exception {
+ HttpRequest createFloatingIP = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{}", "application/json")).build();
+
+ HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/floatingip_details.json")).build();
+
+ NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
+ createFloatingIPResponse);
+
+ assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().toString(),
+ new ParseFloatingIPTest().expected().toString());
+
+ }
+
+ public void testAllocateWhenResponseIs404() throws Exception {
+ HttpRequest createFloatingIP = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{}", "application/json")).build();
+
+ HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
+ createFloatingIPResponse);
+
+ assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create());
+ }
+
+ public void testAllocateWithPoolNameWhenResponseIs2xx() throws Exception {
+ HttpRequest createFloatingIP = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"pool\":\"myPool\"}", "application/json")).build();
+
+ HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/floatingip_details.json")).build();
+
+ NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
+ createFloatingIPResponse);
+
+ assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().allocateFromPool("myPool").toString(),
+ new ParseFloatingIPTest().expected().toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java
new file mode 100644
index 0000000..d85604c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java
@@ -0,0 +1,171 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.Address;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Multimap;
+
+/**
+ * Tests behavior of {@code ServerApi}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", testName = "FloatingIPApiLiveTest")
+public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
+
+ private static final int INCONSISTENCY_WINDOW = 5000;
+
+ @Test
+ public void testListFloatingIPs() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
+ if (!apiOption.isPresent())
+ continue;
+ FloatingIPApi api = apiOption.get();
+ Set<? extends FloatingIP> response = api.list().toSet();
+ assert null != response;
+ assertTrue(response.size() >= 0);
+ for (FloatingIP ip : response) {
+ FloatingIP newDetails = api.get(ip.getId());
+
+ assertEquals(newDetails.getId(), ip.getId());
+ assertEquals(newDetails.getIp(), ip.getIp());
+ assertEquals(newDetails.getFixedIp(), ip.getFixedIp());
+ assertEquals(newDetails.getInstanceId(), ip.getInstanceId());
+
+ }
+ }
+ }
+
+ @Test
+ public void testAllocateAndDecreateFloatingIPs() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
+ if (!apiOption.isPresent())
+ continue;
+ FloatingIPApi api = apiOption.get();
+ FloatingIP floatingIP = api.create();
+ assertNotNull(floatingIP);
+
+ Set<? extends FloatingIP> response = api.list().toSet();
+ boolean ipInSet = false;
+ for (FloatingIP ip : response) {
+ if (ip.getId().equals(floatingIP.getId()))
+ ipInSet = true;
+ }
+ assertTrue(ipInSet);
+
+ api.delete(floatingIP.getId());
+
+ response = api.list().toSet();
+ ipInSet = false;
+ for (FloatingIP ip : response) {
+ if (ip.getId().equals(floatingIP.getId())) {
+ ipInSet = true;
+ }
+ }
+ assertFalse(ipInSet);
+ }
+ }
+
+ @Test
+ public void testAddAndRemoveFloatingIp() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
+ if (!apiOption.isPresent())
+ continue;
+ FloatingIPApi api = apiOption.get();
+ ServerApi serverApi = this.api.getServerApiForZone(zoneId);
+ Server server = createServerInZone(zoneId);
+ FloatingIP floatingIP = api.create();
+ assertNotNull(floatingIP);
+ try {
+ api.addToServer(floatingIP.getIp(), server.getId());
+ assertEventually(new ServerHasFloatingIP(serverApi, server.getId(), floatingIP.getIp()));
+ } finally {
+ api.removeFromServer(floatingIP.getIp(), server.getId());
+ serverApi.delete(server.getId());
+ }
+ }
+ }
+
+ protected static void assertEventually(Runnable assertion) {
+ long start = System.currentTimeMillis();
+ AssertionError error = null;
+ for (int i = 0; i < 30; i++) {
+ try {
+ assertion.run();
+ if (i > 0)
+ System.err.printf("%d attempts and %dms asserting %s%n", i + 1, System.currentTimeMillis() - start,
+ assertion.getClass().getSimpleName());
+ return;
+ } catch (AssertionError e) {
+ error = e;
+ }
+ try {
+ Thread.sleep(INCONSISTENCY_WINDOW / 30);
+ } catch (InterruptedException e) {
+ }
+ }
+ if (error != null)
+ throw error;
+
+ }
+
+ public static final class ServerHasFloatingIP implements Runnable {
+ private final ServerApi api;
+ private final String serverId;
+ private final String floatingIP;
+
+ public ServerHasFloatingIP(ServerApi serverApi, String serverId, String floatingIP) {
+ this.api = serverApi;
+ this.serverId = serverId;
+ this.floatingIP = floatingIP;
+ }
+
+ public void run() {
+ try {
+ Server server = api.get(serverId);
+ boolean ipInServerAddresses = false;
+ Multimap<String, Address> addresses = server.getAddresses();
+ for (Address address : addresses.values()) {
+ if (address.getAddr().equals(floatingIP)) {
+ ipInServerAddresses = true;
+ }
+ }
+ assertTrue(ipInServerAddresses);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java
new file mode 100644
index 0000000..97861e3
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java
@@ -0,0 +1,241 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.Host;
+import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests HostAdministrationApi guice wiring and parsing (including the Response parsers in FieldValueResponseParsers)
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "HostAdministrationApiExpectTest")
+public class HostAdministrationApiExpectTest extends BaseNovaApiExpectTest {
+
+
+ public void testList() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts");
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/hosts_list.json")).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+
+ Host expected = Host.builder().name("ubuntu").service("compute").build();
+
+ Set<? extends Host> result = api.list().toSet();
+ Host host = Iterables.getOnlyElement(result);
+ assertEquals(host.getName(), "ubuntu");
+ assertEquals(host.getService(), "compute");
+
+ assertEquals(host, expected);
+ }
+
+ public void testGet() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/xyz");
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host.json")).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<HostResourceUsage> expected = ImmutableSet.of(
+ HostResourceUsage.builder().memoryMb(16083).project("(total)").cpu(4).diskGb(181).host("ubuntu").build(),
+ HostResourceUsage.builder().memoryMb(3396).project("(used_now)").cpu(3).diskGb(5).host("ubuntu").build(),
+ HostResourceUsage.builder().memoryMb(6144).project("(used_max)").cpu(3).diskGb(80).host("ubuntu").build(),
+ HostResourceUsage.builder().memoryMb(6144).project("f8535069c3fb404cb61c873b1a0b4921").cpu(3).diskGb(80).host("ubuntu").build()
+ );
+
+ assertEquals(api.listResourceUsage("xyz").toSet(), expected);
+ }
+
+ public void testEnableHost() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("PUT")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"status\":\"enabled\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertTrue(api.enable("ubuntu"));
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testEnableHostFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("PUT")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404)
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ api.enable("ubuntu");
+ }
+
+ public void testEnableHostFailNotEnabled() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("PUT")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"status\":\"disabled\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertFalse(api.enable("ubuntu"));
+ }
+
+ public void testDisableHost() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("PUT")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"status\":\"disable\"}", MediaType.APPLICATION_JSON))
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"status\":\"disabled\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertTrue(api.disable("ubuntu"));
+ }
+
+ public void testStartMaintenance() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("PUT")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"maintenance_mode\":\"enable\"}", MediaType.APPLICATION_JSON))
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"maintenance_mode\":\"on_maintenance\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertTrue(api.startMaintenance("ubuntu"));
+ }
+
+ public void testStopMaintenance() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("PUT")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"maintenance_mode\":\"disable\"}", MediaType.APPLICATION_JSON))
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"maintenance_mode\":\"off_maintenance\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertTrue(api.stopMaintenance("ubuntu"));
+ }
+
+ public void testStartupHost() {
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"power_action\":\"startup\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertTrue(api.startup("ubuntu"));
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testStartupHostFailNotFound() {
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build(),
+ HttpResponse.builder().statusCode(404).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertTrue(api.startup("ubuntu"));
+ }
+
+ public void testStartupHostFailWrongActionInProgress() {
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"power_action\":\"shutdown\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertFalse(api.startup("ubuntu"));
+ }
+
+ public void testShutdownHost() {
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/shutdown")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"power_action\":\"shutdown\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertTrue(api.shutdown("ubuntu"));
+ }
+
+ public void testRebootHost() {
+ HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/reboot")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"power_action\":\"reboot\"}", MediaType.APPLICATION_JSON))
+ .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
+ assertTrue(api.reboot("ubuntu"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java
new file mode 100644
index 0000000..814cd7d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.Host;
+import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of HostAdministrationApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "HostAdministrationApiLiveTest", singleThreaded = true)
+public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest {
+ private Optional<? extends HostAdministrationApi> optApi = Optional.absent();
+
+ Predicate<Host> isComputeHost = new Predicate<Host>() {
+ @Override
+ public boolean apply(Host input) {
+ return Objects.equal("compute", input.getService());
+ }
+ };
+
+ @BeforeGroups(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+
+ if (identity.endsWith(":admin")) {
+ String zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ optApi = api.getHostAdministrationExtensionForZone(zone);
+ }
+ }
+
+ public void testListAndGet() throws Exception {
+ if (optApi.isPresent()) {
+ HostAdministrationApi api = optApi.get();
+ Set<? extends Host> hosts = api.list().toSet();
+ assertNotNull(hosts);
+ for (Host host : hosts) {
+ for (HostResourceUsage usage : api.listResourceUsage(host.getName())) {
+ assertEquals(usage.getHost(), host.getName());
+ assertNotNull(usage);
+ }
+ }
+ }
+ }
+
+ @Test(enabled = false)
+ public void testEnableDisable() throws Exception {
+ if (optApi.isPresent()) {
+ HostAdministrationApi api = optApi.get();
+ Host host = Iterables.find(api.list(), isComputeHost);
+
+ assertTrue(api.disable(host.getName()));
+ assertTrue(api.enable(host.getName()));
+ }
+ }
+
+ @Test(enabled = false)
+ public void testMaintenanceMode() throws Exception {
+ if (optApi.isPresent()) {
+ HostAdministrationApi api = optApi.get();
+ Host host = Iterables.find(api.list(), isComputeHost);
+ assertTrue(api.startMaintenance(host.getName()));
+ assertTrue(api.stopMaintenance(host.getName()));
+ }
+ }
+
+ @Test(enabled = false)
+ public void testReboot() throws Exception {
+ if (optApi.isPresent()) {
+ HostAdministrationApi api = optApi.get();
+ Host host = Iterables.find(api.list(), isComputeHost);
+ assertTrue(api.reboot(host.getName()));
+ }
+ }
+
+ @Test(enabled = false)
+ public void testShutdownAndStartup() throws Exception {
+ if (optApi.isPresent()) {
+ HostAdministrationApi api = optApi.get();
+ Host host = Iterables.find(api.list(), isComputeHost);
+ assertTrue(api.shutdown(host.getName()));
+ assertTrue(api.startup(host.getName()));
+ }
+ }
+}
[47/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
new file mode 100644
index 0000000..fc6744c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
@@ -0,0 +1,250 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Aggregates can be manipulated using the Aggregate Extension to Nova (alias "OS-AGGREGATES")
+ *
+ * @see org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi
+*/
+public class HostAggregate {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromHostAggregate(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String name;
+ protected String availabilityZone;
+ protected Set<String> hosts = ImmutableSet.of();
+ protected String state;
+ protected Date created;
+ protected Date updated;
+ protected Map<String, String> metadata = ImmutableMap.of();
+
+ /**
+ * @see HostAggregate#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getAvailabilityZone()
+ */
+ public T availabilityZone(String availabilityZone) {
+ this.availabilityZone = availabilityZone;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getHosts()
+ */
+ public T hosts(Set<String> hosts) {
+ this.hosts = ImmutableSet.copyOf(checkNotNull(hosts, "hosts"));
+ return self();
+ }
+
+ public T hosts(String... in) {
+ return hosts(ImmutableSet.copyOf(in));
+ }
+
+ /**
+ * @see HostAggregate#getState()
+ */
+ public T state(String state) {
+ this.state = state;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getUpdated()
+ */
+ public T updated(Date updated) {
+ this.updated = updated;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getMetadata()
+ */
+ public T metadata(Map<String, String> metadata) {
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ return self();
+ }
+
+ public HostAggregate build() {
+ return new HostAggregate(id, name, availabilityZone, hosts, state, created, updated, metadata);
+ }
+
+ public T fromHostAggregate(HostAggregate in) {
+ return this
+ .id(in.getId())
+ .name(in.getName())
+ .availabilityZone(in.getAvailabilityZone())
+ .hosts(in.getHosts())
+ .state(in.getState())
+ .created(in.getCreated())
+ .updated(in.getUpdated().get())
+ .metadata(in.getMetadata());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final String name;
+ @Named("availability_zone")
+ private final String availabilityZone;
+ private final Set<String> hosts;
+ @Named("operational_state")
+ private final String state;
+ @Named("created_at")
+ private final Date created;
+ @Named("updated_at")
+ private final Optional<Date> updated;
+ private final Map<String, String> metadata;
+
+ @ConstructorProperties({
+ "id", "name", "availability_zone", "hosts", "operational_state", "created_at", "updated_at", "metadata"
+ })
+ protected HostAggregate(String id, String name, String availabilityZone, @Nullable Set<String> hosts, String state, Date created,
+ @Nullable Date updated, @Nullable Map<String, String> metadata) {
+ this.id = checkNotNull(id, "id");
+ this.name = checkNotNull(name, "name");
+ this.availabilityZone = checkNotNull(availabilityZone, "availabilityZone");
+ this.hosts = hosts == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(hosts);
+ this.state = checkNotNull(state, "state");
+ this.created = checkNotNull(created, "created");
+ this.updated = Optional.fromNullable(updated);
+ this.metadata = metadata == null ? ImmutableMap.<String,String>of() : ImmutableMap.copyOf(metadata);
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * note: an "Availability Zone" is different from a Nova "Zone"
+ *
+ * @return the availability zone this aggregate is in
+ */
+ public String getAvailabilityZone() {
+ return this.availabilityZone;
+ }
+
+ public Set<String> getHosts() {
+ return this.hosts;
+ }
+
+ public String getState() {
+ return this.state;
+ }
+
+ public Date getCreated() {
+ return this.created;
+ }
+
+ public Optional<Date> getUpdated() {
+ return this.updated;
+ }
+
+ public Map<String, String> getMetadata() {
+ return this.metadata;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, name, availabilityZone, hosts, state, created, updated, metadata);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ HostAggregate that = HostAggregate.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.availabilityZone, that.availabilityZone)
+ && Objects.equal(this.hosts, that.hosts)
+ && Objects.equal(this.state, that.state)
+ && Objects.equal(this.created, that.created)
+ && Objects.equal(this.updated, that.updated)
+ && Objects.equal(this.metadata, that.metadata);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("name", name).add("availabilityZone", availabilityZone).add("hosts", hosts).add("state", state).add("created", created).add("updated", updated).add("metadata", metadata);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
new file mode 100644
index 0000000..186fb33
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
@@ -0,0 +1,180 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Class HostResourceUsage
+*/
+public class HostResourceUsage {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromHostResourceUsage(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String host;
+ protected String project;
+ protected int memoryMb;
+ protected int cpu;
+ protected int diskGb;
+
+ /**
+ * @see HostResourceUsage#getHost()
+ */
+ public T host(String host) {
+ this.host = host;
+ return self();
+ }
+
+ /**
+ * @see HostResourceUsage#getProject()
+ */
+ public T project(String project) {
+ this.project = project;
+ return self();
+ }
+
+ /**
+ * @see HostResourceUsage#getMemoryMb()
+ */
+ public T memoryMb(int memoryMb) {
+ this.memoryMb = memoryMb;
+ return self();
+ }
+
+ /**
+ * @see HostResourceUsage#getCpu()
+ */
+ public T cpu(int cpu) {
+ this.cpu = cpu;
+ return self();
+ }
+
+ /**
+ * @see HostResourceUsage#getDiskGb()
+ */
+ public T diskGb(int diskGb) {
+ this.diskGb = diskGb;
+ return self();
+ }
+
+ public HostResourceUsage build() {
+ return new HostResourceUsage(host, project, memoryMb, cpu, diskGb);
+ }
+
+ public T fromHostResourceUsage(HostResourceUsage in) {
+ return this
+ .host(in.getHost())
+ .project(in.getProject())
+ .memoryMb(in.getMemoryMb())
+ .cpu(in.getCpu())
+ .diskGb(in.getDiskGb());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String host;
+ private final String project;
+ @Named("memory_mb")
+ private final int memoryMb;
+ private final int cpu;
+ @Named("disk_gb")
+ private final int diskGb;
+
+ @ConstructorProperties({
+ "host", "project", "memory_mb", "cpu", "disk_gb"
+ })
+ protected HostResourceUsage(String host, @Nullable String project, int memoryMb, int cpu, int diskGb) {
+ this.host = checkNotNull(host, "host");
+ this.project = project;
+ this.memoryMb = memoryMb;
+ this.cpu = cpu;
+ this.diskGb = diskGb;
+ }
+
+ public String getHost() {
+ return this.host;
+ }
+
+ @Nullable
+ public String getProject() {
+ return this.project;
+ }
+
+ public int getMemoryMb() {
+ return this.memoryMb;
+ }
+
+ public int getCpu() {
+ return this.cpu;
+ }
+
+ public int getDiskGb() {
+ return this.diskGb;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(host, project, memoryMb, cpu, diskGb);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ HostResourceUsage that = HostResourceUsage.class.cast(obj);
+ return Objects.equal(this.host, that.host)
+ && Objects.equal(this.project, that.project)
+ && Objects.equal(this.memoryMb, that.memoryMb)
+ && Objects.equal(this.cpu, that.cpu)
+ && Objects.equal(this.diskGb, that.diskGb);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("host", host).add("project", project).add("memoryMb", memoryMb).add("cpu", cpu).add("diskGb", diskGb);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
new file mode 100644
index 0000000..65cc81d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
@@ -0,0 +1,303 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * An image is a collection of files you use to create or rebuild a server. Operators provide
+ * pre-built OS images by default. You may also create custom images.
+ *
+ * @author Jeremy Daggett
+ * @see <a href= "http://docs.openstack.org/api/openstack-compute/1.1/content/Images-d1e4427.html"
+ />
+*/
+public class Image extends Resource {
+
+ /**
+ * In-flight images will have the status attribute set to SAVING and the conditional progress
+ * element (0-100% completion) will also be returned. Other possible values for the status
+ * attribute include: UNKNOWN, ACTIVE, SAVING, ERROR, and DELETED. Images with an ACTIVE status
+ * are available for install. The optional minDisk and minRam attributes set the minimum disk and
+ * RAM requirements needed to create a server with the image.
+ *
+ * @author Adrian Cole
+ */
+ public static enum Status {
+
+ UNRECOGNIZED, UNKNOWN, ACTIVE, SAVING, ERROR, DELETED;
+
+ public String value() {
+ return name();
+ }
+
+ public static Status fromValue(String v) {
+ try {
+ return valueOf(v);
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromImage(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Resource.Builder<T> {
+ protected Date updated;
+ protected Date created;
+ protected String tenantId;
+ protected String userId;
+ protected Image.Status status;
+ protected int progress;
+ protected int minDisk;
+ protected int minRam;
+ protected Resource server;
+ protected Map<String, String> metadata = ImmutableMap.of();
+
+ /**
+ * @see Image#getUpdated()
+ */
+ public T updated(Date updated) {
+ this.updated = updated;
+ return self();
+ }
+
+ /**
+ * @see Image#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see Image#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see Image#getUserId()
+ */
+ public T userId(String userId) {
+ this.userId = userId;
+ return self();
+ }
+
+ /**
+ * @see Image#getStatus()
+ */
+ public T status(Image.Status status) {
+ this.status = status;
+ return self();
+ }
+
+ /**
+ * @see Image#getProgress()
+ */
+ public T progress(int progress) {
+ this.progress = progress;
+ return self();
+ }
+
+ /**
+ * @see Image#getMinDisk()
+ */
+ public T minDisk(int minDisk) {
+ this.minDisk = minDisk;
+ return self();
+ }
+
+ /**
+ * @see Image#getMinRam()
+ */
+ public T minRam(int minRam) {
+ this.minRam = minRam;
+ return self();
+ }
+
+ /**
+ * @see Image#getServer()
+ */
+ public T server(Resource server) {
+ this.server = server;
+ return self();
+ }
+
+ /**
+ * @see Image#getMetadata()
+ */
+ public T metadata(Map<String, String> metadata) {
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ return self();
+ }
+
+ public Image build() {
+ return new Image(id, name, links, updated, created, tenantId, userId, status, progress, minDisk, minRam, server, metadata);
+ }
+
+ public T fromImage(Image in) {
+ return super.fromResource(in)
+ .updated(in.getUpdated())
+ .created(in.getCreated())
+ .tenantId(in.getTenantId())
+ .userId(in.getUserId())
+ .status(in.getStatus())
+ .progress(in.getProgress())
+ .minDisk(in.getMinDisk())
+ .minRam(in.getMinRam())
+ .server(in.getServer())
+ .metadata(in.getMetadata());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final Date updated;
+ private final Date created;
+ @Named("tenant_id")
+ private final String tenantId;
+ @Named("user_id")
+ private final String userId;
+ private final Image.Status status;
+ private final int progress;
+ private final int minDisk;
+ private final int minRam;
+ private final Resource server;
+ private final Map<String, String> metadata;
+
+ @ConstructorProperties({
+ "id", "name", "links", "updated", "created", "tenant_id", "user_id", "status", "progress", "minDisk", "minRam", "server", "metadata"
+ })
+ protected Image(String id, @Nullable String name, java.util.Set<Link> links, @Nullable Date updated, @Nullable Date created,
+ String tenantId, @Nullable String userId, @Nullable Status status, int progress, int minDisk, int minRam,
+ @Nullable Resource server, @Nullable Map<String, String> metadata) {
+ super(id, name, links);
+ this.updated = updated;
+ this.created = created;
+ this.tenantId = tenantId;
+ this.userId = userId;
+ this.status = status;
+ this.progress = progress;
+ this.minDisk = minDisk;
+ this.minRam = minRam;
+ this.server = server;
+ this.metadata = metadata == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(metadata);
+ }
+
+ @Nullable
+ public Date getUpdated() {
+ return this.updated;
+ }
+
+ @Nullable
+ public Date getCreated() {
+ return this.created;
+ }
+
+ @Nullable
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ @Nullable
+ public String getUserId() {
+ return this.userId;
+ }
+
+ @Nullable
+ public Status getStatus() {
+ return this.status;
+ }
+
+ public int getProgress() {
+ return this.progress;
+ }
+
+ public int getMinDisk() {
+ return this.minDisk;
+ }
+
+ public int getMinRam() {
+ return this.minRam;
+ }
+
+ @Nullable
+ public Resource getServer() {
+ return this.server;
+ }
+
+ public Map<String, String> getMetadata() {
+ return this.metadata;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(updated, created, tenantId, userId, status, progress, minDisk, minRam, server, metadata);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Image that = Image.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.updated, that.updated)
+ && Objects.equal(this.created, that.created)
+ && Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.userId, that.userId)
+ && Objects.equal(this.status, that.status)
+ && Objects.equal(this.progress, that.progress)
+ && Objects.equal(this.minDisk, that.minDisk)
+ && Objects.equal(this.minRam, that.minRam)
+ && Objects.equal(this.server, that.server)
+ && Objects.equal(this.metadata, that.metadata);
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("updated", updated).add("created", created).add("tenantId", tenantId).add("userId", userId).add("status", status).add("progress", progress).add("minDisk", minDisk).add("minRam", minRam).add("server", server).add("metadata", metadata);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
new file mode 100644
index 0000000..3a9322d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
@@ -0,0 +1,160 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.net.domain.IpProtocol;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Ingress access to a destination protocol on particular ports
+ *
+ * @author Adrian Cole
+*/
+@Beta
+public class Ingress {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromIngress(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected IpProtocol ipProtocol;
+ protected int fromPort;
+ protected int toPort;
+
+ /**
+ * @see Ingress#getIpProtocol()
+ */
+ public T ipProtocol(IpProtocol ipProtocol) {
+ this.ipProtocol = ipProtocol;
+ return self();
+ }
+
+ /**
+ * @see Ingress#getFromPort()
+ */
+ public T fromPort(int fromPort) {
+ this.fromPort = fromPort;
+ return self();
+ }
+
+ /**
+ * @see Ingress#getToPort()
+ */
+ public T toPort(int toPort) {
+ this.toPort = toPort;
+ return self();
+ }
+
+ public Ingress build() {
+ return new Ingress(ipProtocol, fromPort, toPort);
+ }
+
+ public T fromIngress(Ingress in) {
+ return this
+ .ipProtocol(in.getIpProtocol())
+ .fromPort(in.getFromPort())
+ .toPort(in.getToPort());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("ip_protocol")
+ private final IpProtocol ipProtocol;
+ @Named("from_port")
+ private final int fromPort;
+ @Named("to_port")
+ private final int toPort;
+
+ @ConstructorProperties({
+ "ip_protocol", "from_port", "to_port"
+ })
+ protected Ingress(@Nullable IpProtocol ipProtocol, int fromPort, int toPort) {
+ this.ipProtocol = ipProtocol == null ? IpProtocol.UNRECOGNIZED : ipProtocol;
+ this.fromPort = fromPort;
+ this.toPort = toPort;
+ }
+
+ /**
+ * destination IP protocol
+ */
+ public IpProtocol getIpProtocol() {
+ return this.ipProtocol;
+ }
+
+ /**
+ * Start of destination port range for the TCP and UDP protocols, or an ICMP type number. An ICMP
+ * type number of -1 indicates a wildcard (i.e., any ICMP type number).
+ */
+ public int getFromPort() {
+ return this.fromPort;
+ }
+
+ /**
+ * End of destination port range for the TCP and UDP protocols, or an ICMP code. An ICMP code of
+ * -1 indicates a wildcard (i.e., any ICMP code).
+ */
+ public int getToPort() {
+ return this.toPort;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ipProtocol, fromPort, toPort);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Ingress that = Ingress.class.cast(obj);
+ return Objects.equal(this.ipProtocol, that.ipProtocol)
+ && Objects.equal(this.fromPort, that.fromPort)
+ && Objects.equal(this.toPort, that.toPort);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("ipProtocol", ipProtocol).add("fromPort", fromPort).add("toPort", toPort);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
new file mode 100644
index 0000000..aded550
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
@@ -0,0 +1,189 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Class KeyPair
+*/
+public class KeyPair {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromKeyPair(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String publicKey;
+ protected String privateKey;
+ protected String userId;
+ protected String name;
+ protected String fingerprint;
+
+ /**
+ * @see KeyPair#getPublicKey()
+ */
+ public T publicKey(String publicKey) {
+ this.publicKey = publicKey;
+ return self();
+ }
+
+ /**
+ * @see KeyPair#getPrivateKey()
+ */
+ public T privateKey(String privateKey) {
+ this.privateKey = privateKey;
+ return self();
+ }
+
+ /**
+ * @see KeyPair#getUserId()
+ */
+ public T userId(String userId) {
+ this.userId = userId;
+ return self();
+ }
+
+ /**
+ * @see KeyPair#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see KeyPair#getFingerprint()
+ */
+ public T fingerprint(String fingerprint) {
+ this.fingerprint = fingerprint;
+ return self();
+ }
+
+ public KeyPair build() {
+ return new KeyPair(publicKey, privateKey, userId, name, fingerprint);
+ }
+
+ public T fromKeyPair(KeyPair in) {
+ return this
+ .publicKey(in.getPublicKey())
+ .privateKey(in.getPrivateKey())
+ .userId(in.getUserId())
+ .name(in.getName())
+ .fingerprint(in.getFingerprint());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("public_key")
+ private final String publicKey;
+ @Named("private_key")
+ private final String privateKey;
+ @Named("user_id")
+ private final String userId;
+ private final String name;
+ private final String fingerprint;
+
+ @ConstructorProperties({
+ "public_key", "private_key", "user_id", "name", "fingerprint"
+ })
+ protected KeyPair(@Nullable String publicKey, @Nullable String privateKey, @Nullable String userId, String name, @Nullable String fingerprint) {
+ this.publicKey = publicKey;
+ this.privateKey = privateKey;
+ this.userId = userId;
+ this.name = checkNotNull(name, "name");
+ this.fingerprint = fingerprint;
+ }
+
+ @Nullable
+ public String getPublicKey() {
+ return this.publicKey;
+ }
+
+ @Nullable
+ public String getPrivateKey() {
+ return this.privateKey;
+ }
+
+ @Nullable
+ public String getUserId() {
+ return this.userId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Nullable
+ public String getFingerprint() {
+ return this.fingerprint;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(publicKey, privateKey, userId, name, fingerprint);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ KeyPair that = KeyPair.class.cast(obj);
+ return Objects.equal(this.publicKey, that.publicKey)
+ && Objects.equal(this.privateKey, that.privateKey)
+ && Objects.equal(this.userId, that.userId)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.fingerprint, that.fingerprint);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper("")
+ .omitNullValues()
+ .add("public_key", publicKey)
+ .add("private_key", privateKey)
+ .add("user_id", userId)
+ .add("name", name)
+ .add("fingerprint", fingerprint);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
new file mode 100644
index 0000000..516f6e1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
@@ -0,0 +1,173 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * Nova (or Neutron) network definition
+ * Used to provide support for network, port, and fixed_ip when booting Nova servers.
+ * OpenStack will support either a Nova Network or Neutron, but not both at the same time.
+ * Specifying a port is only possible with Neutron.
+ * @author Zack Shoylev
+ */
+public class Network implements Comparable<Network> {
+ private final String networkUuid;
+ private final String portUuid;
+ private final String fixedIp;
+
+ @ConstructorProperties({
+ "networkUuid", "portUuid", "fixedIp"
+ })
+ protected Network(String networkUuid, String portUuid, String fixedIp) {
+ checkArgument(networkUuid != null || portUuid != null, "At least one of networkUuid or portUuid should be specified");
+ this.networkUuid = networkUuid;
+ this.portUuid = portUuid;
+ this.fixedIp = fixedIp;
+ }
+
+ /**
+ * @return the network uuid - Neutron or Nova
+ */
+ public String getNetworkUuid() {
+ return this.networkUuid;
+ }
+
+ /**
+ * @return the port uuid - Neutron only
+ */
+ public String getPortUuid() {
+ return this.portUuid;
+ }
+
+ /**
+ * @return the fixed IP address - Neutron or Nova
+ */
+ public String getFixedIp() {
+ return this.fixedIp;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networkUuid, portUuid, fixedIp);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Network that = Network.class.cast(obj);
+ return Objects.equal(this.networkUuid, that.networkUuid) &&
+ Objects.equal(this.portUuid, that.portUuid) &&
+ Objects.equal(this.fixedIp, that.fixedIp);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("networkUuid", networkUuid)
+ .add("portUuid", portUuid)
+ .add("fixedIp", fixedIp);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ /**
+ * @return A new builder object
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * @return A new Builder object from another Network
+ */
+ public Builder toBuilder() {
+ return new Builder().fromNetwork(this);
+ }
+
+ /**
+ * Implements the Builder pattern for this class
+ */
+ public static class Builder {
+ protected String networkUuid;
+ protected String portUuid;
+ protected String fixedIp;
+
+ /**
+ * @param networkUuid The UUID for the Nova network or Neutron subnet to be attached.
+ * @return The builder object.
+ * @see Network#getNetworkUuid()
+ */
+ public Builder networkUuid(String networkUuid) {
+ this.networkUuid = networkUuid;
+ return this;
+ }
+
+ /**
+ * @param portUuid The port UUID for this Neutron Network.
+ * @return The builder object.
+ * @see Network#getPortUuid()
+ */
+ public Builder portUuid(String portUuid) {
+ this.portUuid = portUuid;
+ return this;
+ }
+
+ /**
+ * @param fixedIp The fixed IP address for this Network (if any).
+ * Service automatically assigns IP address if this is not provided.
+ * Fixed IP is compatible with both Nova Network and Neutron.
+ * @return The builder object.
+ * @see Network#getFixedIp()
+ */
+ public Builder fixedIp(String fixedIp) {
+ this.fixedIp = fixedIp;
+ return this;
+ }
+
+ /**
+ * @return A new Network object.
+ */
+ public Network build() {
+ return new Network(networkUuid, portUuid, fixedIp);
+ }
+
+ /**
+ * @param in The target Network
+ * @return A Builder from the provided Network
+ */
+ public Builder fromNetwork(Network in) {
+ return this
+ .networkUuid(in.getNetworkUuid())
+ .portUuid(in.getPortUuid())
+ .fixedIp(in.getFixedIp());
+ }
+ }
+
+ @Override
+ public int compareTo(Network that) {
+ return this.toString().compareTo(that.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
new file mode 100644
index 0000000..c16693e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
@@ -0,0 +1,356 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Represents the set of limits (quotas) returned by the Quota Extension
+ *
+ * @see org.jclouds.openstack.nova.v2_0.extensions.QuotaApi
+*/
+public class Quota {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromQuotas(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected int metadataItems;
+ protected int injectedFileContentBytes;
+ protected int volumes;
+ protected int gigabytes;
+ protected int ram;
+ protected int floatingIps;
+ protected int instances;
+ protected int injectedFiles;
+ protected int cores;
+ protected int securityGroups;
+ protected int securityGroupRules;
+ protected int keyPairs;
+
+ /**
+ * @see Quota#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see Quota#getMetadatas()
+ */
+ public T metadataItems(int metadataItems) {
+ this.metadataItems = metadataItems;
+ return self();
+ }
+
+ /**
+ * @see Quota#getInjectedFileContentBytes()
+ */
+ public T injectedFileContentBytes(int injectedFileContentBytes) {
+ this.injectedFileContentBytes = injectedFileContentBytes;
+ return self();
+ }
+
+ /**
+ * @see Quota#getVolumes()
+ */
+ public T volumes(int volumes) {
+ this.volumes = volumes;
+ return self();
+ }
+
+ /**
+ * @see Quota#getGigabytes()
+ */
+ public T gigabytes(int gigabytes) {
+ this.gigabytes = gigabytes;
+ return self();
+ }
+
+ /**
+ * @see Quota#getRam()
+ */
+ public T ram(int ram) {
+ this.ram = ram;
+ return self();
+ }
+
+ /**
+ * @see Quota#getFloatingIps()
+ */
+ public T floatingIps(int floatingIps) {
+ this.floatingIps = floatingIps;
+ return self();
+ }
+
+ /**
+ * @see Quota#getInstances()
+ */
+ public T instances(int instances) {
+ this.instances = instances;
+ return self();
+ }
+
+ /**
+ * @see Quota#getInjectedFiles()
+ */
+ public T injectedFiles(int injectedFiles) {
+ this.injectedFiles = injectedFiles;
+ return self();
+ }
+
+ /**
+ * @see Quota#getCores()
+ */
+ public T cores(int cores) {
+ this.cores = cores;
+ return self();
+ }
+
+ /**
+ * @see Quota#getSecurityGroups()
+ */
+ public T securityGroups(int securityGroups) {
+ this.securityGroups = securityGroups;
+ return self();
+ }
+
+ /**
+ * @see Quota#getSecurityGroupRules()
+ */
+ public T securityGroupRules(int securityGroupRules) {
+ this.securityGroupRules = securityGroupRules;
+ return self();
+ }
+
+ /**
+ * @see Quota#getKeyPairs()
+ */
+ public T keyPairs(int keyPairs) {
+ this.keyPairs = keyPairs;
+ return self();
+ }
+
+ public Quota build() {
+ return new Quota(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
+ }
+
+ public T fromQuotas(Quota in) {
+ return this
+ .id(in.getId())
+ .metadataItems(in.getMetadatas())
+ .injectedFileContentBytes(in.getInjectedFileContentBytes())
+ .volumes(in.getVolumes())
+ .gigabytes(in.getGigabytes())
+ .ram(in.getRam())
+ .floatingIps(in.getFloatingIps())
+ .instances(in.getInstances())
+ .injectedFiles(in.getInjectedFiles())
+ .cores(in.getCores())
+ .securityGroups(in.getSecurityGroups())
+ .securityGroupRules(in.getSecurityGroupRules())
+ .keyPairs(in.getKeyPairs());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ @Named("metadata_items")
+ private final int metadataItems;
+ @Named("injected_file_content_bytes")
+ private final int injectedFileContentBytes;
+ private final int volumes;
+ private final int gigabytes;
+ private final int ram;
+ @Named("floating_ips")
+ private final int floatingIps;
+ private final int instances;
+ @Named("injected_files")
+ private final int injectedFiles;
+ private final int cores;
+ @Named("security_groups")
+ private final int securityGroups;
+ @Named("security_group_rules")
+ private final int securityGroupRules;
+ @Named("key_pairs")
+ private final int keyPairs;
+
+ @ConstructorProperties({
+ "id", "metadata_items", "injected_file_content_bytes", "volumes", "gigabytes", "ram", "floating_ips", "instances", "injected_files", "cores", "security_groups", "security_group_rules", "key_pairs"
+ })
+ protected Quota(String id, int metadataItems, int injectedFileContentBytes, int volumes, int gigabytes, int ram, int floatingIps, int instances, int injectedFiles, int cores, int securityGroups, int securityGroupRules, int keyPairs) {
+ this.id = checkNotNull(id, "id");
+ this.metadataItems = metadataItems;
+ this.injectedFileContentBytes = injectedFileContentBytes;
+ this.volumes = volumes;
+ this.gigabytes = gigabytes;
+ this.ram = ram;
+ this.floatingIps = floatingIps;
+ this.instances = instances;
+ this.injectedFiles = injectedFiles;
+ this.cores = cores;
+ this.securityGroups = securityGroups;
+ this.securityGroupRules = securityGroupRules;
+ this.keyPairs = keyPairs;
+ }
+
+ /**
+ * The id of the tenant this set of limits applies to
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * The limit of the number of metadata items for the tenant
+ */
+ public int getMetadatas() {
+ return this.metadataItems;
+ }
+
+ public int getInjectedFileContentBytes() {
+ return this.injectedFileContentBytes;
+ }
+
+ /**
+ * The limit of the number of volumes that can be created for the tenant
+ */
+ public int getVolumes() {
+ return this.volumes;
+ }
+
+ /**
+ * The limit of the total size of all volumes for the tenant
+ */
+ public int getGigabytes() {
+ return this.gigabytes;
+ }
+
+ /**
+ * The limit of total ram available to the tenant
+ */
+ public int getRam() {
+ return this.ram;
+ }
+
+ /**
+ * The limit of the number of floating ips for the tenant
+ */
+ public int getFloatingIps() {
+ return this.floatingIps;
+ }
+
+ /**
+ * The limit of the number of instances that can be created for the tenant
+ */
+ public int getInstances() {
+ return this.instances;
+ }
+
+ public int getInjectedFiles() {
+ return this.injectedFiles;
+ }
+
+ /**
+ * The limit of the number of cores that can be used by the tenant
+ */
+ public int getCores() {
+ return this.cores;
+ }
+
+ /**
+ * @return the limit of the number of security groups that can be created for the tenant
+ * @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi
+ */
+ public int getSecurityGroups() {
+ return this.securityGroups;
+ }
+
+ /**
+ * @return the limit of the number of security group rules that can be created for the tenant
+ * @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi
+ */
+ public int getSecurityGroupRules() {
+ return this.securityGroupRules;
+ }
+
+ /**
+ * @return the limit of the number of key pairs that can be created for the tenant
+ * @see org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi
+ */
+ public int getKeyPairs() {
+ return this.keyPairs;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Quota that = Quota.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.metadataItems, that.metadataItems)
+ && Objects.equal(this.injectedFileContentBytes, that.injectedFileContentBytes)
+ && Objects.equal(this.volumes, that.volumes)
+ && Objects.equal(this.gigabytes, that.gigabytes)
+ && Objects.equal(this.ram, that.ram)
+ && Objects.equal(this.floatingIps, that.floatingIps)
+ && Objects.equal(this.instances, that.instances)
+ && Objects.equal(this.injectedFiles, that.injectedFiles)
+ && Objects.equal(this.cores, that.cores)
+ && Objects.equal(this.securityGroups, that.securityGroups)
+ && Objects.equal(this.securityGroupRules, that.securityGroupRules)
+ && Objects.equal(this.keyPairs, that.keyPairs);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("metadataItems", metadataItems).add("injectedFileContentBytes", injectedFileContentBytes).add("volumes", volumes).add("gigabytes", gigabytes).add("ram", ram).add("floatingIps", floatingIps).add("instances", instances).add("injectedFiles", injectedFiles).add("cores", cores).add("securityGroups", securityGroups).add("securityGroupRules", securityGroupRules).add("keyPairs", keyPairs);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
new file mode 100644
index 0000000..27199ef
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
@@ -0,0 +1,62 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+/**
+ * Represents the set of limits (quota class) returned by the Quota Class Extension
+ *
+ * @see org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi
+*/
+public class QuotaClass extends Quota {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromQuotaClass(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Quota.Builder<T> {
+
+ public QuotaClass build() {
+ return new QuotaClass(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
+ }
+
+ public T fromQuotaClass(QuotaClass in) {
+ return super.fromQuotas(in);
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+
+ @ConstructorProperties({
+ "id", "metadata_items", "injected_file_content_bytes", "volumes", "gigabytes", "ram", "floating_ips", "instances", "injected_files", "cores", "security_groups", "security_group_rules", "key_pairs"
+ })
+ protected QuotaClass(String id, int metadataItems, int injectedFileContentBytes, int volumes, int gigabytes, int ram, int floatingIps, int instances, int injectedFiles, int cores, int securityGroups, int securityGroupRules, int keyPairs) {
+ super(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
new file mode 100644
index 0000000..453dd77
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
@@ -0,0 +1,35 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public enum RebootType {
+
+ HARD, SOFT;
+
+ public String value() {
+ return name();
+ }
+
+ public static RebootType fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
new file mode 100644
index 0000000..a0e2085
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
@@ -0,0 +1,188 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Defines a security group
+*/
+public class SecurityGroup {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSecurityGroup(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String tenantId;
+ protected String name;
+ protected String description;
+ protected Set<SecurityGroupRule> rules = ImmutableSet.of();
+
+ /**
+ * @see SecurityGroup#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroup#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroup#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroup#getDescription()
+ */
+ public T description(String description) {
+ this.description = description;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroup#getRules()
+ */
+ public T rules(Set<SecurityGroupRule> rules) {
+ this.rules = ImmutableSet.copyOf(checkNotNull(rules, "rules"));
+ return self();
+ }
+
+ public T rules(SecurityGroupRule... in) {
+ return rules(ImmutableSet.copyOf(in));
+ }
+
+ public SecurityGroup build() {
+ return new SecurityGroup(id, tenantId, name, description, rules);
+ }
+
+ public T fromSecurityGroup(SecurityGroup in) {
+ return this
+ .id(in.getId())
+ .tenantId(in.getTenantId())
+ .name(in.getName())
+ .description(in.getDescription())
+ .rules(in.getRules());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ @Named("tenant_id")
+ private final String tenantId;
+ private final String name;
+ private final String description;
+ private final Set<SecurityGroupRule> rules;
+
+ @ConstructorProperties({
+ "id", "tenant_id", "name", "description", "rules"
+ })
+ protected SecurityGroup(String id, @Nullable String tenantId, @Nullable String name, @Nullable String description, Set<SecurityGroupRule> rules) {
+ this.id = checkNotNull(id, "id");
+ this.tenantId = tenantId;
+ this.name = name;
+ this.description = description;
+ // if empty, leave null so this doesn't serialize to json
+ this.rules = checkNotNull(rules, "rules").size() == 0 ? null : ImmutableSet.copyOf(rules);
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ @Nullable
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ @Nullable
+ public String getName() {
+ return this.name;
+ }
+
+ @Nullable
+ public String getDescription() {
+ return this.description;
+ }
+
+ public Set<SecurityGroupRule> getRules() {
+ return this.rules;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, tenantId, name, description, rules);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ SecurityGroup that = SecurityGroup.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.description, that.description)
+ && Objects.equal(this.rules, that.rules);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("tenantId", tenantId).add("name", name).add("description", description).add("rules", rules);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
new file mode 100644
index 0000000..92d58f7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
@@ -0,0 +1,174 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.net.domain.IpProtocol;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ForwardingObject;
+
+/**
+ * Defines a security group rule
+ */
+public class SecurityGroupRule extends Ingress {
+
+ public static class Cidr extends ForwardingObject {
+ private String cidr;
+
+ @ConstructorProperties("cidr")
+ protected Cidr(String cidr) {
+ this.cidr = checkNotNull(cidr);
+ }
+
+ @Override
+ protected Object delegate() {
+ return cidr;
+ }
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSecurityGroupRule(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Ingress.Builder<T> {
+ protected String id;
+ protected TenantIdAndName group;
+ protected String parentGroupId;
+ protected String ipRange;
+
+ /**
+ * @see SecurityGroupRule#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroupRule#getGroup()
+ */
+ public T group(TenantIdAndName group) {
+ this.group = group;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroupRule#getParentGroupId()
+ */
+ public T parentGroupId(String parentGroupId) {
+ this.parentGroupId = parentGroupId;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroupRule#getIpRange()
+ */
+ public T ipRange(String ipRange) {
+ this.ipRange = ipRange;
+ return self();
+ }
+
+ public SecurityGroupRule build() {
+ return new SecurityGroupRule(ipProtocol, fromPort, toPort, id, group, parentGroupId, ipRange == null ? null : new Cidr(ipRange));
+ }
+
+ public T fromSecurityGroupRule(SecurityGroupRule in) {
+ return super.fromIngress(in)
+ .id(in.getId())
+ .group(in.getGroup())
+ .parentGroupId(in.getParentGroupId())
+ .ipRange(in.getIpRange());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final TenantIdAndName group;
+ @Named("parent_group_id")
+ private final String parentGroupId;
+ @Named("ip_range")
+ private final SecurityGroupRule.Cidr ipRange;
+
+ @ConstructorProperties({
+ "ip_protocol", "from_port", "to_port", "id", "group", "parent_group_id", "ip_range"
+ })
+ protected SecurityGroupRule(IpProtocol ipProtocol, int fromPort, int toPort, String id, @Nullable TenantIdAndName group, String parentGroupId, @Nullable Cidr ipRange) {
+ super(ipProtocol, fromPort, toPort);
+ this.id = checkNotNull(id, "id");
+ this.group = group;
+ this.parentGroupId = checkNotNull(parentGroupId, "parentGroupId");
+ this.ipRange = ipRange;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ @Nullable
+ public TenantIdAndName getGroup() {
+ return this.group;
+ }
+
+ public String getParentGroupId() {
+ return this.parentGroupId;
+ }
+
+ @Nullable
+ public String getIpRange() {
+ return ipRange == null ? null : ipRange.cidr;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, group, parentGroupId, ipRange);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ SecurityGroupRule that = SecurityGroupRule.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.id, that.id)
+ && Objects.equal(this.group, that.group)
+ && Objects.equal(this.parentGroupId, that.parentGroupId)
+ && Objects.equal(this.ipRange, that.ipRange);
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("id", id).add("group", group).add("parentGroupId", parentGroupId).add("ipRange", ipRange);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
new file mode 100644
index 0000000..a7b316a
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
@@ -0,0 +1,476 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Multimap;
+
+/**
+ * A server is a virtual machine instance in the compute system. Flavor and image are requisite
+ * elements when creating a server.
+ *
+ * @author Adrian Cole
+ * @see <a href=
+ * "http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
+ * />
+ */
+public class Server extends Resource {
+ public static final String DISK_CONFIG_MANUAL = "MANUAL";
+ public static final String DISK_CONFIG_AUTO = "AUTO";
+
+ /**
+ * Servers contain a status attribute that can be used as an indication of the current server
+ * state. Servers with an ACTIVE status are available for use.
+ * <p/>
+ * Other possible values for the status attribute include: BUILD, REBUILD, SUSPENDED, RESIZE,
+ * VERIFY_RESIZE, REVERT_RESIZE, PASSWORD, REBOOT, HARD_REBOOT, DELETED, UNKNOWN, and ERROR.
+ *
+ * @author Adrian Cole
+ */
+ public static enum Status {
+
+ ACTIVE, BUILD, REBUILD, SUSPENDED, PAUSED, RESIZE, VERIFY_RESIZE, REVERT_RESIZE, PASSWORD, REBOOT, HARD_REBOOT, DELETED, UNKNOWN, ERROR, STOPPED, UNRECOGNIZED;
+
+ public String value() {
+ return name();
+ }
+
+ public static Status fromValue(String v) {
+ try {
+ return valueOf(v.replaceAll("\\(.*", ""));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromServer(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Resource.Builder<T> {
+ protected String uuid;
+ protected String tenantId;
+ protected String userId;
+ protected Date updated;
+ protected Date created;
+ protected String hostId;
+ protected String accessIPv4;
+ protected String accessIPv6;
+ protected Server.Status status;
+ protected Resource image;
+ protected Resource flavor;
+ protected String keyName;
+ protected String configDrive;
+ protected Multimap<String, Address> addresses = ImmutableMultimap.of();
+ protected Map<String, String> metadata = ImmutableMap.of();
+ protected ServerExtendedStatus extendedStatus;
+ protected ServerExtendedAttributes extendedAttributes;
+ protected String diskConfig;
+
+ /**
+ * @see Server#getUuid()
+ */
+ public T uuid(String uuid) {
+ this.uuid = uuid;
+ return self();
+ }
+
+ /**
+ * @see Server#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see Server#getUserId()
+ */
+ public T userId(String userId) {
+ this.userId = userId;
+ return self();
+ }
+
+ /**
+ * @see Server#getUpdated()
+ */
+ public T updated(Date updated) {
+ this.updated = updated;
+ return self();
+ }
+
+ /**
+ * @see Server#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see Server#getHostId()
+ */
+ public T hostId(String hostId) {
+ this.hostId = hostId;
+ return self();
+ }
+
+ /**
+ * @see Server#getAccessIPv4()
+ */
+ public T accessIPv4(String accessIPv4) {
+ this.accessIPv4 = accessIPv4;
+ return self();
+ }
+
+ /**
+ * @see Server#getAccessIPv6()
+ */
+ public T accessIPv6(String accessIPv6) {
+ this.accessIPv6 = accessIPv6;
+ return self();
+ }
+
+ /**
+ * @see Server#getStatus()
+ */
+ public T status(Server.Status status) {
+ this.status = status;
+ return self();
+ }
+
+ /**
+ * @see Server#getImage()
+ */
+ public T image(Resource image) {
+ this.image = image;
+ return self();
+ }
+
+ /**
+ * @see Server#getFlavor()
+ */
+ public T flavor(Resource flavor) {
+ this.flavor = flavor;
+ return self();
+ }
+
+ /**
+ * @see Server#getKeyName()
+ */
+ public T keyName(String keyName) {
+ this.keyName = keyName;
+ return self();
+ }
+
+ /**
+ * @see Server#getConfigDrive()
+ */
+ public T configDrive(String configDrive) {
+ this.configDrive = configDrive;
+ return self();
+ }
+
+ /**
+ * @see Server#getAddresses()
+ */
+ public T addresses(Multimap<String, Address> addresses) {
+ this.addresses = addresses;
+ return self();
+ }
+
+ /**
+ * @see Server#getMetadata()
+ */
+ public T metadata(Map<String, String> metadata) {
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ return self();
+ }
+
+ /**
+ * @see Server#getExtendedStatus()
+ */
+ public T extendedStatus(ServerExtendedStatus extendedStatus) {
+ this.extendedStatus = extendedStatus;
+ return self();
+ }
+
+ /**
+ * @see Server#getExtendedAttributes()
+ */
+ public T extendedAttributes(ServerExtendedAttributes extendedAttributes) {
+ this.extendedAttributes = extendedAttributes;
+ return self();
+ }
+
+ /**
+ * @see Server#getDiskConfig()
+ */
+ public T diskConfig(String diskConfig) {
+ this.diskConfig = diskConfig;
+ return self();
+ }
+
+ public Server build() {
+ return new Server(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6,
+ status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus,
+ extendedAttributes, diskConfig);
+ }
+
+ public T fromServer(Server in) {
+ return super.fromResource(in)
+ .uuid(in.getUuid())
+ .tenantId(in.getTenantId())
+ .userId(in.getUserId())
+ .updated(in.getUpdated())
+ .created(in.getCreated())
+ .hostId(in.getHostId())
+ .accessIPv4(in.getAccessIPv4())
+ .accessIPv6(in.getAccessIPv6())
+ .status(in.getStatus())
+ .image(in.getImage())
+ .flavor(in.getFlavor())
+ .keyName(in.getKeyName())
+ .configDrive(in.getConfigDrive())
+ .addresses(in.getAddresses())
+ .metadata(in.getMetadata())
+ .extendedStatus(in.getExtendedStatus().orNull())
+ .extendedAttributes(in.getExtendedAttributes().orNull())
+ .diskConfig(in.getDiskConfig().orNull());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String uuid;
+ @Named("tenant_id")
+ private final String tenantId;
+ @Named("user_id")
+ private final String userId;
+ private final Date updated;
+ private final Date created;
+ private final String hostId;
+ private final String accessIPv4;
+ private final String accessIPv6;
+ private final Server.Status status;
+ private final Resource image;
+ private final Resource flavor;
+ @Named("key_name")
+ private final String keyName;
+ @Named("config_drive")
+ private final String configDrive;
+ private final Multimap<String, Address> addresses;
+ private final Map<String, String> metadata;
+ private final Optional<ServerExtendedStatus> extendedStatus;
+ private final Optional<ServerExtendedAttributes> extendedAttributes;
+ @Named("OS-DCF:diskConfig")
+ private final Optional<String> diskConfig;
+
+ @ConstructorProperties({
+ "id", "name", "links", "uuid", "tenant_id", "user_id", "updated", "created", "hostId", "accessIPv4", "accessIPv6", "status", "image", "flavor", "key_name", "config_drive", "addresses", "metadata", "extendedStatus", "extendedAttributes", "OS-DCF:diskConfig"
+ })
+ protected Server(String id, @Nullable String name, java.util.Set<Link> links, @Nullable String uuid, String tenantId,
+ String userId, @Nullable Date updated, Date created, @Nullable String hostId, @Nullable String accessIPv4,
+ @Nullable String accessIPv6, Server.Status status, Resource image, Resource flavor, @Nullable String keyName,
+ @Nullable String configDrive, Multimap<String, Address> addresses, Map<String, String> metadata,
+ @Nullable ServerExtendedStatus extendedStatus, @Nullable ServerExtendedAttributes extendedAttributes,
+ @Nullable String diskConfig) {
+ super(id, name, links);
+ this.uuid = uuid;
+ this.tenantId = checkNotNull(tenantId, "tenantId");
+ this.userId = checkNotNull(userId, "userId");
+ this.updated = updated;
+ this.created = checkNotNull(created, "created");
+ this.hostId = Strings.emptyToNull(hostId);
+ this.accessIPv4 = Strings.emptyToNull(accessIPv4);
+ this.accessIPv6 = Strings.emptyToNull(accessIPv6);
+ this.status = checkNotNull(status, "status");
+ this.image = checkNotNull(image, "image");
+ this.flavor = checkNotNull(flavor, "flavor");
+ this.keyName = Strings.emptyToNull(keyName);
+ this.configDrive = Strings.emptyToNull(configDrive);
+ this.addresses = ImmutableMultimap.copyOf(checkNotNull(addresses, "addresses"));
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ this.extendedStatus = Optional.fromNullable(extendedStatus);
+ this.extendedAttributes = Optional.fromNullable(extendedAttributes);
+ this.diskConfig = Optional.fromNullable(diskConfig);
+ }
+
+ /**
+ * only present until the id is in uuid form
+ *
+ * @return uuid, if id is an integer val
+ */
+ @Nullable
+ public String getUuid() {
+ return this.uuid;
+ }
+
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ public String getUserId() {
+ return this.userId;
+ }
+
+ @Nullable
+ public Date getUpdated() {
+ return this.updated;
+ }
+
+ public Date getCreated() {
+ return this.created;
+ }
+
+ /**
+ * @return host identifier, or null if in {@link Status#BUILD}
+ */
+ @Nullable
+ public String getHostId() {
+ return this.hostId;
+ }
+
+ @Nullable
+ public String getAccessIPv4() {
+ return this.accessIPv4;
+ }
+
+ @Nullable
+ public String getAccessIPv6() {
+ return this.accessIPv6;
+ }
+
+ public Status getStatus() {
+ return this.status;
+ }
+
+ @Nullable
+ public String getConfigDrive() {
+ return this.configDrive;
+ }
+
+ public Resource getImage() {
+ return this.image;
+ }
+
+ public Resource getFlavor() {
+ return this.flavor;
+ }
+
+ public Map<String, String> getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * @return the ip addresses assigned to the server
+ */
+ public Multimap<String, Address> getAddresses() {
+ return addresses;
+ }
+
+ /**
+ * @return keyName if extension is present and there is a value for this server
+ * @see KeyPairApi
+ */
+ @Nullable
+ public String getKeyName() {
+ return keyName;
+ }
+
+ /**
+ * Retrieves the extended server status fields (alias "OS-EXT-STS")
+ * <p/>
+ * NOTE: This field is only present if the Extended Status extension is installed.
+ *
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
+ */
+ public Optional<ServerExtendedStatus> getExtendedStatus() {
+ return this.extendedStatus;
+ }
+
+ /**
+ * Retrieves the extended server attributes fields (alias "OS-EXT-SRV-ATTR")
+ * <p/>
+ * NOTE: This field is only present if the The Extended Server Attributes API extension is installed.
+ *
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
+ */
+ public Optional<ServerExtendedAttributes> getExtendedAttributes() {
+ return this.extendedAttributes;
+ }
+
+ /**
+ * Disk config attribute from the Disk Config Extension (alias "OS-DCF").
+ * One of {@link Server#DISK_CONFIG_AUTO} or {@link Server#DISK_CONFIG_MANUAL}.
+ * This field is only present if the Disk Config extension is installed.
+ * <p/>
+ * NOTE: Typically a field like this would be implemented as an enum but this field was
+ * originally implmented as a String and {@link Server#DISK_CONFIG_AUTO} and
+ * {@link Server#DISK_CONFIG_MANUAL} were added later as Strings to preserve backwards
+ * compatibility.
+ *
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#DISK_CONFIG
+ * @see CreateServerOptions#getDiskConfig()
+ */
+ public Optional<String> getDiskConfig() {
+ return this.diskConfig;
+ }
+
+
+ // hashCode/equals from super is ok
+
+ @Override
+ protected ToStringHelper string() {
+ return super.string()
+ .add("uuid", uuid).add("tenantId", tenantId).add("userId", userId).add("updated", updated).add("created", created)
+ .add("hostId", hostId).add("accessIPv4", accessIPv4).add("accessIPv6", accessIPv6).add("status", status).add("image", image)
+ .add("flavor", flavor).add("keyName", keyName).add("configDrive", configDrive).add("addresses", addresses)
+ .add("metadata", metadata).add("extendedStatus", extendedStatus).add("extendedAttributes", extendedAttributes)
+ .add("diskConfig", diskConfig);
+ }
+
+}
[43/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java
new file mode 100644
index 0000000..f45826c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java
@@ -0,0 +1,206 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
+import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.binders.BindMetadataToJsonPayload;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.functions.internal.OnlyMetadataValueOrNull;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseImageDetails;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseImages;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Images via the REST API.
+ * <p/>
+ *
+ * @see ImageApi
+ * @author Jeremy Daggett
+ */
+@RequestFilters(AuthenticateRequest.class)
+public interface ImageAsyncApi {
+
+ /**
+ * @see ImageApi#list()
+ */
+ @Named("image:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/images")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseImages.class)
+ @Transform(ParseImages.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends PagedIterable<? extends Resource>> list();
+
+ /** @see ImageApi#list(PaginationOptions) */
+ @Named("image:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/images")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseImages.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ ListenableFuture<? extends PaginatedCollection<? extends Resource>> list(PaginationOptions options);
+
+ /**
+ * @see ImageApi#listInDetail()
+ */
+ @Named("image:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/images/detail")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseImageDetails.class)
+ @Transform(ParseImageDetails.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends PagedIterable<? extends Image>> listInDetail();
+
+ /** @see ImageApi#listInDetail(PaginationOptions) */
+ @Named("image:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/images/detail")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseImageDetails.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ ListenableFuture<? extends PaginatedCollection<? extends Image>> listInDetail(PaginationOptions options);
+
+ /**
+ * @see ImageApi#get
+ */
+ @Named("image:get")
+ @GET
+ @SelectJson("image")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/images/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends Image> get(@PathParam("id") String id);
+
+ /**
+ * @see ImageApi#delete
+ */
+ @Named("image:delete")
+ @DELETE
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/images/{id}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ ListenableFuture<Void> delete(@PathParam("id") String id);
+
+ /**
+ * @see ImageApi#getMetadata
+ */
+ @Named("image:getmetadata")
+ @GET
+ @SelectJson("metadata")
+ @Path("/images/{id}/metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyMapOnNotFoundOr404.class)
+ ListenableFuture<Map<String, String>> getMetadata(@PathParam("id") String id);
+
+ /**
+ * @see ImageApi#setMetadata
+ */
+ @Named("image:setmetadata")
+ @PUT
+ @SelectJson("metadata")
+ @Path("/images/{id}/metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyMapOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ ListenableFuture<Map<String, String>> setMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map<String, String> metadata);
+
+ /**
+ * @see ImageApi#updateMetadata
+ */
+ @Named("image:updatemetadata")
+ @POST
+ @SelectJson("metadata")
+ @Path("/images/{id}/metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyMapOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ ListenableFuture<? extends Map<String, String>> updateMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map<String, String> metadata);
+
+ /**
+ * @see ImageApi#getMetadata
+ */
+ @Named("image:getmetadata")
+ @GET
+ @Path("/images/{id}/metadata/{key}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @ResponseParser(OnlyMetadataValueOrNull.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<String> getMetadata(@PathParam("id") String id, @PathParam("key") String key);
+
+ /**
+ * @see ImageApi#updateMetadata
+ */
+ @Named("image:updatemetadata")
+ @PUT
+ @Path("/images/{id}/metadata/{key}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ResponseParser(OnlyMetadataValueOrNull.class)
+ @MapBinder(BindMetadataToJsonPayload.class)
+ ListenableFuture<String> updateMetadata(@PathParam("id") String id,
+ @PathParam("key") @PayloadParam("key") String key, @PathParam("value") @PayloadParam("value") String value);
+
+
+ /**
+ * @see ImageApi#deleteMetadata
+ */
+ @Named("image:deletemetadata")
+ @DELETE
+ @Consumes
+ @Path("/images/{id}/metadata/{key}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ ListenableFuture<Void> deleteMetadata(@PathParam("id") String id, @PathParam("key") String key);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java
new file mode 100644
index 0000000..9354d9a
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java
@@ -0,0 +1,276 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import com.google.common.base.Optional;
+import java.util.Map;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.domain.RebootType;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
+import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
+import org.jclouds.openstack.nova.v2_0.options.RebuildServerOptions;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * Provides synchronous access to Server.
+ * <p/>
+ *
+ * @see ServerAsyncApi
+ * @see <a href=
+ * "http://docs.openstack.org/api/openstack-compute/1.1/content/Servers-d1e2073.html"
+ * />
+ * @author Adrian Cole
+ */
+public interface ServerApi {
+
+ /**
+ * List all servers (IDs, names, links)
+ *
+ * @return all servers (IDs, names, links)
+ */
+ PagedIterable<? extends Resource> list();
+
+ PaginatedCollection<? extends Resource> list(PaginationOptions options);
+
+ /**
+ * List all servers (all details)
+ *
+ * @return all servers (all details)
+ */
+ PagedIterable<? extends Server> listInDetail();
+
+ PaginatedCollection<? extends Server> listInDetail(PaginationOptions options);
+
+ /**
+ * List details of the specified server
+ *
+ * @param id
+ * id of the server
+ * @return server or null if not found
+ */
+ Server get(String id);
+
+ /**
+ * Create a new server
+ *
+ * @param name
+ * name of the server to create
+ * @param imageRef
+ * reference to the image for the server to use
+ * @param flavorRef
+ * reference to the flavor to use when creating the server
+ * @param options
+ * optional parameters to be passed into the server creation
+ * request
+ * @return the newly created server
+ */
+ ServerCreated create(String name, String imageRef, String flavorRef, CreateServerOptions... options);
+
+ /**
+ * Terminate and delete a server.
+ *
+ * @param id
+ * id of the server
+ * @return True if successful, False otherwise
+ */
+ boolean delete(String id);
+
+ /**
+ * Start a server
+ *
+ * @param id
+ * id of the server
+ */
+ void start(String id);
+
+ /**
+ * Stop a server
+ *
+ * @param id
+ * id of the server
+ */
+ void stop(String id);
+
+ /**
+ * Reboot a server.
+ *
+ * @param id
+ * id of the server
+ * @param rebootType
+ * The type of reboot to perform (Hard/Soft)
+ */
+ void reboot(String id, RebootType rebootType);
+
+ /**
+ * Resize a server to a new flavor size.
+ *
+ * @param id
+ * id of the server
+ * @param flavorId
+ * id of the new flavor to use
+ */
+ void resize(String id, String flavorId);
+
+ /**
+ * Confirm a resize operation.
+ *
+ * @param id
+ * id of the server
+ */
+ void confirmResize(String id);
+
+ /**
+ * Revert a resize operation.
+ *
+ * @param id
+ * id of the server
+ */
+ void revertResize(String id);
+
+ /**
+ * Rebuild a server.
+ *
+ * @param id
+ * id of the server
+ * @param options
+ * Optional parameters to the rebuilding operation.
+ */
+ void rebuild(String id, RebuildServerOptions... options);
+
+ /**
+ * Change the administrative password to a server.
+ *
+ * @param id
+ * id of the server
+ * @param adminPass
+ * The new administrative password to use
+ */
+ void changeAdminPass(String id, String adminPass);
+
+ /**
+ * Rename a server.
+ *
+ * @param id
+ * id of the server
+ * @param newName
+ * The new name for the server
+ */
+ void rename(String id, String newName);
+
+ /**
+ * Create an image from a server.
+ *
+ * @param name
+ * The name of the new image
+ * @param id
+ * id of the server
+ *
+ * @return ID of the new / updated image
+ */
+ String createImageFromServer(String name, String id);
+
+ /**
+ * List all metadata for a server.
+ *
+ * @param id
+ * id of the server
+ *
+ * @return the metadata as a Map<String, String>
+ */
+ Map<String, String> getMetadata(String id);
+
+ /**
+ * Set the metadata for a server.
+ *
+ * @param id
+ * id of the server
+ * @param metadata
+ * a Map containing the metadata
+ * @return the metadata as a Map<String, String>
+ */
+ Map<String, String> setMetadata(String id, Map<String, String> metadata);
+
+ /**
+ * Update the metadata for a server.
+ *
+ * @param id
+ * id of the server
+ * @param metadata
+ * a Map containing the metadata
+ * @return the metadata as a Map<String, String>
+ */
+ Map<String, String> updateMetadata(String id, Map<String, String> metadata);
+
+ /**
+ * Update the metadata for a server.
+ *
+ * @param id
+ * id of the image
+ * @param metadata
+ * a Map containing the metadata
+ * @return the value or null if not present
+ */
+ @Nullable
+ String getMetadata(String id, String key);
+
+ /**
+ * Set a metadata item for a server.
+ *
+ * @param id
+ * id of the image
+ * @param key
+ * the name of the metadata item
+ * @param value
+ * the value of the metadata item
+ * @return the value you updated
+ */
+ String updateMetadata(String id, String key, String value);
+
+ /**
+ * Delete a metadata item from a server.
+ *
+ * @param id
+ * id of the image
+ * @param key
+ * the name of the metadata item
+ */
+ void deleteMetadata(String id, String key);
+
+
+ /**
+ * Get usage information about the server such as CPU usage, Memory and IO.
+ * The information returned by this method is dependent on the hypervisor
+ * in use by the OpenStack installation and whether that hypervisor supports
+ * this method. More information can be found in the
+ * <a href="http://api.openstack.org/api-ref.html"> OpenStack API
+ * reference</a>. <br/>
+ * At the moment the returned response is a generic map. In future versions
+ * of OpenStack this might be subject to change.
+ *
+ * @param id
+ * id of the server
+ * @return A Map containing the collected values organized by key - value.
+ * @Beta
+ */
+ Optional<Map<String, String>> getDiagnostics(String id);
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java
new file mode 100644
index 0000000..2d63d65
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java
@@ -0,0 +1,356 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.AbsentOn403Or404Or500;
+import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
+import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.binders.BindMetadataToJsonPayload;
+import org.jclouds.openstack.nova.v2_0.domain.RebootType;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
+import org.jclouds.openstack.nova.v2_0.functions.ParseImageIdFromLocationHeader;
+import org.jclouds.openstack.nova.v2_0.functions.internal.OnlyMetadataValueOrNull;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseDiagnostics;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServerDetails;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServers;
+import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
+import org.jclouds.openstack.nova.v2_0.options.RebuildServerOptions;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.annotations.Unwrap;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Server via their REST API.
+ * <p/>
+ *
+ * @see ServerApi
+ * @see <a href= "http://docs.openstack.org/api/openstack-compute/1.1/content/Servers-d1e2073.html"
+ * />
+ * @author Adrian Cole
+ */
+@RequestFilters(AuthenticateRequest.class)
+public interface ServerAsyncApi {
+
+ /**
+ * @see ServerApi#list()
+ */
+ @Named("server:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/servers")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseServers.class)
+ @Transform(ParseServers.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends PagedIterable<? extends Resource>> list();
+
+ /** @see ServerApi#list(PaginationOptions) */
+ @Named("server:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/servers")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseServers.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ ListenableFuture<? extends PaginatedCollection<? extends Resource>> list(PaginationOptions options);
+
+ /**
+ * @see ServerApi#listInDetail()
+ */
+ @Named("server:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/servers/detail")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseServerDetails.class)
+ @Transform(ParseServerDetails.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends PagedIterable<? extends Server>> listInDetail();
+
+ /** @see ServerApi#listInDetail(PaginationOptions) */
+ @Named("server:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/servers/detail")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseServerDetails.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ ListenableFuture<? extends PaginatedCollection<? extends Server>> listInDetail(PaginationOptions options);
+
+ /**
+ * @see ServerApi#get
+ */
+ @Named("server:get")
+ @GET
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/servers/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends Server> get(@PathParam("id") String id);
+
+ /**
+ * @see ServerApi#delete
+ */
+ @Named("server:delete")
+ @DELETE
+ @Consumes
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/servers/{id}")
+ ListenableFuture<Boolean> delete(@PathParam("id") String id);
+
+ /**
+ * @see ServerApi#start
+ */
+ @Named("server:start")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"os-start\":null}")
+ ListenableFuture<Void> start(@PathParam("id") String id);
+
+ /**
+ * @see ServerApi#stop
+ */
+ @Named("server:stop")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"os-stop\":null}")
+ ListenableFuture<Void> stop(@PathParam("id") String id);
+
+ /**
+ * @see ServerApi#reboot
+ */
+ @Named("server:reboot")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"reboot\":%7B\"type\":\"{type}\"%7D%7D")
+ ListenableFuture<Void> reboot(@PathParam("id") String id, @PayloadParam("type") RebootType rebootType);
+
+ /**
+ * @see ServerApi#resize
+ */
+ @Named("server:resize")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"resize\":%7B\"flavorRef\":{flavorId}%7D%7D")
+ ListenableFuture<Void> resize(@PathParam("id") String id, @PayloadParam("flavorId") String flavorId);
+
+ /**
+ * @see ServerApi#confirmResize
+ */
+ @Named("server:resize")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"confirmResize\":null}")
+ ListenableFuture<Void> confirmResize(@PathParam("id") String id);
+
+ /**
+ * @see ServerApi#revertResize
+ */
+ @Named("server:resize")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"revertResize\":null}")
+ ListenableFuture<Void> revertResize(@PathParam("id") String id);
+
+ /**
+ * @see ServerApi#create
+ */
+ @Named("server:create")
+ @POST
+ @Unwrap
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/servers")
+ @MapBinder(CreateServerOptions.class)
+ ListenableFuture<ServerCreated> create(@PayloadParam("name") String name, @PayloadParam("imageRef") String imageRef,
+ @PayloadParam("flavorRef") String flavorRef, CreateServerOptions... options);
+
+ /**
+ * @see ServerApi#rebuild
+ */
+ @Named("server:rebuild")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes
+ @MapBinder(RebuildServerOptions.class)
+ ListenableFuture<Void> rebuild(@PathParam("id") String id, RebuildServerOptions... options);
+
+ /**
+ * @see ServerApi#changeAdminPass
+ */
+ @Named("server:changeadminpass")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"changePassword\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
+ ListenableFuture<Void> changeAdminPass(@PathParam("id") String id, @PayloadParam("adminPass") String adminPass);
+
+ /**
+ * @see ServerApi#rename
+ */
+ @Named("server:rename")
+ @PUT
+ @Path("/servers/{id}")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"server\":%7B\"name\":\"{name}\"%7D%7D")
+ ListenableFuture<Void> rename(@PathParam("id") String id, @PayloadParam("name") String newName);
+
+ /**
+ * @see ServerApi#createImageFromServer
+ */
+ @Named("server:create")
+ @POST
+ @Path("/servers/{id}/action")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"createImage\":%7B\"name\":\"{name}\", \"metadata\": %7B%7D%7D%7D")
+ @Fallback(MapHttp4xxCodesToExceptions.class)
+ @ResponseParser(ParseImageIdFromLocationHeader.class)
+ ListenableFuture<String> createImageFromServer(@PayloadParam("name") String name, @PathParam("id") String id);
+
+ /**
+ * @see ServerApi#getMetadata
+ */
+ @Named("server:getmetadata")
+ @GET
+ @SelectJson("metadata")
+ @Path("/servers/{id}/metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyMapOnNotFoundOr404.class)
+ ListenableFuture<? extends Map<String, String>> getMetadata(@PathParam("id") String id);
+
+ /**
+ * @see ServerApi#setMetadata
+ */
+ @Named("server:setmetadata")
+ @PUT
+ @SelectJson("metadata")
+ @Path("/servers/{id}/metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyMapOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ ListenableFuture<? extends Map<String, String>> setMetadata(@PathParam("id") String id,
+ @PayloadParam("metadata") Map<String, String> metadata);
+
+ /**
+ * @see ServerApi#updateMetadata
+ */
+ @Named("server:updatemetadata")
+ @POST
+ @SelectJson("metadata")
+ @Path("/servers/{id}/metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyMapOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ ListenableFuture<? extends Map<String, String>> updateMetadata(@PathParam("id") String id,
+ @PayloadParam("metadata") Map<String, String> metadata);
+
+ /**
+ * @see ServerApi#getMetadata
+ */
+ @Named("server:getmetadata")
+ @GET
+ @Path("/servers/{id}/metadata/{key}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @ResponseParser(OnlyMetadataValueOrNull.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<String> getMetadata(@PathParam("id") String id, @PathParam("key") String key);
+
+ /**
+ * @see ServerApi#updateMetadata
+ */
+ @Named("server:updatemetadata")
+ @PUT
+ @Path("/servers/{id}/metadata/{key}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ResponseParser(OnlyMetadataValueOrNull.class)
+ @MapBinder(BindMetadataToJsonPayload.class)
+ ListenableFuture<String> updateMetadata(@PathParam("id") String id,
+ @PathParam("key") @PayloadParam("key") String key, @PathParam("value") @PayloadParam("value") String value);
+
+ /**
+ * @see ServerApi#deleteMetadata
+ */
+ @Named("server:deletemetadata")
+ @DELETE
+ @Consumes
+ @Path("/servers/{id}/metadata/{key}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ ListenableFuture<Void> deleteMetadata(@PathParam("id") String id, @PathParam("key") String key);
+
+
+ /**
+ * @see ServerApi#getDiagnostics
+ */
+ @Named("server:getdiagnostics")
+ @GET
+ @Path("/servers/{id}/diagnostics")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(AbsentOn403Or404Or500.class)
+ @ResponseParser(ParseDiagnostics.class)
+ ListenableFuture<Optional<Map<String, String>>> getDiagnostics(@PathParam("id") String id);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/FieldValueResponseParsers.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/FieldValueResponseParsers.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/FieldValueResponseParsers.java
new file mode 100644
index 0000000..f137c59
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/FieldValueResponseParsers.java
@@ -0,0 +1,105 @@
+/*
+ * 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.openstack.nova.v2_0.functions;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseFirstJsonValueNamed;
+import org.jclouds.json.internal.GsonWrapper;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Parsers for extracting a single field value from a response and comparing it to an expected value
+ */
+public class FieldValueResponseParsers {
+ @Singleton
+ public static class StatusEnabledResponseParser extends FieldValueResponseParser<String> {
+ @Inject
+ public StatusEnabledResponseParser(GsonWrapper wrapper) {
+ super(wrapper, "status", "enabled");
+ }
+ }
+
+ @Singleton
+ public static class StatusDisabledResponseParser extends FieldValueResponseParser<String> {
+ @Inject
+ public StatusDisabledResponseParser(GsonWrapper wrapper) {
+ super(wrapper, "status", "disabled");
+ }
+ }
+
+ @Singleton
+ public static class MaintenanceModeEnabledResponseParser extends FieldValueResponseParser<String> {
+ @Inject
+ public MaintenanceModeEnabledResponseParser(GsonWrapper wrapper) {
+ super(wrapper, "maintenance_mode", "on_maintenance");
+ }
+ }
+
+ @Singleton
+ public static class MaintenanceModeDisabledResponseParser extends FieldValueResponseParser<String> {
+ @Inject
+ public MaintenanceModeDisabledResponseParser(GsonWrapper wrapper) {
+ super(wrapper, "maintenance_mode", "off_maintenance");
+ }
+ }
+
+ @Singleton
+ public static class PowerIsStartupResponseParser extends FieldValueResponseParser<String> {
+ @Inject
+ public PowerIsStartupResponseParser(GsonWrapper wrapper) {
+ super(wrapper, "power_action", "startup");
+ }
+ }
+
+ @Singleton
+ public static class PowerIsShutdownResponseParser extends FieldValueResponseParser<String> {
+ @Inject
+ public PowerIsShutdownResponseParser(GsonWrapper wrapper) {
+ super(wrapper, "power_action", "shutdown");
+ }
+ }
+
+ @Singleton
+ public static class PowerIsRebootResponseParser extends FieldValueResponseParser<String> {
+ @Inject
+ public PowerIsRebootResponseParser(GsonWrapper wrapper) {
+ super(wrapper, "power_action", "reboot");
+ }
+ }
+
+ public abstract static class FieldValueResponseParser<T> implements Function<HttpResponse, Boolean> {
+ private final T expectedValue;
+ private final ParseFirstJsonValueNamed<T> valueParser;
+
+ public FieldValueResponseParser(GsonWrapper wrapper, String fieldName, T expectedValue) {
+ valueParser = new ParseFirstJsonValueNamed<T>(wrapper, new TypeLiteral<T>() {
+ }, fieldName);
+ this.expectedValue = expectedValue;
+ }
+
+ @Override
+ public Boolean apply(HttpResponse response) {
+ return Objects.equal(expectedValue, valueParser.apply(response));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/OverLimitParser.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/OverLimitParser.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/OverLimitParser.java
new file mode 100644
index 0000000..9627ece
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/OverLimitParser.java
@@ -0,0 +1,92 @@
+/*
+ * 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.openstack.nova.v2_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+
+import org.jclouds.json.Json;
+import org.jclouds.logging.Logger;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ *
+ * The expected body contains the time as in this (real) response
+ *
+ * <pre>
+ * {
+ * "overLimit" : {
+ * "code" : 413,
+ * "message" : "OverLimit Retry...",
+ * "details" : "Error Details...",
+ * "retryAt" : "2012-11-14T21:51:28UTC"
+ * }
+ * }
+ * </pre>
+ *
+ * or
+ *
+ * <pre>
+ * {
+ * "overLimit": {
+ * "message": "This request was rate-limited.",
+ * "code": 413,
+ * "retryAfter": "54",
+ * "details": "Only 1 POST request(s) can be made to \"*\" every minute."
+ * }
+ * }
+ * </pre>
+ *
+ * @author Adrian Cole, Steve Loughran
+ *
+ */
+public class OverLimitParser implements Function<String, Map<String, String>> {
+
+ @Resource
+ private Logger logger = Logger.NULL;
+ private final Json json;
+
+ @Inject
+ public OverLimitParser(Json json) {
+ this.json = checkNotNull(json, "json");
+ }
+
+ private static class Holder {
+ Map<String, String> overLimit = ImmutableMap.of();
+ }
+
+ /**
+ * parses or returns an empty map.
+ */
+ @Override
+ public Map<String, String> apply(String in) {
+ try {
+ return json.fromJson(in, OverLimitParser.Holder.class).overLimit;
+ } catch (RuntimeException e) {
+ // an error was raised during parsing -which can include badly
+ // formatted fields.
+ logger.error("Failed to parse " + in + "", e);
+ return ImmutableMap.of();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/ParseImageIdFromLocationHeader.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/ParseImageIdFromLocationHeader.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/ParseImageIdFromLocationHeader.java
new file mode 100644
index 0000000..1ca6f68
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/ParseImageIdFromLocationHeader.java
@@ -0,0 +1,39 @@
+/*
+ * 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.openstack.nova.v2_0.functions;
+
+import javax.inject.Singleton;
+import javax.ws.rs.core.HttpHeaders;
+
+import org.jclouds.http.HttpResponse;
+
+import com.google.common.base.Function;
+
+/**
+ * This parses {@link Image} from the body of the link in the Location header of the HTTPResponse.
+ *
+ * @author Tim Miller
+ */
+@Singleton
+public class ParseImageIdFromLocationHeader implements Function<HttpResponse, String> {
+
+ public String apply(HttpResponse response) {
+ String location = response.getFirstHeaderOrNull(HttpHeaders.LOCATION);
+ String[] parts = location.split("/");
+ return parts[parts.length - 1];
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/OnlyMetadataValueOrNull.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/OnlyMetadataValueOrNull.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/OnlyMetadataValueOrNull.java
new file mode 100644
index 0000000..8183f84
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/OnlyMetadataValueOrNull.java
@@ -0,0 +1,63 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.internal.GsonWrapper;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OnlyMetadataValueOrNull implements Function<HttpResponse, String> {
+ private final ParseJson<Wrapper> parser;
+
+ private static class Wrapper implements Supplier<String> {
+ private Map<String, String> metadata;
+
+ @Override
+ public String get() {
+ return metadata == null ? null : Iterables.get(metadata.values(), 0, null);
+ }
+
+ }
+
+ @Inject
+ public OnlyMetadataValueOrNull(GsonWrapper gsonView) {
+ this.parser = new ParseJson<Wrapper>(checkNotNull(gsonView, "gsonView"), new TypeLiteral<Wrapper>() {
+ });
+ }
+
+ public String apply(HttpResponse response) {
+ checkNotNull(response, "response");
+ return parser.apply(response).get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseDiagnostics.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseDiagnostics.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseDiagnostics.java
new file mode 100644
index 0000000..366aa4c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseDiagnostics.java
@@ -0,0 +1,47 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseJson;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import java.util.Map;
+
+/**
+ * @author Leander Beernaert
+ */
+public class ParseDiagnostics implements Function<HttpResponse, Optional <Map<String,String>>> {
+
+
+ private final ParseJson<Optional <Map<String,String>>> parser;
+
+ @Inject
+ public ParseDiagnostics(ParseJson<Optional <Map<String,String>>> parser) {
+ this.parser = parser;
+ }
+
+ @Override
+ public Optional <Map<String,String>> apply(HttpResponse response) {
+ checkNotNull(response, "response");
+ return parser.apply(response);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavorDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavorDetails.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavorDetails.java
new file mode 100644
index 0000000..7e15016
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavorDetails.java
@@ -0,0 +1,94 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Optional;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseFlavorDetails.Flavors;
+import org.jclouds.openstack.v2_0.domain.Link;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * boiler plate until we determine a better way
+ *
+ * @author Adrian Cole
+ */
+@Beta
+@Singleton
+public class ParseFlavorDetails extends ParseJson<Flavors> {
+ static class Flavors extends PaginatedCollection<Flavor> {
+
+ @ConstructorProperties({ "flavors", "flavors_links" })
+ protected Flavors(Iterable<Flavor> flavors, Iterable<Link> flavors_links) {
+ super(flavors, flavors_links);
+ }
+
+ }
+
+ @Inject
+ public ParseFlavorDetails(Json json) {
+ super(json, TypeLiteral.get(Flavors.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Flavor, ToPagedIterable> {
+
+ private final NovaApi api;
+
+ @Inject
+ protected ToPagedIterable(NovaApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Flavor>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.get().toString();
+ final FlavorApi flavorApi = api.getFlavorApiForZone(zone);
+ return new Function<Object, IterableWithMarker<Flavor>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<Flavor> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return IterableWithMarker.class.cast(flavorApi.listInDetail(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "listFlavorsInDetail()";
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavors.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavors.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavors.java
new file mode 100644
index 0000000..5d183f4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavors.java
@@ -0,0 +1,96 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Optional;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseFlavors.Flavors;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * boiler plate until we determine a better way
+ *
+ * @author Adrian Cole
+ */
+@Beta
+@Singleton
+public class ParseFlavors extends ParseJson<Flavors> {
+ static class Flavors extends PaginatedCollection<Resource> {
+
+ @ConstructorProperties({ "flavors", "flavors_links" })
+ protected Flavors(Iterable<Resource> flavors, Iterable<Link> flavors_links) {
+ super(flavors, flavors_links);
+ }
+
+ }
+
+ @Inject
+ public ParseFlavors(Json json) {
+ super(json, TypeLiteral.get(Flavors.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Resource, ToPagedIterable> {
+
+ private final NovaApi api;
+
+ @Inject
+ protected ToPagedIterable(NovaApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.get().toString();
+ final FlavorApi flavorApi = api.getFlavorApiForZone(zone);
+ return new Function<Object, IterableWithMarker<Resource>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<Resource> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return IterableWithMarker.class.cast(flavorApi.list(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "listFlavors()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImageDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImageDetails.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImageDetails.java
new file mode 100644
index 0000000..c69103a
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImageDetails.java
@@ -0,0 +1,95 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Optional;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.features.ImageApi;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseImageDetails.Images;
+import org.jclouds.openstack.v2_0.domain.Link;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * boiler plate until we determine a better way
+ *
+ * @author Adrian Cole
+ */
+@Beta
+@Singleton
+public class ParseImageDetails extends ParseJson<Images> {
+ static class Images extends PaginatedCollection<Image> {
+
+ @ConstructorProperties({ "images", "images_links" })
+ protected Images(Iterable<Image> images, Iterable<Link> images_links) {
+ super(images, images_links);
+ }
+
+ }
+
+ @Inject
+ public ParseImageDetails(Json json) {
+ super(json, TypeLiteral.get(Images.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Image, ToPagedIterable> {
+
+ private final NovaApi api;
+
+ @Inject
+ protected ToPagedIterable(NovaApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Image>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.get().toString();
+ final ImageApi imageApi = api.getImageApiForZone(zone);
+ return new Function<Object, IterableWithMarker<Image>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<Image> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return IterableWithMarker.class.cast(imageApi.listInDetail(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "listInDetail()";
+ }
+ };
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImages.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImages.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImages.java
new file mode 100644
index 0000000..a939134
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImages.java
@@ -0,0 +1,96 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Optional;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.features.ImageApi;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseImages.Images;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * boiler plate until we determine a better way
+ *
+ * @author Adrian Cole
+ */
+@Beta
+@Singleton
+public class ParseImages extends ParseJson<Images> {
+ static class Images extends PaginatedCollection<Resource> {
+
+ @ConstructorProperties({ "images", "images_links" })
+ protected Images(Iterable<Resource> images, Iterable<Link> images_links) {
+ super(images, images_links);
+ }
+
+ }
+
+ @Inject
+ public ParseImages(Json json) {
+ super(json, TypeLiteral.get(Images.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Resource, ToPagedIterable> {
+
+ private final NovaApi api;
+
+ @Inject
+ protected ToPagedIterable(NovaApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.get().toString();
+ final ImageApi imageApi = api.getImageApiForZone(zone);
+ return new Function<Object, IterableWithMarker<Resource>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<Resource> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return IterableWithMarker.class.cast(imageApi.list(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "list()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseKeyPairs.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseKeyPairs.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseKeyPairs.java
new file mode 100644
index 0000000..96566ff
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseKeyPairs.java
@@ -0,0 +1,64 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseFirstJsonValueNamed;
+import org.jclouds.json.internal.GsonWrapper;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.FluentIterable;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class ParseKeyPairs implements Function<HttpResponse, FluentIterable<? extends KeyPair>> {
+ private final ParseFirstJsonValueNamed<FluentIterable<Wrapper>> parser;
+
+ private static class Wrapper implements Supplier<KeyPair> {
+ private KeyPair keypair;
+
+ @Override
+ public KeyPair get() {
+ return keypair;
+ }
+
+ }
+
+ @Inject
+ public ParseKeyPairs(GsonWrapper gsonView) {
+ this.parser = new ParseFirstJsonValueNamed<FluentIterable<Wrapper>>(checkNotNull(gsonView, "gsonView"),
+ new TypeLiteral<FluentIterable<Wrapper>>() {
+ }, "keypairs");
+ }
+
+ public FluentIterable<? extends KeyPair> apply(HttpResponse response) {
+ checkNotNull(response, "response");
+ return parser.apply(response).transform(Suppliers.<KeyPair> supplierFunction());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
new file mode 100644
index 0000000..4af2cea
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
@@ -0,0 +1,94 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Optional;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServerDetails.Servers;
+import org.jclouds.openstack.v2_0.domain.Link;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * boiler plate until we determine a better way
+ *
+ * @author Adrian Cole
+ */
+@Beta
+@Singleton
+public class ParseServerDetails extends ParseJson<Servers> {
+ static class Servers extends PaginatedCollection<Server> {
+
+ @ConstructorProperties({ "servers", "servers_links" })
+ protected Servers(Iterable<Server> servers, Iterable<Link> servers_links) {
+ super(servers, servers_links);
+ }
+
+ }
+
+ @Inject
+ public ParseServerDetails(Json json) {
+ super(json, TypeLiteral.get(Servers.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Server, ToPagedIterable> {
+
+ private final NovaApi api;
+
+ @Inject
+ protected ToPagedIterable(NovaApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Server>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.get().toString();
+ final ServerApi serverApi = api.getServerApiForZone(zone);
+ return new Function<Object, IterableWithMarker<Server>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<Server> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return IterableWithMarker.class.cast(serverApi.listInDetail(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "listInDetail()";
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
new file mode 100644
index 0000000..2de8c76
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
@@ -0,0 +1,96 @@
+/*
+ * 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.openstack.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Optional;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServers.Servers;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * boiler plate until we determine a better way
+ *
+ * @author Adrian Cole
+ */
+@Beta
+@Singleton
+public class ParseServers extends ParseJson<Servers> {
+ static class Servers extends PaginatedCollection<Resource> {
+
+ @ConstructorProperties({ "servers", "servers_links" })
+ protected Servers(Iterable<Resource> servers, Iterable<Link> servers_links) {
+ super(servers, servers_links);
+ }
+
+ }
+
+ @Inject
+ public ParseServers(Json json) {
+ super(json, TypeLiteral.get(Servers.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Resource, ToPagedIterable> {
+
+ private final NovaApi api;
+
+ @Inject
+ protected ToPagedIterable(NovaApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.get().toString();
+ final ServerApi serverApi = api.getServerApiForZone(zone);
+ return new Function<Object, IterableWithMarker<Resource>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<Resource> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return IterableWithMarker.class.cast(serverApi.list(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "list()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
new file mode 100644
index 0000000..4bfb51b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
@@ -0,0 +1,129 @@
+/*
+ * 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.openstack.nova.v2_0.handlers;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Predicates.in;
+import static com.google.common.base.Strings.emptyToNull;
+import static com.google.common.collect.Maps.filterKeys;
+import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
+
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.date.DateCodecFactory;
+import org.jclouds.fallbacks.HeaderToRetryAfterException;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.functions.OverLimitParser;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.InsufficientResourcesException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.rest.RetryAfterException;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Ticker;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * This will parse and set an appropriate exception on the command object.
+ *
+ * @author Adrian Cole, Steve Loughran
+ *
+ */
+// TODO: is there error spec someplace? let's type errors, etc.
+@Singleton
+public class NovaErrorHandler implements HttpErrorHandler {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+ protected final HeaderToRetryAfterException retryAfterParser;
+ protected final OverLimitParser overLimitParser;
+
+ protected NovaErrorHandler(HeaderToRetryAfterException retryAfterParser, OverLimitParser overLimitParser) {
+ this.retryAfterParser = checkNotNull(retryAfterParser, "retryAfterParser");
+ this.overLimitParser = checkNotNull(overLimitParser, "overLimitParser");
+ }
+
+ /**
+ * in current format, retryAt has a value of {@code 2012-11-14T21:51:28UTC}, which is an ISO-8601 seconds (not milliseconds) format.
+ */
+ @Inject
+ public NovaErrorHandler(DateCodecFactory factory, OverLimitParser overLimitParser) {
+ this(HeaderToRetryAfterException.create(Ticker.systemTicker(), factory.iso8601Seconds()), overLimitParser);
+ }
+
+ public void handleError(HttpCommand command, HttpResponse response) {
+ // it is important to always read fully and close streams
+ byte[] data = closeClientButKeepContentStream(response);
+ String content = data != null ? emptyToNull(new String(data)) : null;
+
+ Exception exception = content != null ? new HttpResponseException(command, response, content)
+ : new HttpResponseException(command, response);
+ String requestLine = command.getCurrentRequest().getRequestLine();
+ String message = content != null ? content : String.format("%s -> %s", requestLine, response.getStatusLine());
+ switch (response.getStatusCode()) {
+ case 400:
+ if (message.indexOf("quota exceeded") != -1)
+ exception = new InsufficientResourcesException(message, exception);
+ else if (message.indexOf("has no fixed_ips") != -1)
+ exception = new IllegalStateException(message, exception);
+ else if (message.indexOf("already exists") != -1)
+ exception = new IllegalStateException(message, exception);
+ break;
+ case 401:
+ case 403:
+ exception = new AuthorizationException(message, exception);
+ break;
+ case 404:
+ if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
+ exception = new ResourceNotFoundException(message, exception);
+ }
+ break;
+ case 413:
+ if (content == null) {
+ exception = new InsufficientResourcesException(message, exception);
+ break;
+ }
+ exception = parseAndBuildRetryException(content, message, exception);
+ }
+ command.setException(exception);
+ }
+
+ /**
+ * Build an exception from the response. If it contains the JSON payload then
+ * that is parsed to create a {@link RetryAfterException}, otherwise a
+ * {@link InsufficientResourcesException} is returned
+ *
+ */
+ private Exception parseAndBuildRetryException(String json, String message, Exception exception) {
+ Set<String> retryFields = ImmutableSet.of("retryAfter", "retryAt");
+ for (String value : filterKeys(overLimitParser.apply(json), in(retryFields)).values()) {
+ Optional<RetryAfterException> retryException = retryAfterParser.tryCreateRetryAfterException(exception, value);
+ if (retryException.isPresent())
+ return retryException.get();
+ }
+ return new InsufficientResourcesException(message, exception);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
new file mode 100644
index 0000000..e6002e5
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
@@ -0,0 +1,105 @@
+/*
+ * 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.openstack.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adam Lowe
+ */
+public class CreateBackupOfServerOptions implements MapBinder {
+ public static final CreateBackupOfServerOptions NONE = new CreateBackupOfServerOptions();
+
+ @Inject
+ protected BindToJsonPayload jsonBinder;
+
+ private Map<String, String> metadata = ImmutableMap.of();
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Map<String, Object> data = Maps.newHashMap();
+ data.putAll(postParams);
+ data.put("metadata", metadata);
+ return jsonBinder.bindToRequest(request, ImmutableMap.of("createBackup", data));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+ throw new IllegalStateException("createBackup is a POST operation");
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (!(object instanceof CreateBackupOfServerOptions)) return false;
+ final CreateBackupOfServerOptions other = CreateBackupOfServerOptions.class.cast(object);
+ return equal(metadata, other.metadata);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(metadata);
+ }
+
+ protected ToStringHelper string() {
+ return toStringHelper("").add("metadata", metadata);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ /** @see #getMetadata() */
+ public CreateBackupOfServerOptions metadata(Map<String, String> metadata) {
+ this.metadata = metadata;
+ return this;
+ }
+
+ /**
+ * Extra image properties to include
+ */
+ public Map<String, String> getMetadata() {
+ return metadata;
+ }
+
+ public static class Builder {
+ /**
+ * @see CreateBackupOfServerOptions#getMetadata()
+ */
+ public static CreateBackupOfServerOptions metadata(Map<String, String> metadata) {
+ return new CreateBackupOfServerOptions().metadata(metadata);
+ }
+ }
+
+}
[49/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java
new file mode 100644
index 0000000..8b36fc9
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java
@@ -0,0 +1,373 @@
+/*
+ * 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.openstack.nova.v2_0.compute.extensions;
+
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.notNull;
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.nameIn;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleCidr;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleEndPort;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleGroup;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleProtocol;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleStartPort;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.Constants;
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.compute.extensions.SecurityGroupExtension;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.domain.Location;
+import org.jclouds.location.Zone;
+import org.jclouds.net.domain.IpPermission;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Ingress;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Supplier;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Multimap;
+import com.google.common.util.concurrent.ListeningExecutorService;
+
+/**
+ * An extension to compute service to allow for the manipulation of {@link org.jclouds.compute.domain.SecurityGroup}s. Implementation
+ * is optional by providers.
+ *
+ * @author Andrew Bayer
+ */
+public class NovaSecurityGroupExtension implements SecurityGroupExtension {
+
+ protected final NovaApi api;
+ protected final ListeningExecutorService userExecutor;
+ protected final Supplier<Set<String>> zoneIds;
+ protected final Function<SecurityGroupInZone, SecurityGroup> groupConverter;
+ protected final LoadingCache<ZoneAndName, SecurityGroupInZone> groupCreator;
+ protected final GroupNamingConvention.Factory namingConvention;
+
+ @Inject
+ public NovaSecurityGroupExtension(NovaApi api,
+ @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
+ @Zone Supplier<Set<String>> zoneIds,
+ Function<SecurityGroupInZone, SecurityGroup> groupConverter,
+ LoadingCache<ZoneAndName, SecurityGroupInZone> groupCreator,
+ GroupNamingConvention.Factory namingConvention) {
+
+ this.api = checkNotNull(api, "api");
+ this.userExecutor = checkNotNull(userExecutor, "userExecutor");
+ this.zoneIds = checkNotNull(zoneIds, "zoneIds");
+ this.groupConverter = checkNotNull(groupConverter, "groupConverter");
+ this.groupCreator = checkNotNull(groupCreator, "groupCreator");
+ this.namingConvention = checkNotNull(namingConvention, "namingConvention");
+ }
+
+ @Override
+ public Set<SecurityGroup> listSecurityGroups() {
+ Iterable<? extends SecurityGroupInZone> rawGroups = pollSecurityGroups();
+ Iterable<SecurityGroup> groups = transform(filter(rawGroups, notNull()),
+ groupConverter);
+ return ImmutableSet.copyOf(groups);
+ }
+
+
+ @Override
+ public Set<SecurityGroup> listSecurityGroupsInLocation(final Location location) {
+ String zone = location.getId();
+ if (zone == null) {
+ return ImmutableSet.of();
+ }
+ return listSecurityGroupsInLocation(zone);
+ }
+
+ public Set<SecurityGroup> listSecurityGroupsInLocation(String zone) {
+ Iterable<? extends SecurityGroupInZone> rawGroups = pollSecurityGroupsByZone(zone);
+ Iterable<SecurityGroup> groups = transform(filter(rawGroups, notNull()),
+ groupConverter);
+ return ImmutableSet.copyOf(groups);
+ }
+
+ @Override
+ public Set<SecurityGroup> listSecurityGroupsForNode(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(checkNotNull(id, "id"));
+ String zone = zoneAndId.getZone();
+ String instanceId = zoneAndId.getId();
+
+ Optional<? extends ServerWithSecurityGroupsApi> serverApi = api.getServerWithSecurityGroupsExtensionForZone(zone);
+ Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
+
+ if (!serverApi.isPresent() || !sgApi.isPresent()) {
+ return ImmutableSet.of();
+ }
+
+ ServerWithSecurityGroups instance = serverApi.get().get(instanceId);
+ if (instance == null) {
+ return ImmutableSet.of();
+ }
+
+ Set<String> groupNames = instance.getSecurityGroupNames();
+ Set<? extends SecurityGroupInZone> rawGroups =
+ sgApi.get().list().filter(nameIn(groupNames)).transform(groupToGroupInZone(zone)).toSet();
+
+ return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
+ }
+
+ @Override
+ public SecurityGroup getSecurityGroupById(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(checkNotNull(id, "id"));
+ String zone = zoneAndId.getZone();
+ String groupId = zoneAndId.getId();
+
+ Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
+
+ if (!sgApi.isPresent()) {
+ return null;
+ }
+
+ SecurityGroupInZone rawGroup = new SecurityGroupInZone(sgApi.get().get(groupId), zone);
+
+ return groupConverter.apply(rawGroup);
+ }
+
+ @Override
+ public SecurityGroup createSecurityGroup(String name, Location location) {
+ String zone = location.getId();
+ if (zone == null) {
+ return null;
+ }
+ return createSecurityGroup(name, zone);
+ }
+
+ public SecurityGroup createSecurityGroup(String name, String zone) {
+ String markerGroup = namingConvention.create().sharedNameForGroup(name);
+ ZoneSecurityGroupNameAndPorts zoneAndName = new ZoneSecurityGroupNameAndPorts(zone, markerGroup, ImmutableSet.<Integer> of());
+
+ SecurityGroupInZone rawGroup = groupCreator.apply(zoneAndName);
+ return groupConverter.apply(rawGroup);
+ }
+
+ @Override
+ public boolean removeSecurityGroup(String id) {
+ checkNotNull(id, "id");
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ String zone = zoneAndId.getZone();
+ String groupId = zoneAndId.getId();
+
+ Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
+
+ if (!sgApi.isPresent()) {
+ return false;
+ }
+
+ if (sgApi.get().get(groupId) == null) {
+ return false;
+ }
+
+ sgApi.get().delete(groupId);
+ // TODO: test this clear happens
+ groupCreator.invalidate(new ZoneSecurityGroupNameAndPorts(zone, groupId, ImmutableSet.<Integer> of()));
+ return true;
+ }
+
+ @Override
+ public SecurityGroup addIpPermission(IpPermission ipPermission, SecurityGroup group) {
+ String zone = group.getLocation().getId();
+ ZoneAndId groupZoneAndId = ZoneAndId.fromSlashEncoded(group.getId());
+ String id = groupZoneAndId.getId();
+ Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
+
+ if (!sgApi.isPresent()) {
+ return null;
+ }
+
+ if (ipPermission.getCidrBlocks().size() > 0) {
+ for (String cidr : ipPermission.getCidrBlocks()) {
+ sgApi.get().createRuleAllowingCidrBlock(id,
+ Ingress.builder()
+ .ipProtocol(ipPermission.getIpProtocol())
+ .fromPort(ipPermission.getFromPort())
+ .toPort(ipPermission.getToPort())
+ .build(),
+ cidr);
+ }
+ }
+
+ if (ipPermission.getGroupIds().size() > 0) {
+ for (String zoneAndGroupRaw : ipPermission.getGroupIds()) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(zoneAndGroupRaw);
+ String groupId = zoneAndId.getId();
+ sgApi.get().createRuleAllowingSecurityGroupId(id,
+ Ingress.builder()
+ .ipProtocol(ipPermission.getIpProtocol())
+ .fromPort(ipPermission.getFromPort())
+ .toPort(ipPermission.getToPort())
+ .build(),
+ groupId);
+ }
+ }
+
+ return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode());
+ }
+
+ @Override
+ public SecurityGroup addIpPermission(IpProtocol protocol, int startPort, int endPort,
+ Multimap<String, String> tenantIdGroupNamePairs,
+ Iterable<String> ipRanges,
+ Iterable<String> groupIds, SecurityGroup group) {
+ IpPermission.Builder permBuilder = IpPermission.builder();
+ permBuilder.ipProtocol(protocol);
+ permBuilder.fromPort(startPort);
+ permBuilder.toPort(endPort);
+ permBuilder.tenantIdGroupNamePairs(tenantIdGroupNamePairs);
+ permBuilder.cidrBlocks(ipRanges);
+ permBuilder.groupIds(groupIds);
+
+ return addIpPermission(permBuilder.build(), group);
+ }
+
+ @Override
+ public SecurityGroup removeIpPermission(IpPermission ipPermission, SecurityGroup group) {
+ String zone = group.getLocation().getId();
+ ZoneAndId groupZoneAndId = ZoneAndId.fromSlashEncoded(group.getId());
+ String id = groupZoneAndId.getId();
+
+ Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
+
+ if (!sgApi.isPresent()) {
+ return null;
+ }
+
+ org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroup = sgApi.get().get(id);
+
+ if (ipPermission.getCidrBlocks().size() > 0) {
+ for (String cidr : ipPermission.getCidrBlocks()) {
+ for (SecurityGroupRule rule : filter(securityGroup.getRules(),
+ and(ruleCidr(cidr), ruleProtocol(ipPermission.getIpProtocol()),
+ ruleStartPort(ipPermission.getFromPort()),
+ ruleEndPort(ipPermission.getToPort())))) {
+ sgApi.get().deleteRule(rule.getId());
+ }
+ }
+ }
+
+ if (ipPermission.getGroupIds().size() > 0) {
+ for (String groupId : ipPermission.getGroupIds()) {
+ for (SecurityGroupRule rule : filter(securityGroup.getRules(),
+ and(ruleGroup(groupId), ruleProtocol(ipPermission.getIpProtocol()),
+ ruleStartPort(ipPermission.getFromPort()),
+ ruleEndPort(ipPermission.getToPort())))) {
+ sgApi.get().deleteRule(rule.getId());
+ }
+
+ }
+ }
+
+ return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode());
+ }
+
+ @Override
+ public SecurityGroup removeIpPermission(IpProtocol protocol, int startPort, int endPort,
+ Multimap<String, String> tenantIdGroupNamePairs,
+ Iterable<String> ipRanges,
+ Iterable<String> groupIds, SecurityGroup group) {
+ IpPermission.Builder permBuilder = IpPermission.builder();
+ permBuilder.ipProtocol(protocol);
+ permBuilder.fromPort(startPort);
+ permBuilder.toPort(endPort);
+ permBuilder.tenantIdGroupNamePairs(tenantIdGroupNamePairs);
+ permBuilder.cidrBlocks(ipRanges);
+ permBuilder.groupIds(groupIds);
+
+ return removeIpPermission(permBuilder.build(), group);
+ }
+
+ @Override
+ public boolean supportsTenantIdGroupNamePairs() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsTenantIdGroupIdPairs() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsGroupIds() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsPortRangesForGroups() {
+ return false;
+ }
+
+ protected Iterable<? extends SecurityGroupInZone> pollSecurityGroups() {
+ Iterable<? extends Set<? extends SecurityGroupInZone>> groups
+ = transform(zoneIds.get(), allSecurityGroupsInZone());
+
+ return concat(groups);
+ }
+
+
+ protected Iterable<? extends SecurityGroupInZone> pollSecurityGroupsByZone(String zone) {
+ return allSecurityGroupsInZone().apply(zone);
+ }
+
+ protected Function<String, Set<? extends SecurityGroupInZone>> allSecurityGroupsInZone() {
+ return new Function<String, Set<? extends SecurityGroupInZone>>() {
+
+ @Override
+ public Set<? extends SecurityGroupInZone> apply(final String from) {
+ Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(from);
+
+ if (!sgApi.isPresent()) {
+ return ImmutableSet.of();
+ }
+
+
+ return sgApi.get().list().transform(groupToGroupInZone(from)).toSet();
+ }
+
+ };
+ }
+
+ protected Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroupInZone> groupToGroupInZone(final String zone) {
+ return new Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroupInZone>() {
+ @Override
+ public SecurityGroupInZone apply(org.jclouds.openstack.nova.v2_0.domain.SecurityGroup group) {
+ return new SecurityGroupInZone(group, zone);
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java
new file mode 100644
index 0000000..f7c18ee
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java
@@ -0,0 +1,112 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.NodeMetadataBuilder;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
+import org.jclouds.rest.InsufficientResourcesException;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Predicate;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * A function for adding and allocating an ip to a node
+ *
+ * @author Adrian Cole
+ */
+public class AllocateAndAddFloatingIpToNode implements
+ Function<AtomicReference<NodeMetadata>, AtomicReference<NodeMetadata>> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ private final Predicate<AtomicReference<NodeMetadata>> nodeRunning;
+ private final NovaApi novaApi;
+ private final LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache;
+
+ @Inject
+ public AllocateAndAddFloatingIpToNode(@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
+ NovaApi novaApi, @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache) {
+ this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
+ }
+
+ @Override
+ public AtomicReference<NodeMetadata> apply(AtomicReference<NodeMetadata> input) {
+ checkState(nodeRunning.apply(input), "node never achieved state running %s", input.get());
+ NodeMetadata node = input.get();
+ // node's location is a host
+ String zoneId = node.getLocation().getParent().getId();
+ FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(zoneId).get();
+
+ FloatingIP ip = null;
+ try {
+ logger.debug(">> allocating or reassigning floating ip for node(%s)", node.getId());
+ ip = floatingIpApi.create();
+ } catch (InsufficientResourcesException e) {
+ logger.trace("<< [%s] allocating a new floating ip for node(%s)", e.getMessage(), node.getId());
+ logger.trace(">> searching for existing, unassigned floating ip for node(%s)", node.getId());
+ ArrayList<FloatingIP> unassignedIps = Lists.newArrayList(Iterables.filter(floatingIpApi.list(),
+ new Predicate<FloatingIP>() {
+
+ @Override
+ public boolean apply(FloatingIP arg0) {
+ return arg0.getFixedIp() == null;
+ }
+
+ }));
+ // try to prevent multiple parallel launches from choosing the same ip.
+ Collections.shuffle(unassignedIps);
+ ip = Iterables.getLast(unassignedIps);
+ }
+ logger.debug(">> adding floatingIp(%s) to node(%s)", ip.getIp(), node.getId());
+
+ floatingIpApi.addToServer(ip.getIp(), node.getProviderId());
+ input.set(NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of(ip.getIp())).build());
+ floatingIpCache.invalidate(ZoneAndId.fromSlashEncoded(node.getId()));
+ return input;
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("AllocateAndAddFloatingIpToNode").toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java
new file mode 100644
index 0000000..6b5d519
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java
@@ -0,0 +1,93 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.find;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.nameEquals;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Ingress;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class CreateSecurityGroupIfNeeded implements Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+ protected final NovaApi novaApi;
+
+ @Inject
+ public CreateSecurityGroupIfNeeded(NovaApi novaApi) {
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ }
+
+ @Override
+ public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts zoneSecurityGroupNameAndPorts) {
+ checkNotNull(zoneSecurityGroupNameAndPorts, "zoneSecurityGroupNameAndPorts");
+
+ String zoneId = zoneSecurityGroupNameAndPorts.getZone();
+ Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(zoneId);
+ checkArgument(api.isPresent(), "Security groups are required, but the extension is not availablein zone %s!", zoneId);
+ logger.debug(">> creating securityGroup %s", zoneSecurityGroupNameAndPorts);
+ try {
+
+ SecurityGroup securityGroup = api.get().createWithDescription(
+ zoneSecurityGroupNameAndPorts.getName(), zoneSecurityGroupNameAndPorts.getName());
+
+ logger.debug("<< created securityGroup(%s)", securityGroup);
+ for (int port : zoneSecurityGroupNameAndPorts.getPorts()) {
+ authorizeGroupToItselfAndAllIPsToTCPPort(api.get(), securityGroup, port);
+ }
+ return new SecurityGroupInZone(api.get().get(securityGroup.getId()), zoneId);
+ } catch (IllegalStateException e) {
+ logger.trace("<< trying to find securityGroup(%s): %s", zoneSecurityGroupNameAndPorts, e.getMessage());
+ SecurityGroup group = find(api.get().list(), nameEquals(zoneSecurityGroupNameAndPorts
+ .getName()));
+ logger.debug("<< reused securityGroup(%s)", group.getId());
+ return new SecurityGroupInZone(group, zoneId);
+ }
+ }
+
+ private void authorizeGroupToItselfAndAllIPsToTCPPort(SecurityGroupApi securityGroupApi,
+ SecurityGroup securityGroup, int port) {
+ logger.debug(">> authorizing securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port);
+ securityGroupApi.createRuleAllowingCidrBlock(securityGroup.getId(), Ingress.builder().ipProtocol(
+ IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0");
+ logger.debug("<< authorized securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardware.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardware.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardware.java
new file mode 100644
index 0000000..160944b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardware.java
@@ -0,0 +1,60 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.HardwareBuilder;
+import org.jclouds.compute.domain.Processor;
+import org.jclouds.compute.domain.internal.VolumeImpl;
+import org.jclouds.domain.Location;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.FlavorInZone;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+/**
+ * A function for transforming the nova specific FlavorInZone object to the generic Hardware object.
+ *
+ * @author Matt Stephenson
+ */
+public class FlavorInZoneToHardware implements Function<FlavorInZone, Hardware> {
+
+ private final Supplier<Map<String, Location>> locationIndex;
+
+ @Inject
+ public FlavorInZoneToHardware(Supplier<Map<String, Location>> locationIndex) {
+ this.locationIndex = checkNotNull(locationIndex, "locationIndex");
+ }
+
+ @Override
+ public Hardware apply(FlavorInZone flavorInZone) {
+ Location location = locationIndex.get().get(flavorInZone.getZone());
+ checkState(location != null, "location %s not in locationIndex: %s", flavorInZone.getZone(), locationIndex.get());
+ Flavor flavor = flavorInZone.getFlavor();
+ return new HardwareBuilder().id(flavorInZone.slashEncode()).providerId(flavor.getId()).name(flavor.getName())
+ .ram(flavor.getRam()).processor(new Processor(flavor.getVcpus(), 1.0)).volume(
+ new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true)).location(location).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImage.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImage.java
new file mode 100644
index 0000000..109da29
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImage.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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.domain.Location;
+import org.jclouds.openstack.nova.v2_0.domain.Image.Status;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Supplier;
+
+/**
+ * A function for transforming a nova-specific Image into a generic Image object.
+ *
+ * @author Matt Stephenson
+ */
+public class ImageInZoneToImage implements Function<ImageInZone, Image> {
+ private final Map<Status, org.jclouds.compute.domain.Image.Status> toPortableImageStatus;
+ private final Function<org.jclouds.openstack.nova.v2_0.domain.Image, OperatingSystem> imageToOs;
+ private final Supplier<Map<String, Location>> locationIndex;
+
+ @Inject
+ public ImageInZoneToImage(Map<org.jclouds.openstack.nova.v2_0.domain.Image.Status, Image.Status> toPortableImageStatus,
+ Function<org.jclouds.openstack.nova.v2_0.domain.Image, OperatingSystem> imageToOs,
+ Supplier<Map<String, Location>> locationIndex) {
+ this.toPortableImageStatus = checkNotNull(toPortableImageStatus, "toPortableImageStatus");
+ this.imageToOs = checkNotNull(imageToOs, "imageToOs");
+ this.locationIndex = checkNotNull(locationIndex, "locationIndex");
+ }
+
+ @Override
+ public Image apply(ImageInZone imageInZone) {
+ Location location = locationIndex.get().get(imageInZone.getZone());
+ checkState(location != null, "location %s not in locationIndex: %s", imageInZone.getZone(), locationIndex.get());
+ org.jclouds.openstack.nova.v2_0.domain.Image image = imageInZone.getImage();
+ return new ImageBuilder().id(imageInZone.slashEncode()).providerId(image.getId()).name(image.getName())
+ .userMetadata(image.getMetadata()).operatingSystem(imageToOs.apply(image)).description(image.getName())
+ .location(location).status(toPortableImageStatus.get(image.getStatus())).build();
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this).toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystem.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystem.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystem.java
new file mode 100644
index 0000000..f26c4e0
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystem.java
@@ -0,0 +1,128 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Predicates.containsPattern;
+import static com.google.common.base.Predicates.equalTo;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.collect.Iterables.any;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.find;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.compute.util.ComputeServiceUtils;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+
+import com.google.common.base.CharMatcher;
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Predicate;
+import com.google.common.base.Splitter;
+
+/**
+ * A function for transforming a nova specific Image into a generic OperatingSystem object.
+ *
+ * @author Matt Stephenson
+ */
+public class ImageToOperatingSystem implements Function<Image, OperatingSystem> {
+ public static final Pattern DEFAULT_PATTERN = Pattern.compile("(([^ ]*) ([0-9.]+) ?.*)");
+ // Windows Server 2008 R2 x64
+ public static final Pattern WINDOWS_PATTERN = Pattern.compile("Windows (.*) (x[86][64])");
+
+ @javax.annotation.Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ private final Map<OsFamily, Map<String, String>> osVersionMap;
+
+ @Inject
+ public ImageToOperatingSystem(Map<OsFamily, Map<String, String>> osVersionMap) {
+ this.osVersionMap = osVersionMap;
+ }
+
+ public OperatingSystem apply(final Image from) {
+ OsFamily osFamily = null;
+ String osVersion = null;
+
+ String imageName = Objects.firstNonNull(from.getName(), "unspecified");
+
+ boolean is64Bit = true;
+
+ if (imageName.indexOf("Windows") != -1) {
+ osFamily = OsFamily.WINDOWS;
+ Matcher matcher = WINDOWS_PATTERN.matcher(from.getName());
+ if (matcher.find()) {
+ osVersion = ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(1), osVersionMap);
+ is64Bit = matcher.group(2).equals("x64");
+ }
+ } else {
+ if (imageName.contains("Red Hat EL")) {
+ osFamily = OsFamily.RHEL;
+ } else if (imageName.contains("Oracle EL")) {
+ osFamily = OsFamily.OEL;
+ } else {
+ final Iterable<String> imageNameParts = Splitter.on(CharMatcher.WHITESPACE).trimResults().split(
+ imageName.toLowerCase());
+
+ try {
+ osFamily = find(Arrays.asList(OsFamily.values()), new Predicate<OsFamily>() {
+ @Override
+ public boolean apply(OsFamily osFamily) {
+ return any(imageNameParts, equalTo(osFamily.name().toLowerCase()));
+ }
+ });
+ } catch (NoSuchElementException e) {
+ String ubuntuVersion = startsWithUbuntuVersion(imageNameParts);
+ if (ubuntuVersion != null) {
+ osFamily = OsFamily.UBUNTU;
+ osVersion = ubuntuVersion;
+ } else {
+ logger.trace("could not parse operating system family for image(%s): %s", from.getId(), imageNameParts);
+ osFamily = OsFamily.UNRECOGNIZED;
+ }
+ }
+ }
+ Matcher matcher = DEFAULT_PATTERN.matcher(imageName);
+ if (matcher.find() && matcher.groupCount() >= 3) {
+ osVersion = ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(3), osVersionMap);
+ }
+ }
+ return new OperatingSystem(osFamily, imageName, osVersion, null, imageName, is64Bit);
+ }
+
+ String startsWithUbuntuVersion(final Iterable<String> imageNameParts) {
+ Map<String, String> ubuntuVersions = osVersionMap.get(OsFamily.UBUNTU);
+ for (String ubuntuKey : filter(ubuntuVersions.keySet(), not(equalTo("")))) {
+ if (any(imageNameParts, containsPattern("^" + ubuntuKey + ".*"))) {
+ return ubuntuVersions.get(ubuntuKey);
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroup.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroup.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroup.java
new file mode 100644
index 0000000..fc772df
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroup.java
@@ -0,0 +1,75 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.compute.domain.SecurityGroupBuilder;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.inject.Inject;
+
+
+/**
+ * A function for transforming a Nova-specific SecurityGroup into a generic
+ * SecurityGroup object.
+ *
+ * @author Andrew Bayer
+ */
+@Singleton
+public class NovaSecurityGroupInZoneToSecurityGroup implements Function<SecurityGroupInZone, SecurityGroup> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected final Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroup> baseConverter;
+ protected final Supplier<Map<String, Location>> locationIndex;
+
+ @Inject
+ public NovaSecurityGroupInZoneToSecurityGroup(Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroup> baseConverter,
+ Supplier<Map<String, Location>> locationIndex) {
+ this.baseConverter = checkNotNull(baseConverter, "baseConverter");
+ this.locationIndex = checkNotNull(locationIndex, "locationIndex");
+ }
+
+ @Override
+ public SecurityGroup apply(SecurityGroupInZone group) {
+ SecurityGroupBuilder builder = SecurityGroupBuilder.fromSecurityGroup(baseConverter.apply(group.getSecurityGroup()));
+
+ Location zone = locationIndex.get().get(group.getZone());
+ checkState(zone != null, "location %s not in locationIndex: %s", group.getZone(), locationIndex.get());
+
+ builder.location(zone);
+
+ builder.id(group.getZone() + "/" + group.getSecurityGroup().getId());
+
+ return builder.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroup.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroup.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroup.java
new file mode 100644
index 0000000..d39f849
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroup.java
@@ -0,0 +1,69 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.compute.domain.SecurityGroupBuilder;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.net.domain.IpPermission;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+
+
+/**
+ * A function for transforming a Nova-specific SecurityGroup into a generic
+ * SecurityGroup object.
+ *
+ * @author Andrew Bayer
+ */
+@Singleton
+public class NovaSecurityGroupToSecurityGroup implements Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroup> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected Function<SecurityGroupRule,IpPermission> ruleToPermission;
+
+ @Inject
+ public NovaSecurityGroupToSecurityGroup(Function<SecurityGroupRule,IpPermission> ruleToPermission) {
+ this.ruleToPermission = ruleToPermission;
+ }
+
+ @Override
+ public SecurityGroup apply(org.jclouds.openstack.nova.v2_0.domain.SecurityGroup group) {
+ SecurityGroupBuilder builder = new SecurityGroupBuilder();
+
+ builder.id(group.getId());
+ builder.providerId(group.getId());
+ builder.ownerId(group.getTenantId());
+ builder.name(group.getName());
+ if (group.getRules() != null) {
+ builder.ipPermissions(transform(group.getRules(), ruleToPermission));
+ }
+
+ return builder.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneId.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneId.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneId.java
new file mode 100644
index 0000000..4993f0c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneId.java
@@ -0,0 +1,77 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+import static com.google.common.collect.Sets.filter;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.predicates.NodePredicates;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.openstack.nova.v2_0.compute.predicates.AllNodesInGroupTerminated;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class OrphanedGroupsByZoneId implements Function<Set<? extends NodeMetadata>, Multimap<String, String>> {
+ private final Predicate<ZoneAndName> allNodesInGroupTerminated;
+
+ @Inject
+ protected OrphanedGroupsByZoneId(ComputeService computeService) {
+ this(new AllNodesInGroupTerminated(checkNotNull(computeService, "computeService")));
+ }
+
+ @VisibleForTesting
+ OrphanedGroupsByZoneId(Predicate<ZoneAndName> allNodesInGroupTerminated) {
+ this.allNodesInGroupTerminated = checkNotNull(allNodesInGroupTerminated, "allNodesInGroupTerminated");
+ }
+
+ public Multimap<String, String> apply(Set<? extends NodeMetadata> deadNodes) {
+ Iterable<? extends NodeMetadata> nodesWithGroup = filter(deadNodes, NodePredicates.hasGroup());
+ Set<ZoneAndName> zoneAndGroupNames = ImmutableSet.copyOf(filter(transform(nodesWithGroup,
+ new Function<NodeMetadata, ZoneAndName>() {
+
+ @Override
+ public ZoneAndName apply(NodeMetadata input) {
+ String zoneId = input.getLocation().getScope() == LocationScope.HOST ? input.getLocation()
+ .getParent().getId() : input.getLocation().getId();
+ return ZoneAndName.fromZoneAndName(zoneId, input.getGroup());
+ }
+
+ }), allNodesInGroupTerminated));
+ Multimap<String, String> zoneToZoneAndGroupNames = Multimaps.transformValues(Multimaps.index(zoneAndGroupNames,
+ ZoneAndName.ZONE_FUNCTION), ZoneAndName.NAME_FUNCTION);
+ return zoneToZoneAndGroupNames;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java
new file mode 100644
index 0000000..269a333
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java
@@ -0,0 +1,74 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.cache.LoadingCache;
+
+/**
+ * A function for removing and deallocating an ip address from a node
+ *
+ * @author Adrian Cole
+ */
+public class RemoveFloatingIpFromNodeAndDeallocate implements Function<ZoneAndId, ZoneAndId> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ private final NovaApi novaApi;
+ private final LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache;
+
+ @Inject
+ public RemoveFloatingIpFromNodeAndDeallocate(NovaApi novaApi,
+ @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache) {
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
+ }
+
+ @Override
+ public ZoneAndId apply(ZoneAndId id) {
+ FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(id.getZone()).get();
+ for (FloatingIP ip : floatingIpCache.getUnchecked(id)) {
+ logger.debug(">> removing floatingIp(%s) from node(%s)", ip, id);
+ floatingIpApi.removeFromServer(ip.getIp(), id.getId());
+ logger.debug(">> deallocating floatingIp(%s)", ip);
+ floatingIpApi.delete(ip.getId());
+ }
+ floatingIpCache.invalidate(id);
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("RemoveFloatingIpFromNodeAndDecreate").toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermission.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermission.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermission.java
new file mode 100644
index 0000000..a98a62b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermission.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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.getFirst;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.net.domain.IpPermission;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.cache.LoadingCache;
+import com.google.common.util.concurrent.Atomics;
+
+
+/**
+ * A function for transforming a nova-specific SecurityGroupRule into a generic
+ * IpPermission object.
+ *
+ * @author Andrew Bayer
+ */
+public class SecurityGroupRuleToIpPermission implements Function<SecurityGroupRule, IpPermission> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+ protected final Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone;
+ protected final Supplier<Map<String, Location>> locationIndex;
+ LoadingCache<ZoneAndName, SecurityGroupInZone> groupMap;
+
+ @Inject
+ public SecurityGroupRuleToIpPermission(@Named("SECURITYGROUP_PRESENT") Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone,
+ Supplier<Map<String, Location>> locationIndex,
+ LoadingCache<ZoneAndName, SecurityGroupInZone> groupMap) {
+ this.returnSecurityGroupExistsInZone = checkNotNull(returnSecurityGroupExistsInZone,
+ "returnSecurityGroupExistsInZone");
+ this.locationIndex = checkNotNull(locationIndex, "locationIndex");
+ this.groupMap = checkNotNull(groupMap, "groupMap");
+ }
+
+ @Override
+ public IpPermission apply(SecurityGroupRule rule) {
+ IpPermission.Builder builder = IpPermission.builder();
+ builder.ipProtocol(rule.getIpProtocol());
+ builder.fromPort(rule.getFromPort());
+ builder.toPort(rule.getToPort());
+ if (rule.getGroup() != null) {
+ String zone = getFirst(filter(locationIndex.get().keySet(), isSecurityGroupInZone(rule.getGroup().getName())),
+ null);
+ if (zone != null) {
+ SecurityGroupInZone group = groupMap.getUnchecked(ZoneAndName.fromZoneAndName(zone, rule.getGroup().getName()));
+ builder.groupId(zone + "/" + group.getSecurityGroup().getId());
+ }
+ }
+ if (rule.getIpRange() != null)
+ builder.cidrBlock(rule.getIpRange());
+
+ return builder.build();
+ }
+
+ protected Predicate<String> isSecurityGroupInZone(final String groupName) {
+ return new Predicate<String>() {
+
+ @Override
+ public boolean apply(String zone) {
+ AtomicReference<ZoneAndName> securityGroupInZoneRef = Atomics.newReference(ZoneAndName.fromZoneAndName(zone, groupName));
+ return returnSecurityGroupExistsInZone.apply(securityGroupInZoneRef);
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadata.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadata.java
new file mode 100644
index 0000000..23035c2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadata.java
@@ -0,0 +1,199 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.find;
+import static com.google.common.collect.Iterables.transform;
+import static com.google.common.collect.Sets.newHashSet;
+import static org.jclouds.compute.util.ComputeServiceUtils.addMetadataAndParseTagsFromCommaDelimitedValue;
+import static org.jclouds.compute.util.ComputeServiceUtils.groupFromMapOrName;
+import static org.jclouds.openstack.nova.v2_0.domain.Address.createV4;
+import static org.jclouds.openstack.nova.v2_0.domain.Address.createV6;
+
+import java.net.Inet4Address;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.domain.ComputeMetadata;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.NodeMetadataBuilder;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.domain.Address;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.util.InetAddresses2;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.net.InetAddresses;
+
+/**
+ * A function for transforming a nova-specific Server into a generic
+ * NodeMetadata object.
+ *
+ * @author Matt Stephenson, Adam Lowe, Adrian Cole
+ */
+public class ServerInZoneToNodeMetadata implements Function<ServerInZone, NodeMetadata> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected Map<Status, org.jclouds.compute.domain.NodeMetadata.Status> toPortableNodeStatus;
+ protected final Supplier<Map<String, Location>> locationIndex;
+ protected final Supplier<Set<? extends Image>> images;
+ protected final Supplier<Set<? extends Hardware>> hardwares;
+ protected final GroupNamingConvention nodeNamingConvention;
+
+ @Inject
+ public ServerInZoneToNodeMetadata(Map<Server.Status, NodeMetadata.Status> toPortableNodeStatus,
+ Supplier<Map<String, Location>> locationIndex, @Memoized Supplier<Set<? extends Image>> images,
+ @Memoized Supplier<Set<? extends Hardware>> hardwares, GroupNamingConvention.Factory namingConvention) {
+ this.toPortableNodeStatus = checkNotNull(toPortableNodeStatus, "toPortableNodeStatus");
+ this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
+ this.locationIndex = checkNotNull(locationIndex, "locationIndex");
+ this.images = checkNotNull(images, "images");
+ this.hardwares = checkNotNull(hardwares, "hardwares");
+ }
+
+ @Override
+ public NodeMetadata apply(ServerInZone serverInZone) {
+ Location zone = locationIndex.get().get(serverInZone.getZone());
+ checkState(zone != null, "location %s not in locationIndex: %s", serverInZone.getZone(), locationIndex.get());
+ Server from = serverInZone.getServer();
+
+ NodeMetadataBuilder builder = new NodeMetadataBuilder();
+ builder.id(serverInZone.slashEncode());
+ builder.providerId(from.getId());
+ builder.name(from.getName());
+ builder.hostname(from.getName());
+ builder.location(from.getHostId() != null ? new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId())
+ .description(from.getHostId()).parent(zone).build() : zone);
+ builder.group(groupFromMapOrName(from.getMetadata(), from.getName(), nodeNamingConvention));
+ addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
+ builder.imageId(ZoneAndId.fromZoneAndId(serverInZone.getZone(), from.getImage().getId()).slashEncode());
+ builder.operatingSystem(findOperatingSystemForServerOrNull(serverInZone));
+ builder.hardware(findHardwareForServerOrNull(serverInZone));
+ builder.status(toPortableNodeStatus.get(from.getStatus()));
+
+ Set<Address> addresses = newHashSet(from.getAddresses().values());
+ if (from.getAccessIPv4() != null) {
+ addresses.add(createV4(from.getAccessIPv4()));
+ }
+ if (from.getAccessIPv6() != null) {
+ addresses.add(createV6(from.getAccessIPv6()));
+ }
+
+ builder.publicAddresses(
+ filter(
+ transform(
+ filter(addresses, not(isPrivateAddress)),
+ AddressToStringTransformationFunction.INSTANCE),
+ isInet4Address));
+
+ builder.privateAddresses(
+ filter(
+ transform(
+ filter(addresses, isPrivateAddress),
+ AddressToStringTransformationFunction.INSTANCE),
+ isInet4Address));
+
+ for (Link link: from.getLinks()) {
+ if (link.getRelation().equals(Link.Relation.SELF)) {
+ builder.uri(link.getHref());
+ }
+ }
+
+ return builder.build();
+ }
+
+ private static final Predicate<Address> isPrivateAddress = new Predicate<Address>() {
+ public boolean apply(Address in) {
+ return InetAddresses2.IsPrivateIPAddress.INSTANCE.apply(in.getAddr());
+ }
+ };
+
+ public static final Predicate<String> isInet4Address = new Predicate<String>() {
+ @Override
+ public boolean apply(String input) {
+ try {
+ // Note we can do this, as InetAddress is now on the white list
+ return InetAddresses.forString(input) instanceof Inet4Address;
+ } catch (IllegalArgumentException e) {
+ // could be a hostname
+ return true;
+ }
+ }
+
+ };
+
+ private enum AddressToStringTransformationFunction implements Function<Address, String> {
+ INSTANCE;
+ @Override
+ public String apply(Address address) {
+ return address.getAddr();
+ }
+ }
+
+ protected Hardware findHardwareForServerOrNull(ServerInZone serverInZone) {
+ return findObjectOfTypeForServerOrNull(hardwares.get(), "hardware", serverInZone.getServer().getFlavor().getId(),
+ serverInZone);
+ }
+
+ protected OperatingSystem findOperatingSystemForServerOrNull(ServerInZone serverInZone) {
+ Image image = findObjectOfTypeForServerOrNull(images.get(), "image", serverInZone.getServer().getImage().getId(),
+ serverInZone);
+ return (image != null) ? image.getOperatingSystem() : null;
+ }
+
+ public <T extends ComputeMetadata> T findObjectOfTypeForServerOrNull(Set<? extends T> supply, String type,
+ final String objectId, final ZoneAndId serverInZone) {
+ try {
+ return find(supply, new Predicate<T>() {
+ @Override
+ public boolean apply(T input) {
+ return input.getId().equals(ZoneAndId.fromZoneAndId(serverInZone.getZone(), objectId).slashEncode());
+ }
+ });
+ } catch (NoSuchElementException e) {
+ logger.trace("could not find %s with id(%s) for server(%s)", type, objectId, serverInZone);
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java
new file mode 100644
index 0000000..18096fe
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java
@@ -0,0 +1,79 @@
+/*
+ * 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.openstack.nova.v2_0.compute.loaders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
+
+import com.google.common.base.Optional;
+import com.google.common.cache.CacheLoader;
+import com.google.inject.Inject;
+
+/**
+ * @author Adam Lowe
+ */
+@Singleton
+public class CreateUniqueKeyPair extends CacheLoader<ZoneAndName, KeyPair> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+ protected final NovaApi novaApi;
+ protected final GroupNamingConvention.Factory namingConvention;
+
+ @Inject
+ public CreateUniqueKeyPair(NovaApi novaApi, GroupNamingConvention.Factory namingConvention) {
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ this.namingConvention = checkNotNull(namingConvention, "namingConvention");
+ }
+
+ @Override
+ public KeyPair load(ZoneAndName zoneAndName) {
+ String zoneId = checkNotNull(zoneAndName, "zoneAndName").getZone();
+ String prefix = zoneAndName.getName();
+
+ Optional<? extends KeyPairApi> api = novaApi.getKeyPairExtensionForZone(zoneId);
+ checkArgument(api.isPresent(), "Key pairs are required, but the extension is not available in zone %s!",
+ zoneId);
+
+ logger.debug(">> creating keyPair zone(%s) prefix(%s)", zoneId, prefix);
+
+ KeyPair keyPair = null;
+ while (keyPair == null) {
+ try {
+ keyPair = api.get().create(namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix));
+ } catch (IllegalStateException e) {
+
+ }
+ }
+
+ logger.debug("<< created keyPair(%s)", keyPair.getName());
+ return keyPair;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreate.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreate.java
new file mode 100644
index 0000000..71951cd
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreate.java
@@ -0,0 +1,86 @@
+/*
+ * 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.openstack.nova.v2_0.compute.loaders;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.cache.CacheLoader;
+import com.google.common.util.concurrent.Atomics;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class FindSecurityGroupOrCreate extends CacheLoader<ZoneAndName, SecurityGroupInZone> {
+
+ protected final Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone;
+ protected final Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator;
+
+ @Inject
+ public FindSecurityGroupOrCreate(
+ @Named("SECURITYGROUP_PRESENT") Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone,
+ Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator) {
+ this.returnSecurityGroupExistsInZone = checkNotNull(returnSecurityGroupExistsInZone,
+ "returnSecurityGroupExistsInZone");
+ this.groupCreator = checkNotNull(groupCreator, "groupCreator");
+ }
+
+ @Override
+ public SecurityGroupInZone load(ZoneAndName in) {
+ AtomicReference<ZoneAndName> securityGroupInZoneRef = Atomics.newReference(checkNotNull(in,
+ "zoneSecurityGroupNameAndPorts"));
+ if (returnSecurityGroupExistsInZone.apply(securityGroupInZoneRef)) {
+ return returnExistingSecurityGroup(securityGroupInZoneRef);
+ } else {
+ return createNewSecurityGroup(in);
+ }
+ }
+
+ private SecurityGroupInZone returnExistingSecurityGroup(AtomicReference<ZoneAndName> securityGroupInZoneRef) {
+ ZoneAndName securityGroupInZone = securityGroupInZoneRef.get();
+ checkState(securityGroupInZone instanceof SecurityGroupInZone,
+ "programming error: predicate %s should update the atomic reference to the actual security group found",
+ returnSecurityGroupExistsInZone);
+ return SecurityGroupInZone.class.cast(securityGroupInZone);
+ }
+
+ private SecurityGroupInZone createNewSecurityGroup(ZoneAndName in) {
+ checkState(
+ checkNotNull(in, "zoneSecurityGroupNameAndPorts") instanceof ZoneSecurityGroupNameAndPorts,
+ "programming error: when issuing get to this cacheloader, you need to pass an instance of ZoneSecurityGroupNameAndPorts, not %s",
+ in);
+ ZoneSecurityGroupNameAndPorts zoneSecurityGroupNameAndPorts = ZoneSecurityGroupNameAndPorts.class.cast(in);
+ return groupCreator.apply(zoneSecurityGroupNameAndPorts);
+ }
+
+ @Override
+ public String toString() {
+ return "returnExistingSecurityGroupInZoneOrCreateAsNeeded()";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java
new file mode 100644
index 0000000..1c0ae8a
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java
@@ -0,0 +1,63 @@
+/*
+ * 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.openstack.nova.v2_0.compute.loaders;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.cache.CacheLoader;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Each zone may or may not have the floating ip function present. In order to safely proceed, we
+ * must allow the user to determine if a zone has floating ip services before attempting to use
+ * them.
+ *
+ * @author Adam Lowe
+ */
+@Singleton
+public class LoadFloatingIpsForInstance extends CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>> {
+ private final NovaApi api;
+
+ @Inject
+ public LoadFloatingIpsForInstance(NovaApi api) {
+ this.api = api;
+ }
+
+ @Override
+ public Iterable<? extends FloatingIP> load(final ZoneAndId key) throws Exception {
+ String zone = key.getZone();
+ Optional<? extends FloatingIPApi> ipApiOptional = api.getFloatingIPExtensionForZone(zone);
+ if (ipApiOptional.isPresent()) {
+ return ipApiOptional.get().list().filter(
+ new Predicate<FloatingIP>() {
+ @Override
+ public boolean apply(FloatingIP input) {
+ return key.getId().equals(input.getInstanceId());
+ }
+ });
+ }
+ return ImmutableSet.of();
+ }
+}
[24/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
new file mode 100755
index 0000000..41c96c2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
@@ -0,0 +1,105 @@
+/*
+ * 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.vcloud.functions;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.http.HttpUtils.releasePayload;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.inject.Inject;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+import javax.ws.rs.core.HttpHeaders;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.vcloud.VCloudToken;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.xml.OrgListHandler;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+
+/**
+ * This parses {@link VCloudSession} from HTTP headers.
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class ParseLoginResponseFromHeaders implements Function<HttpResponse, VCloudSession> {
+ static final Pattern pattern = Pattern.compile("(vcloud-token)=?([^;]+)(;.*)?");
+
+ private final ParseSax.Factory factory;
+ private final Provider<OrgListHandler> orgHandlerProvider;
+
+ @Inject
+ private ParseLoginResponseFromHeaders(Factory factory, Provider<OrgListHandler> orgHandlerProvider) {
+ this.factory = factory;
+ this.orgHandlerProvider = orgHandlerProvider;
+ }
+
+ /**
+ * parses the http response headers to create a new {@link VCloudSession} object.
+ */
+ public VCloudSession apply(HttpResponse from) {
+ try {
+ final String token = parseTokenFromHeaders(from);
+ final Map<String, ReferenceType> org = factory.create(orgHandlerProvider.get()).parse(
+ checkNotNull(from.getPayload().getInput(), "no payload in http response to login request %s", from));
+
+ return new VCloudSession() {
+ @VCloudToken
+ public String getVCloudToken() {
+ return token;
+ }
+
+ @Org
+ public Map<String, ReferenceType> getOrgs() {
+ return org;
+ }
+ };
+ } finally {
+ releasePayload(from);
+ }
+ }
+
+ public String parseTokenFromHeaders(HttpResponse from) {
+ String cookieHeader = from.getFirstHeaderOrNull("x-vcloud-authorization");
+ if (cookieHeader != null) {
+ Matcher matcher = pattern.matcher(cookieHeader);
+ return matcher.find() ? matcher.group(2) : cookieHeader;
+ } else {
+ try {
+ cookieHeader = Iterables.find(from.getHeaders().get(HttpHeaders.SET_COOKIE), Predicates.contains(pattern));
+ Matcher matcher = pattern.matcher(cookieHeader);
+ matcher.find();
+ return matcher.group(2);
+ } catch (NoSuchElementException e) {
+ throw new HttpResponseException(String.format("Header %s or %s must be present", "x-vcloud-authorization",
+ HttpHeaders.SET_COOKIE), null, from);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
new file mode 100755
index 0000000..1a0327a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
@@ -0,0 +1,66 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ private Logger logger = Logger.NULL;
+ private final VCloudApi aclient;
+
+ @Inject
+ VAppTemplatesForCatalogItems(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<VAppTemplate> apply(Iterable<CatalogItem> from) {
+ return filter(transform(filter(from, new Predicate<CatalogItem>() {
+ public boolean apply(CatalogItem input) {
+ return input.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML);
+ }
+ }), new Function<CatalogItem, VAppTemplate>() {
+ public VAppTemplate apply(CatalogItem from) {
+ return aclient.getVAppTemplateApi().getVAppTemplate(from.getEntity().getHref());
+ }
+ }), Predicates.notNull());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
new file mode 100755
index 0000000..e7507d4
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.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.vcloud.functions;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.notNull;
+import static com.google.common.collect.Iterables.filter;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class VAppTemplatesInOrg implements Function<Org, Iterable<VAppTemplate>> {
+
+ private final Function<Org, Iterable<CatalogItem>> allCatalogItemsInOrg;
+ private final Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> vAppTemplatesForCatalogItems;
+
+ @Inject
+ VAppTemplatesInOrg(Function<Org, Iterable<CatalogItem>> allCatalogItemsInOrg,
+ Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> vAppTemplatesForCatalogItems) {
+ this.allCatalogItemsInOrg = allCatalogItemsInOrg;
+ this.vAppTemplatesForCatalogItems = vAppTemplatesForCatalogItems;
+ }
+
+ @Override
+ public Iterable<VAppTemplate> apply(Org from) {
+ Iterable<CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
+ Iterable<VAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
+ return filter(vAppTemplates, and(notNull(), new Predicate<VAppTemplate>() {
+ @Override
+ public boolean apply(VAppTemplate input) {
+ if (input == null)
+ return false;
+ return ImmutableSet.of(Status.RESOLVED, Status.OFF).contains(input.getStatus());
+ }
+ }));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
new file mode 100755
index 0000000..741c184
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
@@ -0,0 +1,57 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VDC;
+
+import com.google.common.base.Function;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class VDCsInOrg implements Function<Org, Iterable<VDC>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+
+ private final VCloudApi aclient;
+
+ @Inject
+ VDCsInOrg(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<VDC> apply(final Org org) {
+ return transform(org.getVDCs().values(), new Function<ReferenceType, VDC>() {
+ public VDC apply(ReferenceType from) {
+ return aclient.getVDCApi().getVDC(from.getHref());
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
new file mode 100755
index 0000000..c5777a9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
@@ -0,0 +1,121 @@
+/*
+ * 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.vcloud.handlers;
+
+import static org.jclouds.http.HttpUtils.releasePayload;
+
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.VCloudResponseException;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.domain.VCloudError.MinorCode;
+import org.jclouds.vcloud.util.VCloudUtils;
+
+/**
+ * This will parse and set an appropriate exception on the command object.
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
+ @Resource
+ protected Logger logger = Logger.NULL;
+ public static final Pattern RESOURCE_PATTERN = Pattern.compile(".*/v[^/]+/([^/]+)/([0-9]+)");
+ private final VCloudUtils utils;
+
+ @Inject
+ public ParseVCloudErrorFromHttpResponse(VCloudUtils utils) {
+ this.utils = utils;
+ }
+
+ public void handleError(HttpCommand command, HttpResponse response) {
+ HttpRequest request = command.getCurrentRequest();
+ Exception exception = new HttpResponseException(command, response);
+ try {
+ VCloudError error = null;
+ String message = null;
+ if (response.getPayload() != null) {
+ try {
+ error = utils.parseErrorFromContent(request, response);
+ if (error != null) {
+ message = error.getMessage();
+ exception = new VCloudResponseException(command, response, error);
+ } else {
+ message = Strings2.toString(response.getPayload());
+ exception = message != null ? new HttpResponseException(command, response, message) : exception;
+ }
+ } catch (IOException e) {
+ } finally {
+ response.getPayload().release();
+ }
+ }
+ message = message != null ? message : String.format("%s -> %s", request.getRequestLine(), response
+ .getStatusLine());
+
+ switch (response.getStatusCode()) {
+ case 400:
+ if (error != null
+ && ((error.getMinorErrorCode() != null && error.getMinorErrorCode() == MinorCode.BUSY_ENTITY)
+ || (error.getMessage() != null && error.getMessage().indexOf("is not running") != -1)))
+ exception = new IllegalStateException(message, exception);
+ else
+ exception = new IllegalArgumentException(message, exception);
+ break;
+ case 401:
+ case 403:
+ if (error != null
+ && ((error.getMinorErrorCode() != null && error.getMinorErrorCode() == MinorCode.ACCESS_TO_RESOURCE_IS_FORBIDDEN)
+ || (error.getMessage() != null && error.getMessage().indexOf("No access to entity") != -1)))
+ exception = new ResourceNotFoundException(message, exception);
+ else
+ exception = new AuthorizationException(exception.getMessage(), exception);
+ break;
+ case 404:
+ if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
+ String path = command.getCurrentRequest().getEndpoint().getPath();
+ Matcher matcher = RESOURCE_PATTERN.matcher(path);
+ if (matcher.find()) {
+ message = String.format("%s %s not found", matcher.group(1), matcher.group(2));
+ } else {
+ message = path;
+ }
+ exception = new ResourceNotFoundException(message);
+ }
+ break;
+ }
+ } finally {
+ releasePayload(response);
+ command.setException(exception);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java
new file mode 100755
index 0000000..a333874
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java
@@ -0,0 +1,58 @@
+/*
+ * 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.vcloud.http.filters;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Supplier;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.jclouds.domain.Credentials;
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpRequest.Builder;
+import org.jclouds.http.HttpRequestFilter;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.location.Provider;
+import org.jclouds.rest.annotations.ApiVersion;
+
+@Singleton
+public class VCloudBasicAuthentication implements HttpRequestFilter
+{
+ private final Supplier<Credentials> creds;
+ private final String apiVersion;
+
+ @Inject
+ public VCloudBasicAuthentication(@Provider Supplier<Credentials> creds, @ApiVersion String apiVersion)
+ {
+ this.creds = ((Supplier)Preconditions.checkNotNull(creds, "creds"));
+ this.apiVersion = apiVersion;
+ }
+
+ public HttpRequest filter(HttpRequest request) throws HttpException
+ {
+ Credentials currentCreds = (Credentials)Preconditions.checkNotNull(this.creds.get(), "credential supplier returned null");
+ String acceptType = request.getFirstHeaderOrNull("Accept") == null ? "application/*+xml" : request.getFirstHeaderOrNull("Accept");
+
+ String version = ";version=" + this.apiVersion;
+ String acceptHeader = acceptType + version;
+
+ request = ((HttpRequest.Builder)request.toBuilder().replaceHeader("Accept", new String[] { acceptHeader })).build();
+
+ return ((HttpRequest.Builder)request.toBuilder().replaceHeader("Authorization", new String[] { BasicAuthentication.basic(currentCreds.identity, currentCreds.credential) })).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
new file mode 100755
index 0000000..3769fda
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
@@ -0,0 +1,35 @@
+/*
+ * 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.vcloud.http.filters;
+
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpRequestFilter;
+
+@Singleton
+public class VCloudSupportedVersions implements HttpRequestFilter
+{
+ @SuppressWarnings("rawtypes")
+public HttpRequest filter(HttpRequest request)
+ throws HttpException
+ {
+ return ((HttpRequest.Builder)request.toBuilder().replaceHeader("Accept", new String[] { "*/*" })).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
new file mode 100755
index 0000000..5f9b9c6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
@@ -0,0 +1,44 @@
+/*
+ * 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.vcloud.internal;
+
+import java.io.Closeable;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+
+import org.jclouds.vcloud.http.filters.VCloudBasicAuthentication;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
+
+@Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.class)
+@RequestFilters(VCloudBasicAuthentication.class)
+public interface VCloudLoginApi extends Closeable {
+
+ /**
+ * This request returns a token to use in subsequent requests. After 30 minutes of inactivity,
+ * the token expires and you have to request a new token with this call.
+ */
+ @POST
+ @ResponseParser(ParseLoginResponseFromHeaders.class)
+ @Consumes({VCloudMediaType.SESSION_XML,VCloudMediaType.ORGLIST_XML})
+ VCloudSession login();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
new file mode 100755
index 0000000..f004f97
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
@@ -0,0 +1,47 @@
+/*
+ * 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.vcloud.loaders;
+
+import java.net.URI;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.vcloud.VCloudApi;
+
+import com.google.common.cache.CacheLoader;
+
+@Singleton
+public class OVFLoader extends CacheLoader<URI, Envelope> {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final VCloudApi client;
+
+ @Inject
+ OVFLoader(VCloudApi client) {
+ this.client = client;
+ }
+
+ @Override
+ public Envelope load(URI template) {
+ return client.getVAppTemplateApi().getOvfEnvelopeForVAppTemplate(template);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
new file mode 100755
index 0000000..ee707db
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
@@ -0,0 +1,47 @@
+/*
+ * 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.vcloud.loaders;
+
+import java.net.URI;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.cache.CacheLoader;
+
+@Singleton
+public class VAppTemplateLoader extends CacheLoader<URI, VAppTemplate> {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final VCloudApi client;
+
+ @Inject
+ VAppTemplateLoader(VCloudApi client) {
+ this.client = client;
+ }
+
+ @Override
+ public VAppTemplate load(URI template) {
+ return client.getVAppTemplateApi().getVAppTemplate(template);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
new file mode 100755
index 0000000..38fb340
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
@@ -0,0 +1,74 @@
+/*
+ * 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.vcloud.location;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.find;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.Memoized;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.location.suppliers.ImplicitLocationSupplier;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class DefaultVDC implements ImplicitLocationSupplier {
+ private final Supplier<Set<? extends Location>> locationsSupplier;
+ private final IsDefaultVDC isDefaultVDC;
+
+ @Inject
+ DefaultVDC(@Memoized Supplier<Set<? extends Location>> locationsSupplier, IsDefaultVDC isDefaultVDC) {
+ this.locationsSupplier = checkNotNull(locationsSupplier, "locationsSupplierSupplier");
+ this.isDefaultVDC = checkNotNull(isDefaultVDC, "isDefaultVDC");
+ }
+
+ @Override
+ public Location get() {
+ return find(locationsSupplier.get(), isDefaultVDC);
+ }
+
+
+ @Singleton
+ public static class IsDefaultVDC implements Predicate<Location> {
+ private final Supplier<ReferenceType> defaultVDCSupplier;
+
+ @Inject
+ IsDefaultVDC(@VDC Supplier<ReferenceType> defaultVDCSupplier) {
+ this.defaultVDCSupplier = checkNotNull(defaultVDCSupplier, "defaultVDCSupplier");
+ }
+
+ @Override
+ public boolean apply(Location input) {
+ ReferenceType defaultVDC = defaultVDCSupplier.get();
+ return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString());
+ }
+
+ @Override
+ public String toString() {
+ return "isDefaultVDC()";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
new file mode 100755
index 0000000..d2827e5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
@@ -0,0 +1,93 @@
+/*
+ * 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.vcloud.location;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.location.Iso3166;
+import org.jclouds.location.Provider;
+import org.jclouds.location.suppliers.LocationsSupplier;
+import org.jclouds.location.suppliers.all.JustProvider;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgAndVDCToLocationSupplier extends JustProvider implements LocationsSupplier {
+
+ private final Supplier<Map<String, ReferenceType>> orgNameToResource;
+ private final Supplier<Map<String, Org>> orgNameToVDCResource;
+ private final Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier;
+
+ @Inject
+ OrgAndVDCToLocationSupplier(@Iso3166 Set<String> isoCodes, @Provider String providerName,
+ @Provider Supplier<URI> endpoint,
+ @org.jclouds.vcloud.endpoints.Org Supplier<Map<String, ReferenceType>> orgNameToResource,
+ Supplier<Map<String, Org>> orgNameToVDCResource,
+ @Iso3166 Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier) {
+ super(providerName, endpoint, isoCodes);
+ this.orgNameToResource = checkNotNull(orgNameToResource, "orgNameToResource");
+ this.orgNameToVDCResource = checkNotNull(orgNameToVDCResource, "orgNameToVDCResource");
+ this.isoCodesByIdSupplier = checkNotNull(isoCodesByIdSupplier, "isoCodesByIdSupplier");
+ }
+
+ @Override
+ public Set<Location> get() {
+ return buildJustProviderOrVDCs().build();
+ }
+
+ protected Builder<Location> buildJustProviderOrVDCs() {
+ Builder<Location> locations = ImmutableSet.builder();
+ Location provider = Iterables.getOnlyElement(super.get());
+ if (orgNameToResource.get().size() == 0)
+ return locations.add(provider);
+ Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
+ for (ReferenceType org : orgNameToResource.get().values()) {
+ LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(org.getHref().toASCIIString())
+ .description(org.getName()).parent(provider);
+ if (isoCodesById.containsKey(org.getHref().toASCIIString()))
+ builder.iso3166Codes(isoCodesById.get(org.getHref().toASCIIString()).get());
+ Location orgL = builder.build();
+ for (ReferenceType vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) {
+ builder = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getHref().toASCIIString()).description(
+ vdc.getName()).parent(orgL);
+ if (isoCodesById.containsKey(vdc.getHref().toASCIIString()))
+ builder.iso3166Codes(isoCodesById.get(vdc.getHref().toASCIIString()).get());
+ locations.add(builder.build());
+ }
+ }
+ return locations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
new file mode 100755
index 0000000..d74b246
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
@@ -0,0 +1,51 @@
+/*
+ * 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.vcloud.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class CaptureVAppOptions {
+
+ private String description;
+
+ public CaptureVAppOptions withDescription(String description) {
+ checkNotNull(description, "description");
+ this.description = description;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CaptureVAppOptions#withDescription(String)
+ */
+ public static CaptureVAppOptions withDescription(String description) {
+ CaptureVAppOptions options = new CaptureVAppOptions();
+ return options.withDescription(description);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
new file mode 100755
index 0000000..a018530
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
@@ -0,0 +1,77 @@
+/*
+ * 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.vcloud.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class CatalogItemOptions {
+
+ private String description;
+ private Map<String, String> properties = Maps.newLinkedHashMap();
+
+ /**
+ * optional description for the CatalogItem
+ */
+ public CatalogItemOptions description(String description) {
+ this.description = checkNotNull(description, "description");
+ return this;
+ }
+
+ /**
+ * optional properties for the CatalogItem
+ */
+ public CatalogItemOptions properties(Map<String, String> properties) {
+ this.properties = ImmutableMap.copyOf(checkNotNull(properties, "properties"));
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CatalogItemOptions#description
+ */
+ public static CatalogItemOptions description(String description) {
+ return new CatalogItemOptions().description(description);
+ }
+
+ /**
+ * @see CatalogItemOptions#properties
+ */
+ public static CatalogItemOptions properties(Map<String, String> properties) {
+ return new CatalogItemOptions().properties(properties);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneOptions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
new file mode 100755
index 0000000..0b6d3a5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
@@ -0,0 +1,53 @@
+/*
+ * 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.vcloud.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class CloneOptions {
+
+ private String description;
+
+ /**
+ * the clone should be powered on after it is deployed
+ */
+ public CloneOptions description(String description) {
+ checkNotNull(description, "description");
+ this.description = description;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CloneOptions#description(String)
+ */
+ public static CloneOptions description(String description) {
+ return new CloneOptions().description(description);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
new file mode 100755
index 0000000..81185c8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
@@ -0,0 +1,88 @@
+/*
+ * 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.vcloud.options;
+
+import static com.google.common.base.Preconditions.checkState;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class CloneVAppOptions extends CloneOptions {
+
+ private boolean deploy;
+ private boolean powerOn;
+
+ /**
+ * the clone should be deployed after it is created
+ */
+ public CloneVAppOptions deploy() {
+ this.deploy = true;
+ return this;
+ }
+
+ /**
+ * the clone should be powered on after it is deployed
+ */
+ public CloneVAppOptions powerOn() {
+ checkState(deploy, "must set deploy before setting powerOn");
+ powerOn = true;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public CloneVAppOptions description(String description) {
+ return CloneVAppOptions.class.cast(super.description(description));
+ }
+
+ public boolean isDeploy() {
+ return deploy;
+ }
+
+ public boolean isPowerOn() {
+ return powerOn;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CloneVAppOptions#deploy()
+ */
+ public static CloneVAppOptions deploy() {
+ return new CloneVAppOptions().deploy();
+ }
+
+ /**
+ * @see CloneVAppOptions#powerOn()
+ */
+ public static CloneVAppOptions powerOn() {
+ return new CloneVAppOptions().powerOn();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public static CloneVAppOptions description(String description) {
+ return new CloneVAppOptions().description(description);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
new file mode 100755
index 0000000..8f701eb
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
@@ -0,0 +1,42 @@
+/*
+ * 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.vcloud.options;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class CloneVAppTemplateOptions extends CloneOptions {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public CloneVAppTemplateOptions description(String description) {
+ return CloneVAppTemplateOptions.class.cast(super.description(description));
+ }
+
+ public static class Builder {
+ /**
+ * {@inheritDoc}
+ */
+ public static CloneVAppTemplateOptions description(String description) {
+ return new CloneVAppTemplateOptions().description(description);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
new file mode 100755
index 0000000..37d1d03
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
@@ -0,0 +1,178 @@
+/*
+ * 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.vcloud.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Set;
+
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Sets;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class InstantiateVAppTemplateOptions {
+ private Set<NetworkConfig> networkConfig = Sets.newLinkedHashSet();
+
+ private Boolean customizeOnInstantiate;
+ private String description = null;
+ private boolean deploy = true;
+ private boolean powerOn = true;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public boolean shouldDeploy() {
+ return deploy;
+ }
+
+ public boolean shouldPowerOn() {
+ return powerOn;
+ }
+
+ /**
+ * Optional description. Used for the Description of the vApp created by this
+ * instantiation.
+ */
+ public InstantiateVAppTemplateOptions description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * deploy the vapp after it is instantiated?
+ */
+ public InstantiateVAppTemplateOptions deploy(boolean deploy) {
+ this.deploy = deploy;
+ return this;
+ }
+
+ /**
+ * powerOn the vapp after it is instantiated?
+ */
+ public InstantiateVAppTemplateOptions powerOn(boolean powerOn) {
+ this.powerOn = powerOn;
+ return this;
+ }
+
+ /**
+ * {@networkConfig VAppTemplate}s have internal networks that can be
+ * connected in order to access the internet or other external networks.
+ *
+ * <h4>default behaviour if you don't use this option</h4> By default, we
+ * connect the first internal {@networkConfig
+ * org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection network in the
+ * vapp template}to a default chosen from the org or specified via
+ * {@networkConfig
+ * org.jclouds.vcloud.reference.VCloudConstants#
+ * PROPERTY_VCLOUD_DEFAULT_NETWORK} using the {@networkConfig
+ * org.jclouds.vcloud.domain.FenceMode#BRIDGED} or an
+ * override set by the property {@networkConfig
+ * org.jclouds.vcloud.reference.VCloudConstants#
+ * PROPERTY_VCLOUD_DEFAULT_FENCEMODE}.
+ */
+ public InstantiateVAppTemplateOptions addNetworkConfig(NetworkConfig networkConfig) {
+ this.networkConfig.add(checkNotNull(networkConfig, "networkConfig"));
+ return this;
+ }
+
+ public Set<NetworkConfig> getNetworkConfig() {
+ return networkConfig;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see InstantiateVAppTemplateOptions#description
+ */
+ public static InstantiateVAppTemplateOptions description(String description) {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ return options.description(description);
+ }
+
+ /**
+ * @see InstantiateVAppTemplateOptions#deploy
+ */
+ public static InstantiateVAppTemplateOptions deploy(boolean deploy) {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ return options.deploy(deploy);
+ }
+
+ /**
+ * @see InstantiateVAppTemplateOptions#powerOn
+ */
+ public static InstantiateVAppTemplateOptions powerOn(boolean powerOn) {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ return options.powerOn(powerOn);
+ }
+
+ /**
+ * @see InstantiateVAppTemplateOptions#addNetworkConfig
+ */
+ public static InstantiateVAppTemplateOptions addNetworkConfig(NetworkConfig networkConfig) {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ return options.addNetworkConfig(networkConfig);
+ }
+
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof InstantiateVAppTemplateOptions) {
+ final InstantiateVAppTemplateOptions other = InstantiateVAppTemplateOptions.class.cast(object);
+ return equal(networkConfig, other.networkConfig)
+ && equal(customizeOnInstantiate, other.customizeOnInstantiate) && equal(description, other.description)
+ && equal(deploy, other.deploy) && equal(powerOn, other.powerOn);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networkConfig, customizeOnInstantiate, description, deploy, powerOn);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ protected ToStringHelper string() {
+ ToStringHelper toString = Objects.toStringHelper("").omitNullValues();
+ toString.add("customizeOnInstantiate", customizeOnInstantiate).add("description", description);
+ if (networkConfig.size() > 0)
+ toString.add("networkConfig", networkConfig);
+ if (!deploy)
+ toString.add("deploy", deploy);
+ if (!powerOn)
+ toString.add("powerOn", powerOn);
+ return toString;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java
new file mode 100755
index 0000000..b7fabb8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.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.vcloud.predicates;
+
+import java.net.URI;
+
+import javax.annotation.Resource;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.TaskInErrorStateException;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+
+import com.google.common.base.Predicate;
+import com.google.inject.Inject;
+
+/**
+ *
+ * Tests to see if a task succeeds.
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class TaskSuccess implements Predicate<URI> {
+
+ private final VCloudApi client;
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Inject
+ public TaskSuccess(VCloudApi client) {
+ this.client = client;
+ }
+
+ public boolean apply(URI taskId) {
+ logger.trace("looking for status on task %s", taskId);
+
+ Task task = client.getTaskApi().getTask(taskId);
+ // perhaps task isn't available, yet
+ if (task == null)
+ return false;
+ logger.trace("%s: looking for status %s: currently: %s", task, TaskStatus.SUCCESS, task.getStatus());
+ if (task.getStatus() == TaskStatus.ERROR)
+ throw new TaskInErrorStateException(task);
+ return task.getStatus() == TaskStatus.SUCCESS;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
new file mode 100755
index 0000000..4c93a72
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
@@ -0,0 +1,51 @@
+/*
+ * 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.vcloud.reference;
+
+/**
+ * Configuration properties and constants used in VCloud connections.
+ *
+ * @author Adrian Cole
+ */
+public interface VCloudConstants {
+ public static final String PROPERTY_VCLOUD_VERSION_SCHEMA = "jclouds.vcloud.version.schema";
+ /**
+ * name of the default org that your vApp will join, if an org isn't
+ * explicitly specified.
+ */
+ public static final String PROPERTY_VCLOUD_DEFAULT_ORG = "jclouds.vcloud.defaults.org";
+ /**
+ * name of the default catalog to query, if it isn't explicitly specified.
+ */
+ public static final String PROPERTY_VCLOUD_DEFAULT_CATALOG = "jclouds.vcloud.defaults.catalog";
+ /**
+ * name of the VDC that your vApp will join, if a vDC isn't explicitly
+ * specified.
+ */
+ public static final String PROPERTY_VCLOUD_DEFAULT_VDC = "jclouds.vcloud.defaults.vdc";
+ /**
+ * name of the default network, in the default VDC that your vApp will join.
+ */
+ public static final String PROPERTY_VCLOUD_DEFAULT_NETWORK = "jclouds.vcloud.defaults.network";
+ public static final String PROPERTY_VCLOUD_DEFAULT_FENCEMODE = "jclouds.vcloud.defaults.fencemode";
+
+ public static final String PROPERTY_VCLOUD_XML_NAMESPACE = "jclouds.vcloud.xml.ns";
+ public static final String PROPERTY_VCLOUD_XML_SCHEMA = "jclouds.vcloud.xml.schema";
+
+ public static final String PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED = "jclouds.vcloud.timeout.task-complete";
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/reference/package-info.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/reference/package-info.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/reference/package-info.java
new file mode 100755
index 0000000..efd5c8e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/reference/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+/**
+ * This package contains properties and reference data used in vCloud.
+ * @author Adrian Cole
+ */
+package org.jclouds.vcloud.reference;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java
new file mode 100755
index 0000000..03f994e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.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.vcloud.suppliers;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.NoSuchElementException;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault implements
+ Function<Iterable<ReferenceType>, ReferenceType> {
+
+ protected final ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull;
+ protected final String configurationKey;
+ protected final Predicate<ReferenceType> defaultSelector;
+
+ public OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(
+ ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull, String configurationKey,
+ Predicate<ReferenceType> defaultSelector) {
+ this.configurationKey = checkNotNull(configurationKey, "configurationKey");
+ this.valueOfConfigurationKeyOrNull = checkNotNull(valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull");
+ this.defaultSelector = checkNotNull(defaultSelector, "defaultSelector");
+ }
+
+ @Override
+ public ReferenceType apply(Iterable<ReferenceType> referenceTypes) {
+ checkNotNull(referenceTypes, "referenceTypes");
+ checkArgument(Iterables.size(referenceTypes) > 0,
+ "No referenceTypes corresponding to configuration key %s present", configurationKey);
+ if (Iterables.size(referenceTypes) == 1)
+ return Iterables.getLast(referenceTypes);
+ String namingPattern = valueOfConfigurationKeyOrNull.apply(configurationKey);
+ if (namingPattern != null) {
+ return findReferenceTypeWithNameMatchingPattern(referenceTypes, namingPattern);
+ } else {
+ return defaultReferenceType(referenceTypes);
+ }
+ }
+
+ public ReferenceType defaultReferenceType(Iterable<ReferenceType> referenceTypes) {
+ return Iterables.find(referenceTypes, defaultSelector);
+ }
+
+ public ReferenceType findReferenceTypeWithNameMatchingPattern(Iterable<ReferenceType> referenceTypes,
+ String namingPattern) {
+ try {
+ return Iterables.find(referenceTypes, new ReferenceTypeNameMatchesPattern(namingPattern));
+ } catch (NoSuchElementException e) {
+ throw new NoSuchElementException(String.format(
+ "referenceType matching pattern [%s], corresponding to configuration key %s, not in %s", namingPattern,
+ configurationKey, referenceTypes));
+ }
+ }
+
+ static class ReferenceTypeNameMatchesPattern implements Predicate<ReferenceType> {
+
+ private final String namingPattern;
+
+ public ReferenceTypeNameMatchesPattern(String namingPattern) {
+ this.namingPattern = checkNotNull(namingPattern, "namingPattern");
+ }
+
+ @Override
+ public boolean apply(ReferenceType arg0) {
+ return arg0.getName().matches(namingPattern);
+ }
+
+ @Override
+ public String toString() {
+ return "nameMatchesPattern(" + namingPattern + ")";
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java
new file mode 100755
index 0000000..839ffd7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java
@@ -0,0 +1,86 @@
+/*
+ * 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.vcloud.suppliers;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Sets.newLinkedHashSet;
+import static org.jclouds.concurrent.FutureIterables.transformParallel;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class VAppTemplatesSupplier implements Supplier<Set<VAppTemplate>> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ public Logger logger = Logger.NULL;
+
+ private final Supplier<Map<String, Org>> orgMap;
+ private final Function<Org, Iterable<VAppTemplate>> imagesInOrg;
+ private final ListeningExecutorService userExecutor;
+
+ @Inject
+ VAppTemplatesSupplier(Supplier<Map<String, Org>> orgMap,
+ Function<Org, Iterable<VAppTemplate>> imagesInOrg,
+ @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
+ this.orgMap = checkNotNull(orgMap, "orgMap");
+ this.imagesInOrg = checkNotNull(imagesInOrg, "imagesInOrg");
+ this.userExecutor = checkNotNull(userExecutor, "userExecutor");
+ }
+
+ @Override
+ public Set<VAppTemplate> get() {
+ Iterable<Org> orgs = checkNotNull(orgMap.get().values(), "orgs");
+ Iterable<? extends Iterable<VAppTemplate>> images = transformParallel(orgs,
+ new Function<Org, ListenableFuture<? extends Iterable<VAppTemplate>>>() {
+ public ListenableFuture<Iterable<VAppTemplate>> apply(final Org from) {
+ checkNotNull(from, "org");
+ return userExecutor.submit(new Callable<Iterable<VAppTemplate>>() {
+ public Iterable<VAppTemplate> call() throws Exception {
+ return imagesInOrg.apply(from);
+ }
+ public String toString() {
+ return "imagesInOrg(" + from.getHref() + ")";
+ }
+ });
+ }
+ }, userExecutor, null, logger, "images in " + orgs);
+ return newLinkedHashSet(concat(images));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/util/Utils.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/util/Utils.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/util/Utils.java
new file mode 100755
index 0000000..9945bba
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/util/Utils.java
@@ -0,0 +1,71 @@
+/*
+ * 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.vcloud.util;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.domain.VCloudError.MinorCode;
+import org.jclouds.vcloud.domain.internal.ErrorImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class Utils {
+
+ public static ReferenceType newReferenceType(Map<String, String> attributes, String defaultType) {
+ String uri = attributes.get("href");
+ String type = attributes.get("type");
+ String relationship = attributes.get("rel");
+ // savvis org has null href
+ URI href = (uri != null) ? URI.create(uri) : null;
+ return new ReferenceTypeImpl(attributes.get("name"), type != null ? type : defaultType, href, relationship);
+ }
+
+ public static ReferenceType newReferenceType(Map<String, String> attributes) {
+ return newReferenceType(attributes, null);
+ }
+
+ public static VCloudError newError(Map<String, String> attributes) {
+
+ String vendorSpecificErrorCode = attributes.get("vendorSpecificErrorCode");
+ int errorCode;
+ // remove this logic when vcloud 0.8 is gone
+ try {
+ errorCode = Integer.parseInt(attributes.get("majorErrorCode"));
+ } catch (NumberFormatException e) {
+ errorCode = 500;
+ vendorSpecificErrorCode = attributes.get("majorErrorCode");
+ }
+ MinorCode minorErrorCode = attributes.containsKey("minorErrorCode") ? MinorCode.fromValue(attributes
+ .get("minorErrorCode")) : null;
+ if (minorErrorCode == null || minorErrorCode == MinorCode.UNRECOGNIZED) {
+ vendorSpecificErrorCode = attributes.get("minorErrorCode");
+ }
+
+ return new ErrorImpl(attributes.get("message"), errorCode, minorErrorCode, vendorSpecificErrorCode, attributes
+ .get("stackTrace"));
+ }
+
+ public static void putReferenceType(Map<String, ReferenceType> map, Map<String, String> attributes) {
+ map.put(attributes.get("name"), newReferenceType(attributes));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/util/VCloudUtils.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/util/VCloudUtils.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/util/VCloudUtils.java
new file mode 100755
index 0000000..00f9ebf
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/util/VCloudUtils.java
@@ -0,0 +1,67 @@
+/*
+ * 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.vcloud.util;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.xml.ErrorHandler;
+
+/**
+ * Needed to sign and verify requests and responses.
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class VCloudUtils {
+ private final ParseSax.Factory factory;
+ private final Provider<ErrorHandler> errorHandlerProvider;
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Inject
+ VCloudUtils(Factory factory, Provider<ErrorHandler> errorHandlerProvider) {
+ this.factory = factory;
+ this.errorHandlerProvider = errorHandlerProvider;
+ }
+
+ public VCloudError parseErrorFromContent(HttpRequest request, HttpResponse response) {
+ // HEAD has no content
+ if (response.getPayload() == null)
+ return null;
+ // NOTE in vCloud Datacenter 1.5, if you make vCloud 1.0 requests, the content type
+ // header is suffixed with ;1.0
+ String contentType = response.getPayload().getContentMetadata().getContentType();
+ if (contentType != null && contentType.startsWith(VCloudMediaType.ERROR_XML)) {
+ try {
+ return factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
+ } catch (RuntimeException e) {
+ logger.warn(e, "error parsing error");
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java
new file mode 100755
index 0000000..0bb3549
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java
@@ -0,0 +1,104 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+import static org.jclouds.vcloud.util.Utils.putReferenceType;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ */
+public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
+
+ protected final TaskHandler taskHandler;
+
+ @Inject
+ public CatalogHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ private StringBuilder currentText = new StringBuilder();
+
+ private ReferenceType catalog;
+ private Map<String, ReferenceType> contents = Maps.newLinkedHashMap();
+ protected List<Task> tasks = Lists.newArrayList();
+ private String description;
+ private ReferenceType org;
+
+ private boolean published = true;
+ private boolean readOnly = true;
+
+ public Catalog getResult() {
+ return new CatalogImpl(catalog.getName(), catalog.getType(), catalog.getHref(), org, description, contents,
+ tasks, published, readOnly);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "Catalog")) {
+ catalog = newReferenceType(attributes, VCloudMediaType.CATALOG_XML);
+ } else if (SaxUtils.equalsOrSuffix(qName, "CatalogItem")) {
+ putReferenceType(contents, attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ org = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "add".equals(attributes.get("rel"))) {
+ readOnly = false;
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ taskHandler.endElement(uri, name, qName);
+ if (SaxUtils.equalsOrSuffix(qName, "Task")) {
+ this.tasks.add(taskHandler.getResult());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Description")) {
+ description = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "IsPublished")) {
+ published = Boolean.parseBoolean(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
[50/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
new file mode 100644
index 0000000..b03727e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
@@ -0,0 +1,208 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import java.io.Closeable;
+import java.util.Set;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.location.Zone;
+import org.jclouds.location.functions.ZoneToEndpoint;
+import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
+import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsApi;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
+import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationApi;
+import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi;
+import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
+import org.jclouds.openstack.nova.v2_0.extensions.QuotaApi;
+import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeAttachmentApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi;
+import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
+import org.jclouds.openstack.nova.v2_0.features.ImageApi;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.v2_0.features.ExtensionApi;
+import org.jclouds.rest.annotations.Delegate;
+import org.jclouds.rest.annotations.EndpointParam;
+
+import com.google.common.base.Optional;
+import com.google.inject.Provides;
+
+/**
+ * Provides synchronous access to Nova.
+ * <p/>
+ *
+ * @see NovaAsyncApi
+ * @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
+ * />
+ * @author Adrian Cole
+ */
+public interface NovaApi extends Closeable {
+ /**
+ *
+ * @return the Zone codes configured
+ */
+ @Provides
+ @Zone
+ Set<String> getConfiguredZones();
+
+ /**
+ * Provides synchronous access to availability zone features
+ */
+ @Delegate
+ AvailabilityZoneAPI getAvailabilityZoneApi(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Server features.
+ */
+ @Delegate
+ ServerApi getServerApiForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Flavor features.
+ */
+ @Delegate
+ FlavorApi getFlavorApiForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Extension features.
+ */
+ @Delegate
+ ExtensionApi getExtensionApiForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Image features.
+ */
+ @Delegate
+ ImageApi getImageApiForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Floating IP features.
+ */
+ @Delegate
+ Optional<? extends FloatingIPApi> getFloatingIPExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Security Group features.
+ */
+ @Delegate
+ Optional<? extends SecurityGroupApi> getSecurityGroupExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Key Pair features.
+ */
+ @Delegate
+ Optional<? extends KeyPairApi> getKeyPairExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Host Administration features.
+ */
+ @Delegate
+ Optional<? extends HostAdministrationApi> getHostAdministrationExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Simple Tenant Usage features.
+ */
+ @Delegate
+ Optional<? extends SimpleTenantUsageApi> getSimpleTenantUsageExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Virtual Interface features.
+ */
+ @Delegate
+ Optional<? extends VirtualInterfaceApi> getVirtualInterfaceExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Server Extra Data features.
+ */
+ @Delegate
+ Optional<? extends ServerWithSecurityGroupsApi> getServerWithSecurityGroupsExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Server Admin Actions features.
+ */
+ @Delegate
+ Optional<? extends ServerAdminApi> getServerAdminExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Aggregate features.
+ */
+ @Delegate
+ Optional<? extends HostAggregateApi> getHostAggregateExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Flavor extra specs features.
+ */
+ @Delegate
+ Optional<? extends FlavorExtraSpecsApi> getFlavorExtraSpecsExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Quota features.
+ */
+ @Delegate
+ Optional<? extends QuotaApi> getQuotaExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Quota Classes features.
+ */
+ @Delegate
+ Optional<? extends QuotaClassApi> getQuotaClassExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Volume features.
+ */
+ @Delegate
+ Optional<? extends VolumeApi> getVolumeExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Volume Attachment features.
+ */
+ @Delegate
+ Optional<? extends VolumeAttachmentApi> getVolumeAttachmentExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides synchronous access to Volume Type features.
+ */
+ @Delegate
+ Optional<? extends VolumeTypeApi> getVolumeTypeExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java
new file mode 100644
index 0000000..ff87858
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java
@@ -0,0 +1,125 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
+import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
+import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS;
+import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS;
+import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.TIMEOUT_SECURITYGROUP_PRESENT;
+import static org.jclouds.reflect.Reflection2.typeToken;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
+import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
+import org.jclouds.openstack.keystone.v2_0.config.MappedAuthenticationApiModule;
+import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
+import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.rest.internal.BaseRestApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Module;
+
+/**
+ * Implementation of {@link ApiMetadata} for Nova 2.0 API
+ *
+ * @author Adrian Cole
+ */
+public class NovaApiMetadata extends BaseRestApiMetadata {
+
+ /**
+ * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaApi.class)} as
+ * {@link NovaAsyncApi} interface will be removed in jclouds 1.7.
+ */
+ @Deprecated
+ public static final TypeToken<org.jclouds.rest.RestContext<NovaApi, NovaAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<NovaApi, NovaAsyncApi>>() {
+ private static final long serialVersionUID = 1L;
+ };
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
+ }
+
+ public NovaApiMetadata() {
+ this(new Builder());
+ }
+
+ protected NovaApiMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = BaseRestApiMetadata.defaultProperties();
+ // auth fail can happen while cloud-init applies keypair updates
+ properties.setProperty("jclouds.ssh.max-retries", "7");
+ properties.setProperty("jclouds.ssh.retry-auth", "true");
+ properties.setProperty(SERVICE_TYPE, ServiceType.COMPUTE);
+ properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS);
+ properties.setProperty(AUTO_ALLOCATE_FLOATING_IPS, "false");
+ properties.setProperty(AUTO_GENERATE_KEYPAIRS, "false");
+ properties.setProperty(TIMEOUT_SECURITYGROUP_PRESENT, "500");
+ // Keystone 1.1 expires tokens after 24 hours and allows renewal 1 hour
+ // before expiry by default. We choose a value less than the latter
+ // since the former persists between jclouds invocations.
+ properties.setProperty(PROPERTY_SESSION_INTERVAL, 30 * 60 + "");
+ return properties;
+ }
+
+ public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
+
+ @SuppressWarnings("deprecation")
+ protected Builder() {
+ super(NovaApi.class, NovaAsyncApi.class);
+ id("openstack-nova")
+ .name("OpenStack Nova Diablo+ API")
+ .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant")
+ .credentialName("${password}")
+ .endpointName("KeyStone base url ending in /v2.0/")
+ .documentation(URI.create("http://api.openstack.org/"))
+ .version("1.1")
+ .defaultEndpoint("http://localhost:5000/v2.0/")
+ .defaultProperties(NovaApiMetadata.defaultProperties())
+ .view(typeToken(ComputeServiceContext.class))
+ .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
+ .add(MappedAuthenticationApiModule.class)
+ .add(KeystoneAuthenticationModule.class)
+ .add(ZoneModule.class)
+ .add(NovaParserModule.class)
+ .add(NovaRestClientModule.class)
+ .add(NovaComputeServiceContextModule.class).build());
+ }
+
+ @Override
+ public NovaApiMetadata build() {
+ return new NovaApiMetadata(this);
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
new file mode 100644
index 0000000..9abea53
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
@@ -0,0 +1,214 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import java.io.Closeable;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.location.Zone;
+import org.jclouds.location.functions.ZoneToEndpoint;
+import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
+import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeAttachmentAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeAsyncApi;
+import org.jclouds.openstack.nova.v2_0.features.FlavorAsyncApi;
+import org.jclouds.openstack.nova.v2_0.features.ImageAsyncApi;
+import org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi;
+import org.jclouds.openstack.v2_0.features.ExtensionAsyncApi;
+import org.jclouds.rest.annotations.Delegate;
+import org.jclouds.rest.annotations.EndpointParam;
+
+import com.google.common.base.Optional;
+import com.google.inject.Provides;
+
+/**
+ * Provides asynchronous access to Nova via their REST API.
+ * <p/>
+ *
+ * @see NovaApi
+ * @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
+ * />
+ * @author Adrian Cole
+ * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaApi.class)} as
+ * {@link NovaAsyncApi} interface will be removed in jclouds 1.7.
+ */
+@Deprecated
+public interface NovaAsyncApi extends Closeable {
+
+ /**
+ *
+ * @return the Zone codes configured
+ */
+ @Provides
+ @Zone
+ Set<String> getConfiguredZones();
+
+ /**
+ * Provides asynchronous access to availability zone features
+ */
+ @Delegate
+ AvailabilityZoneAPI getAvailabilityZoneApi(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Server features.
+ */
+ @Delegate
+ ServerAsyncApi getServerApiForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Flavor features.
+ */
+ @Delegate
+ FlavorAsyncApi getFlavorApiForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Extension features.
+ */
+ @Delegate
+ ExtensionAsyncApi getExtensionApiForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Image features.
+ */
+ @Delegate
+ ImageAsyncApi getImageApiForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Floating IP features.
+ */
+ @Delegate
+ Optional<? extends FloatingIPAsyncApi> getFloatingIPExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Security Group features.
+ */
+ @Delegate
+ Optional<? extends SecurityGroupAsyncApi> getSecurityGroupExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Key Pair features.
+ */
+ @Delegate
+ Optional<? extends KeyPairAsyncApi> getKeyPairExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Host Administration features.
+ */
+ @Delegate
+ Optional<? extends HostAdministrationAsyncApi> getHostAdministrationExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Simple Tenant Usage features.
+ */
+ @Delegate
+ Optional<? extends SimpleTenantUsageAsyncApi> getSimpleTenantUsageExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Virtual Interface features.
+ */
+ @Delegate
+ Optional<? extends VirtualInterfaceAsyncApi> getVirtualInterfaceExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+
+ /**
+ * Provides asynchronous access to Server Extra Data features.
+ */
+ @Delegate
+ Optional<? extends ServerWithSecurityGroupsAsyncApi> getServerWithSecurityGroupsExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Server Admin Actions features.
+ */
+ @Delegate
+ Optional<? extends ServerAdminAsyncApi> getServerAdminExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to HostAggregate features.
+ */
+ @Delegate
+ Optional<? extends HostAggregateAsyncApi> getHostAggregateExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Flavor extra specs features.
+ */
+ @Delegate
+ Optional<? extends FlavorExtraSpecsAsyncApi> getFlavorExtraSpecsExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Quota features.
+ */
+ @Delegate
+ Optional<? extends QuotaAsyncApi> getQuotaExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Quota Classes features.
+ */
+ @Delegate
+ Optional<? extends QuotaClassAsyncApi> getQuotaClassExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Volume features.
+ */
+ @Delegate
+ Optional<? extends VolumeAsyncApi> getVolumeExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Volume features.
+ */
+ @Delegate
+ Optional<? extends VolumeAttachmentAsyncApi> getVolumeAttachmentExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+ /**
+ * Provides asynchronous access to Volume Type features.
+ */
+ @Delegate
+ Optional<? extends VolumeTypeAsyncApi> getVolumeTypeExtensionForZone(
+ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindKeyPairToJsonPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindKeyPairToJsonPayload.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindKeyPairToJsonPayload.java
new file mode 100644
index 0000000..882eac6
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindKeyPairToJsonPayload.java
@@ -0,0 +1,47 @@
+/*
+ * 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.openstack.nova.v2_0.binders;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSortedMap;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class BindKeyPairToJsonPayload extends BindToJsonPayload {
+
+ @Inject
+ public BindKeyPairToJsonPayload(Json jsonBinder) {
+ super(jsonBinder);
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ return bindToRequest(request, (Object) ImmutableMap.of("keypair", ImmutableSortedMap.copyOf(postParams)));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindMetadataToJsonPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindMetadataToJsonPayload.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindMetadataToJsonPayload.java
new file mode 100644
index 0000000..3cf29d7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindMetadataToJsonPayload.java
@@ -0,0 +1,47 @@
+/*
+ * 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.openstack.nova.v2_0.binders;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class BindMetadataToJsonPayload extends BindToJsonPayload {
+
+ @Inject
+ public BindMetadataToJsonPayload(Json jsonBinder) {
+ super(jsonBinder);
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ return bindToRequest(request,
+ (Object) ImmutableMap.of("metadata", ImmutableMap.of(postParams.get("key"), postParams.get("value"))));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindSecurityGroupRuleToJsonPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindSecurityGroupRuleToJsonPayload.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindSecurityGroupRuleToJsonPayload.java
new file mode 100644
index 0000000..cdd3df5
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindSecurityGroupRuleToJsonPayload.java
@@ -0,0 +1,71 @@
+/*
+ * 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.openstack.nova.v2_0.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Predicates.instanceOf;
+import static com.google.common.collect.Iterables.find;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.nova.v2_0.domain.Ingress;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindSecurityGroupRuleToJsonPayload extends BindToJsonPayload implements MapBinder {
+ @Inject
+ public BindSecurityGroupRuleToJsonPayload(Json jsonBinder) {
+ super(jsonBinder);
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+ throw new IllegalStateException("BindCredentialsToJsonPayload needs parameters");
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Builder<String, Object> payload = ImmutableMap.builder();
+ payload.putAll(postParams);
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+
+ Ingress ingress = Ingress.class.cast(find(gRequest.getInvocation().getArgs(), instanceOf(Ingress.class)));
+ payload.put("ip_protocol", ingress.getIpProtocol().toString());
+ payload.put("from_port", ingress.getFromPort() + "");
+ payload.put("to_port", ingress.getToPort() + "");
+
+ return super.bindToRequest(request, ImmutableMap.of("security_group_rule", payload.build()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java
new file mode 100644
index 0000000..7a10942
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java
@@ -0,0 +1,183 @@
+/*
+ * 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.openstack.nova.v2_0.compute;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
+import static org.jclouds.openstack.nova.v2_0.predicates.KeyPairPredicates.nameMatches;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.compute.callables.RunScriptOnNode;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.extensions.ImageExtension;
+import org.jclouds.compute.extensions.SecurityGroupExtension;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.compute.internal.BaseComputeService;
+import org.jclouds.compute.internal.PersistNodeCredentials;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
+import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
+import org.jclouds.compute.strategy.DestroyNodeStrategy;
+import org.jclouds.compute.strategy.GetImageStrategy;
+import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
+import org.jclouds.compute.strategy.InitializeRunScriptOnNodeOrPlaceInBadMap;
+import org.jclouds.compute.strategy.ListNodesStrategy;
+import org.jclouds.compute.strategy.RebootNodeStrategy;
+import org.jclouds.compute.strategy.ResumeNodeStrategy;
+import org.jclouds.compute.strategy.SuspendNodeStrategy;
+import org.jclouds.domain.Credentials;
+import org.jclouds.domain.Location;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
+import org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates;
+import org.jclouds.scriptbuilder.functions.InitAdminAccess;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Multimap;
+import com.google.common.util.concurrent.ListeningExecutorService;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class NovaComputeService extends BaseComputeService {
+ protected final NovaApi novaApi;
+ protected final LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap;
+ protected final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
+ protected final Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByZoneId;
+ protected final GroupNamingConvention.Factory namingConvention;
+
+ @Inject
+ protected NovaComputeService(ComputeServiceContext context, Map<String, Credentials> credentialStore,
+ @Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> sizes,
+ @Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy,
+ GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
+ CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy,
+ DestroyNodeStrategy destroyNodeStrategy, ResumeNodeStrategy startNodeStrategy,
+ SuspendNodeStrategy stopNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
+ @Named("DEFAULT") Provider<TemplateOptions> templateOptionsProvider,
+ @Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
+ @Named(TIMEOUT_NODE_TERMINATED) Predicate<AtomicReference<NodeMetadata>> nodeTerminated,
+ @Named(TIMEOUT_NODE_SUSPENDED) Predicate<AtomicReference<NodeMetadata>> nodeSuspended,
+ InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
+ RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
+ PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
+ @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, NovaApi novaApi,
+ LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap,
+ LoadingCache<ZoneAndName, KeyPair> keyPairCache,
+ Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByZoneId,
+ GroupNamingConvention.Factory namingConvention, Optional<ImageExtension> imageExtension,
+ Optional<SecurityGroupExtension> securityGroupExtension) {
+ super(context, credentialStore, images, sizes, locations, listNodesStrategy, getImageStrategy,
+ getNodeMetadataStrategy, runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy,
+ startNodeStrategy, stopNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
+ nodeTerminated, nodeSuspended, initScriptRunnerFactory, initAdminAccess, runScriptOnNodeFactory,
+ persistNodeCredentials, timeouts, userExecutor, imageExtension, securityGroupExtension);
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ this.securityGroupMap = checkNotNull(securityGroupMap, "securityGroupMap");
+ this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
+ this.orphanedGroupsByZoneId = checkNotNull(orphanedGroupsByZoneId, "orphanedGroupsByZoneId");
+ this.namingConvention = checkNotNull(namingConvention, "namingConvention");
+ }
+
+ @Override
+ protected void cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes) {
+ Multimap<String, String> zoneToZoneAndGroupNames = orphanedGroupsByZoneId.apply(deadNodes);
+ for (Map.Entry<String, Collection<String>> entry : zoneToZoneAndGroupNames.asMap().entrySet()) {
+ cleanOrphanedGroupsInZone(ImmutableSet.copyOf(entry.getValue()), entry.getKey());
+ }
+ }
+
+ protected void cleanOrphanedGroupsInZone(Set<String> groups, String zoneId) {
+ cleanupOrphanedSecurityGroupsInZone(groups, zoneId);
+ cleanupOrphanedKeyPairsInZone(groups, zoneId);
+ }
+
+ private void cleanupOrphanedSecurityGroupsInZone(Set<String> groups, String zoneId) {
+ Optional<? extends SecurityGroupApi> securityGroupApi = novaApi.getSecurityGroupExtensionForZone(zoneId);
+ if (securityGroupApi.isPresent()) {
+ for (String group : groups) {
+ for (SecurityGroup securityGroup : Iterables.filter(securityGroupApi.get().list(),
+ SecurityGroupPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
+ ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, securityGroup.getName());
+ logger.debug(">> deleting securityGroup(%s)", zoneAndName);
+ securityGroupApi.get().delete(securityGroup.getId());
+ // TODO: test this clear happens
+ securityGroupMap.invalidate(zoneAndName);
+ logger.debug("<< deleted securityGroup(%s)", zoneAndName);
+ }
+ }
+ }
+ }
+
+ private void cleanupOrphanedKeyPairsInZone(Set<String> groups, String zoneId) {
+ Optional<? extends KeyPairApi> keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId);
+ if (keyPairApi.isPresent()) {
+ for (String group : groups) {
+ for (KeyPair pair : keyPairApi.get().list().filter(nameMatches(namingConvention.create().containsGroup(group)))) {
+ ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName());
+ logger.debug(">> deleting keypair(%s)", zoneAndName);
+ keyPairApi.get().delete(pair.getName());
+ // TODO: test this clear happens
+ keyPairCache.invalidate(zoneAndName);
+ logger.debug("<< deleted keypair(%s)", zoneAndName);
+ }
+ keyPairCache.invalidate(ZoneAndName.fromZoneAndName(zoneId,
+ namingConvention.create().sharedNameForGroup(group)));
+ }
+ }
+ }
+
+ /**
+ * returns template options, except of type {@link NovaTemplateOptions}.
+ */
+ @Override
+ public NovaTemplateOptions templateOptions() {
+ return NovaTemplateOptions.class.cast(super.templateOptions());
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java
new file mode 100644
index 0000000..0e24996
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java
@@ -0,0 +1,288 @@
+/*
+ * 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.openstack.nova.v2_0.compute;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.collect.Iterables.contains;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
+
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.location.Zone;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.compute.functions.RemoveFloatingIpFromNodeAndDeallocate;
+import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.domain.RebootType;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.FlavorInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
+import org.jclouds.openstack.nova.v2_0.predicates.ImagePredicates;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+
+/**
+ * The adapter used by the NovaComputeServiceContextModule to interface the nova-specific domain
+ * model to the computeService generic domain model.
+ *
+ * @author Matt Stephenson, Adrian Cole
+ */
+public class NovaComputeServiceAdapter implements
+ ComputeServiceAdapter<ServerInZone, FlavorInZone, ImageInZone, Location> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected final NovaApi novaApi;
+ protected final Supplier<Set<String>> zoneIds;
+ protected final RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate;
+ protected final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
+
+ @Inject
+ public NovaComputeServiceAdapter(NovaApi novaApi, @Zone Supplier<Set<String>> zoneIds,
+ RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate,
+ LoadingCache<ZoneAndName, KeyPair> keyPairCache) {
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ this.zoneIds = checkNotNull(zoneIds, "zoneIds");
+ this.removeFloatingIpFromNodeAndDeallocate = checkNotNull(removeFloatingIpFromNodeAndDeallocate,
+ "removeFloatingIpFromNodeAndDeallocate");
+ this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
+ }
+
+ /**
+ * Note that we do not validate extensions here, on basis that
+ * {@link ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet} has already
+ * done so.
+ */
+ @Override
+ public NodeAndInitialCredentials<ServerInZone> createNodeWithGroupEncodedIntoName(String group, String name,
+ Template template) {
+
+ LoginCredentials.Builder credentialsBuilder = LoginCredentials.builder();
+ NovaTemplateOptions templateOptions = template.getOptions().as(NovaTemplateOptions.class);
+
+ CreateServerOptions options = new CreateServerOptions();
+ options.metadata(metadataAndTagsAsCommaDelimitedValue(template.getOptions()));
+ if (templateOptions.getSecurityGroupNames().isPresent())
+ options.securityGroupNames(templateOptions.getSecurityGroupNames().get());
+ options.userData(templateOptions.getUserData());
+ options.diskConfig(templateOptions.getDiskConfig());
+ options.configDrive(templateOptions.getConfigDrive());
+ options.availabilityZone(templateOptions.getAvailabilityZone());
+
+ if (templateOptions.getNovaNetworks() != null) {
+ options.novaNetworks(templateOptions.getNovaNetworks());
+ }
+ if (templateOptions.getNetworks() != null) {
+ options.networks(templateOptions.getNetworks());
+ }
+
+ Optional<String> privateKey = Optional.absent();
+ if (templateOptions.getKeyPairName() != null) {
+ options.keyPairName(templateOptions.getKeyPairName());
+ KeyPair keyPair = keyPairCache.getIfPresent(ZoneAndName.fromZoneAndName(template.getLocation().getId(), templateOptions.getKeyPairName()));
+ if (keyPair != null && keyPair.getPrivateKey() != null) {
+ privateKey = Optional.of(keyPair.getPrivateKey());
+ credentialsBuilder.privateKey(privateKey.get());
+ }
+ }
+
+ String zoneId = template.getLocation().getId();
+ String imageId = template.getImage().getProviderId();
+ String flavorId = template.getHardware().getProviderId();
+
+ logger.debug(">> creating new server zone(%s) name(%s) image(%s) flavor(%s) options(%s)", zoneId, name, imageId, flavorId, options);
+ ServerCreated lightweightServer = novaApi.getServerApiForZone(zoneId).create(name, imageId, flavorId, options);
+ Server server = novaApi.getServerApiForZone(zoneId).get(lightweightServer.getId());
+
+ logger.trace("<< server(%s)", server.getId());
+
+ ServerInZone serverInZone = new ServerInZone(server, zoneId);
+ if (!privateKey.isPresent() && lightweightServer.getAdminPass().isPresent())
+ credentialsBuilder.password(lightweightServer.getAdminPass().get());
+ return new NodeAndInitialCredentials<ServerInZone>(serverInZone, serverInZone.slashEncode(), credentialsBuilder
+ .build());
+ }
+
+ @Override
+ public Iterable<FlavorInZone> listHardwareProfiles() {
+ Builder<FlavorInZone> builder = ImmutableSet.builder();
+ for (final String zoneId : zoneIds.get()) {
+ builder.addAll(transform(novaApi.getFlavorApiForZone(zoneId).listInDetail().concat(),
+ new Function<Flavor, FlavorInZone>() {
+
+ @Override
+ public FlavorInZone apply(Flavor arg0) {
+ return new FlavorInZone(arg0, zoneId);
+ }
+
+ }));
+ }
+ return builder.build();
+ }
+
+ @Override
+ public Iterable<ImageInZone> listImages() {
+ Builder<ImageInZone> builder = ImmutableSet.builder();
+ Set<String> zones = zoneIds.get();
+ checkState(zones.size() > 0, "no zones found in supplier %s", zoneIds);
+ for (final String zoneId : zones) {
+ Set<? extends Image> images = novaApi.getImageApiForZone(zoneId).listInDetail().concat().toSet();
+ if (images.size() == 0) {
+ logger.debug("no images found in zone %s", zoneId);
+ continue;
+ }
+ Iterable<? extends Image> active = filter(images, ImagePredicates.statusEquals(Image.Status.ACTIVE));
+ if (images.size() == 0) {
+ logger.debug("no images with status active in zone %s; non-active: %s", zoneId,
+ transform(active, new Function<Image, String>() {
+
+ @Override
+ public String apply(Image input) {
+ return Objects.toStringHelper("").add("id", input.getId()).add("status", input.getStatus())
+ .toString();
+ }
+
+ }));
+ continue;
+ }
+ builder.addAll(transform(active, new Function<Image, ImageInZone>() {
+
+ @Override
+ public ImageInZone apply(Image arg0) {
+ return new ImageInZone(arg0, zoneId);
+ }
+
+ }));
+ }
+ return builder.build();
+ }
+
+ @Override
+ public Iterable<ServerInZone> listNodes() {
+ Builder<ServerInZone> builder = ImmutableSet.builder();
+ for (final String zoneId : zoneIds.get()) {
+ builder.addAll(novaApi.getServerApiForZone(zoneId).listInDetail().concat()
+ .transform(new Function<Server, ServerInZone>() {
+
+ @Override
+ public ServerInZone apply(Server arg0) {
+ return new ServerInZone(arg0, zoneId);
+ }
+
+ }));
+ }
+ return builder.build();
+ }
+
+ @Override
+ public Iterable<ServerInZone> listNodesByIds(final Iterable<String> ids) {
+ return filter(listNodes(), new Predicate<ServerInZone>() {
+
+ @Override
+ public boolean apply(ServerInZone server) {
+ return contains(ids, server.slashEncode());
+ }
+ });
+ }
+
+ @Override
+ public Iterable<Location> listLocations() {
+ // locations provided by keystone
+ return ImmutableSet.of();
+ }
+
+ @Override
+ public ServerInZone getNode(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
+ return server == null ? null : new ServerInZone(server, zoneAndId.getZone());
+ }
+
+ @Override
+ public ImageInZone getImage(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ Image image = novaApi.getImageApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
+ return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
+ }
+
+ @Override
+ public void destroyNode(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ if (novaApi.getFloatingIPExtensionForZone(zoneAndId.getZone()).isPresent()) {
+ try {
+ removeFloatingIpFromNodeAndDeallocate.apply(zoneAndId);
+ } catch (RuntimeException e) {
+ logger.warn(e, "<< error removing and deallocating ip from node(%s): %s", id, e.getMessage());
+ }
+ }
+ novaApi.getServerApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
+ }
+
+ @Override
+ public void rebootNode(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ novaApi.getServerApiForZone(zoneAndId.getZone()).reboot(zoneAndId.getId(), RebootType.HARD);
+ }
+
+ @Override
+ public void resumeNode(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
+ novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().resume(zoneAndId.getId());
+ }
+ throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
+ }
+
+ @Override
+ public void suspendNode(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
+ novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().suspend(zoneAndId.getId());
+ }
+ throw new UnsupportedOperationException("suspend requires installation of the Admin Actions extension");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java
new file mode 100644
index 0000000..311d4ab
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java
@@ -0,0 +1,286 @@
+/*
+ * 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.openstack.nova.v2_0.compute.config;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS;
+import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS;
+import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.TIMEOUT_SECURITYGROUP_PRESENT;
+import static org.jclouds.util.Predicates2.retry;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.compute.extensions.ImageExtension;
+import org.jclouds.compute.extensions.SecurityGroupExtension;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.functions.IdentityFunction;
+import org.jclouds.net.domain.IpPermission;
+import org.jclouds.openstack.nova.v2_0.compute.NovaComputeService;
+import org.jclouds.openstack.nova.v2_0.compute.NovaComputeServiceAdapter;
+import org.jclouds.openstack.nova.v2_0.compute.extensions.NovaImageExtension;
+import org.jclouds.openstack.nova.v2_0.compute.extensions.NovaSecurityGroupExtension;
+import org.jclouds.openstack.nova.v2_0.compute.functions.CreateSecurityGroupIfNeeded;
+import org.jclouds.openstack.nova.v2_0.compute.functions.FlavorInZoneToHardware;
+import org.jclouds.openstack.nova.v2_0.compute.functions.ImageInZoneToImage;
+import org.jclouds.openstack.nova.v2_0.compute.functions.ImageToOperatingSystem;
+import org.jclouds.openstack.nova.v2_0.compute.functions.NovaSecurityGroupInZoneToSecurityGroup;
+import org.jclouds.openstack.nova.v2_0.compute.functions.NovaSecurityGroupToSecurityGroup;
+import org.jclouds.openstack.nova.v2_0.compute.functions.OrphanedGroupsByZoneId;
+import org.jclouds.openstack.nova.v2_0.compute.functions.SecurityGroupRuleToIpPermission;
+import org.jclouds.openstack.nova.v2_0.compute.functions.ServerInZoneToNodeMetadata;
+import org.jclouds.openstack.nova.v2_0.compute.loaders.CreateUniqueKeyPair;
+import org.jclouds.openstack.nova.v2_0.compute.loaders.FindSecurityGroupOrCreate;
+import org.jclouds.openstack.nova.v2_0.compute.loaders.LoadFloatingIpsForInstance;
+import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
+import org.jclouds.openstack.nova.v2_0.compute.strategy.ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.FlavorInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
+import org.jclouds.openstack.nova.v2_0.predicates.FindSecurityGroupWithNameAndReturnTrue;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Multimap;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+import com.google.inject.name.Names;
+
+/**
+ * Module for building a compute service context for Nova
+ *
+ * @author Matt Stephenson
+ */
+public class NovaComputeServiceContextModule extends
+ ComputeServiceAdapterContextModule<ServerInZone, FlavorInZone, ImageInZone, Location> {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(new TypeLiteral<ComputeServiceAdapter<ServerInZone, FlavorInZone, ImageInZone, Location>>() {
+ }).to(NovaComputeServiceAdapter.class);
+
+ bind(ComputeService.class).to(NovaComputeService.class);
+
+ bind(new TypeLiteral<Function<ServerInZone, NodeMetadata>>() {
+ }).to(ServerInZoneToNodeMetadata.class);
+
+ bind(new TypeLiteral<Function<SecurityGroupRule, IpPermission>>() {
+ }).to(SecurityGroupRuleToIpPermission.class);
+
+ bind(new TypeLiteral<Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroup>>() {
+ }).to(NovaSecurityGroupToSecurityGroup.class);
+
+ bind(new TypeLiteral<Function<SecurityGroupInZone, SecurityGroup>>() {
+ }).to(NovaSecurityGroupInZoneToSecurityGroup.class);
+
+ bind(new TypeLiteral<Function<Set<? extends NodeMetadata>, Multimap<String, String>>>() {
+ }).to(OrphanedGroupsByZoneId.class);
+
+ bind(new TypeLiteral<Function<ImageInZone, Image>>() {
+ }).to(ImageInZoneToImage.class);
+ bind(new TypeLiteral<Function<org.jclouds.openstack.nova.v2_0.domain.Image, OperatingSystem>>() {
+ }).to(ImageToOperatingSystem.class);
+
+ bind(new TypeLiteral<Function<FlavorInZone, Hardware>>() {
+ }).to(FlavorInZoneToHardware.class);
+
+ // we aren't converting location from a provider-specific type
+ bind(new TypeLiteral<Function<Location, Location>>() {
+ }).to(Class.class.cast(IdentityFunction.class));
+
+ bind(TemplateOptions.class).to(NovaTemplateOptions.class);
+
+ bind(new TypeLiteral<CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>>>() {
+ }).annotatedWith(Names.named("FLOATINGIP")).to(LoadFloatingIpsForInstance.class);
+
+ bind(new TypeLiteral<Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>>() {
+ }).to(CreateSecurityGroupIfNeeded.class);
+
+ bind(new TypeLiteral<CacheLoader<ZoneAndName, SecurityGroupInZone>>() {
+ }).to(FindSecurityGroupOrCreate.class);
+
+ bind(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class).to(
+ ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
+
+ bind(new TypeLiteral<CacheLoader<ZoneAndName, KeyPair>>() {
+ }).to(CreateUniqueKeyPair.class);
+
+ bind(new TypeLiteral<ImageExtension>() {
+ }).to(NovaImageExtension.class);
+
+ bind(new TypeLiteral<SecurityGroupExtension>() {
+ }).to(NovaSecurityGroupExtension.class);
+ }
+
+ @Override
+ protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
+ return options.as(NovaTemplateOptions.class)
+ .autoAssignFloatingIp(injector.getInstance(
+ Key.get(boolean.class, Names.named(AUTO_ALLOCATE_FLOATING_IPS))))
+ .generateKeyPair(injector.getInstance(
+ Key.get(boolean.class, Names.named(AUTO_GENERATE_KEYPAIRS))));
+ }
+
+ @Provides
+ @Singleton
+ @Named("FLOATINGIP")
+ protected LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> instanceToFloatingIps(
+ @Named("FLOATINGIP") CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>> in) {
+ return CacheBuilder.newBuilder().build(in);
+ }
+
+ @Provides
+ @Singleton
+ protected LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap(
+ CacheLoader<ZoneAndName, SecurityGroupInZone> in) {
+ return CacheBuilder.newBuilder().build(in);
+ }
+
+ @Override
+ protected Map<OsFamily, LoginCredentials> osFamilyToCredentials(Injector injector) {
+ return ImmutableMap.of(OsFamily.WINDOWS, LoginCredentials.builder().user("Administrator").build(),
+ OsFamily.UBUNTU, LoginCredentials.builder().user("ubuntu").build());
+ }
+
+ @Provides
+ @Singleton
+ @Named("SECURITYGROUP_PRESENT")
+ protected Predicate<AtomicReference<ZoneAndName>> securityGroupEventualConsistencyDelay(
+ FindSecurityGroupWithNameAndReturnTrue in,
+ @Named(TIMEOUT_SECURITYGROUP_PRESENT) long msDelay) {
+ return retry(in, msDelay, 100l, MILLISECONDS);
+ }
+
+ @Provides
+ @Singleton
+ protected LoadingCache<ZoneAndName, KeyPair> keyPairMap(
+ CacheLoader<ZoneAndName, KeyPair> in) {
+ return CacheBuilder.newBuilder().build(in);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Location>> createLocationIndexedById(
+ @Memoized Supplier<Set<? extends Location>> locations) {
+ return Suppliers.compose(new Function<Set<? extends Location>, Map<String, Location>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Map<String, Location> apply(Set<? extends Location> arg0) {
+ // TODO: find a nice way to get rid of this cast.
+ Iterable<Location> locations = (Iterable<Location>) arg0;
+ return Maps.uniqueIndex(locations, new Function<Location, String>() {
+
+ @Override
+ public String apply(Location arg0) {
+ return arg0.getId();
+ }
+
+ });
+ }
+ }, locations);
+
+ }
+
+ @VisibleForTesting
+ public static final Map<Server.Status, NodeMetadata.Status> toPortableNodeStatus = ImmutableMap
+ .<Server.Status, NodeMetadata.Status> builder().put(Server.Status.ACTIVE, NodeMetadata.Status.RUNNING)//
+ .put(Server.Status.SUSPENDED, NodeMetadata.Status.SUSPENDED)//
+ .put(Server.Status.DELETED, NodeMetadata.Status.TERMINATED)//
+ .put(Server.Status.PAUSED, NodeMetadata.Status.SUSPENDED)//
+ .put(Server.Status.RESIZE, NodeMetadata.Status.PENDING)//
+ .put(Server.Status.VERIFY_RESIZE, NodeMetadata.Status.PENDING)//
+ .put(Server.Status.REVERT_RESIZE, NodeMetadata.Status.PENDING)//
+ .put(Server.Status.BUILD, NodeMetadata.Status.PENDING)//
+ .put(Server.Status.PASSWORD, NodeMetadata.Status.PENDING)//
+ .put(Server.Status.REBUILD, NodeMetadata.Status.PENDING)//
+ .put(Server.Status.ERROR, NodeMetadata.Status.ERROR)//
+ .put(Server.Status.REBOOT, NodeMetadata.Status.PENDING)//
+ .put(Server.Status.HARD_REBOOT, NodeMetadata.Status.PENDING)//
+ .put(Server.Status.UNKNOWN, NodeMetadata.Status.UNRECOGNIZED)//
+ .put(Server.Status.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED).build();
+
+ @Singleton
+ @Provides
+ protected Map<Server.Status, NodeMetadata.Status> toPortableNodeStatus() {
+ return toPortableNodeStatus;
+ }
+
+ @VisibleForTesting
+ public static final Map<org.jclouds.openstack.nova.v2_0.domain.Image.Status, Image.Status> toPortableImageStatus = ImmutableMap
+ .<org.jclouds.openstack.nova.v2_0.domain.Image.Status, Image.Status> builder()
+ .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.ACTIVE, Image.Status.AVAILABLE)
+ .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.SAVING, Image.Status.PENDING)
+ .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.DELETED, Image.Status.DELETED)
+ .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.ERROR, Image.Status.ERROR)
+ .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.UNKNOWN, Image.Status.UNRECOGNIZED)
+ .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.UNRECOGNIZED, Image.Status.UNRECOGNIZED).build();
+
+ @Singleton
+ @Provides
+ protected Map<org.jclouds.openstack.nova.v2_0.domain.Image.Status, Image.Status> toPortableImageStatus() {
+ return toPortableImageStatus;
+ }
+
+ @Override
+ protected Optional<ImageExtension> provideImageExtension(Injector i) {
+ return Optional.of(i.getInstance(ImageExtension.class));
+ }
+
+ @Override
+ protected Optional<SecurityGroupExtension> provideSecurityGroupExtension(Injector i) {
+ return Optional.of(i.getInstance(SecurityGroupExtension.class));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtension.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtension.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtension.java
new file mode 100644
index 0000000..f8fd4d9
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtension.java
@@ -0,0 +1,140 @@
+/*
+ * 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.openstack.nova.v2_0.compute.extensions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.collect.Iterables.find;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_IMAGE_AVAILABLE;
+import static org.jclouds.location.predicates.LocationPredicates.idEquals;
+
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.domain.CloneImageTemplate;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.domain.ImageTemplate;
+import org.jclouds.compute.domain.ImageTemplateBuilder;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.extensions.ImageExtension;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.util.concurrent.Atomics;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.UncheckedTimeoutException;
+
+/**
+ * Nova implementation of {@link ImageExtension}
+ *
+ * @author David Alves
+ *
+ */
+@Singleton
+public class NovaImageExtension implements ImageExtension {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ private final NovaApi novaApi;
+ private final ListeningExecutorService userExecutor;
+ private final Supplier<Set<? extends Location>> locations;
+ private final Predicate<AtomicReference<Image>> imageAvailablePredicate;
+
+ @Inject
+ public NovaImageExtension(NovaApi novaApi, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
+ @Memoized Supplier<Set<? extends Location>> locations,
+ @Named(TIMEOUT_IMAGE_AVAILABLE) Predicate<AtomicReference<Image>> imageAvailablePredicate) {
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ this.userExecutor = checkNotNull(userExecutor, "userExecutor");
+ this.locations = checkNotNull(locations, "locations");
+ this.imageAvailablePredicate = checkNotNull(imageAvailablePredicate, "imageAvailablePredicate");
+ }
+
+ @Override
+ public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
+ if (server == null)
+ throw new NoSuchElementException("Cannot find server with id: " + zoneAndId);
+ CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
+ return template;
+ }
+
+ @Override
+ public ListenableFuture<Image> createImage(ImageTemplate template) {
+ checkState(template instanceof CloneImageTemplate,
+ " openstack-nova only supports creating images through cloning.");
+ CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
+ ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());
+
+ String newImageId = novaApi.getServerApiForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
+ cloneTemplate.getName(), sourceImageZoneAndId.getId());
+
+ final ZoneAndId targetImageZoneAndId = ZoneAndId.fromZoneAndId(sourceImageZoneAndId.getZone(), newImageId);
+
+ logger.info(">> Registered new Image %s, waiting for it to become available.", newImageId);
+
+ final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
+ .location(find(locations.get(), idEquals(targetImageZoneAndId.getZone())))
+ .id(targetImageZoneAndId.slashEncode())
+ .providerId(targetImageZoneAndId.getId())
+ .description(cloneTemplate.getName())
+ .operatingSystem(OperatingSystem.builder().description(cloneTemplate.getName()).build())
+ .status(Image.Status.PENDING).build());
+
+ return userExecutor.submit(new Callable<Image>() {
+ @Override
+ public Image call() throws Exception {
+ if (imageAvailablePredicate.apply(image))
+ return image.get();
+ // TODO: get rid of the expectation that the image will be available, as it is very brittle
+ throw new UncheckedTimeoutException("Image was not created within the time limit: " + image.get());
+ }
+ });
+ }
+
+ @Override
+ public boolean deleteImage(String id) {
+ ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
+ try {
+ this.novaApi.getImageApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+}
[04/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationWithTenantNameExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationWithTenantNameExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationWithTenantNameExpectTest.java
deleted file mode 100644
index 06b6f85..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationWithTenantNameExpectTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- *
- * @see KeystoneProperties#CREDENTIAL_TYPE
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "PasswordAuthenticationWithTenantNameExpectTest")
-public class PasswordAuthenticationWithTenantNameExpectTest extends BaseNovaApiExpectTest {
-
- /**
- * this reflects the properties that a user would pass to createContext
- */
- @Override
- protected Properties setupProperties() {
- Properties contextProperties = super.setupProperties();
- contextProperties.setProperty("jclouds.keystone.credential-type", "passwordCredentials");
- return contextProperties;
- }
-
- public void testListServersWhenResponseIs2xx() throws Exception {
- HttpRequest listServers = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/server_list.json")).build();
-
- NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, listServers, listServersResponse);
-
- assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
- new ParseServerListTest().expected().toString());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapterExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapterExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapterExpectTest.java
deleted file mode 100644
index edf5a56..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapterExpectTest.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-
-import java.util.Map;
-import java.util.Properties;
-
-import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.domain.TemplateBuilder;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.domain.Network;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceContextExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.TypeLiteral;
-
-/**
- * Tests the compute service abstraction of the nova api.
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "NovaComputeServiceAdapterExpectTest")
-public class NovaComputeServiceAdapterExpectTest extends BaseNovaComputeServiceContextExpectTest<Injector> {
- HttpRequest serverDetail = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/71752")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse serverDetailResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/server_details.json")).build();
-
- public void testCreateNodeWithGroupEncodedIntoNameWithNetworks() throws Exception {
-
- HttpRequest createServer = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"networks\": [{\"uuid\": \"4ebd35cf-bfe7-4d93-b0d8-eb468ce2245a\"}]}}","application/json"))
- .build();
-
- HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server_networks_response.json","application/json; charset=UTF-8")).build();
-
- Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
- .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
- .put(listDetail, listDetailResponse)
- .put(listFlavorsDetail, listFlavorsDetailResponse)
- .put(createServer, createServerResponse)
- .put(serverDetail, serverDetailResponse).build();
-
- Injector forNetworks = requestsSendResponses(requestResponseMap);
-
- Template template = forNetworks.getInstance(TemplateBuilder.class).build();
- template.getOptions().as(NovaTemplateOptions.class).networks("4ebd35cf-bfe7-4d93-b0d8-eb468ce2245a");
-
- NovaComputeServiceAdapter adapter = forNetworks.getInstance(NovaComputeServiceAdapter.class);
-
- NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92", template);
- assertNotNull(server);
- // Response irrelevant in this expect test - just verifying the request.
- }
-
- public void testCreateNodeWithGroupEncodedIntoNameWithDiskConfig() throws Exception {
-
- HttpRequest createServer = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"OS-DCF:diskConfig\":\"AUTO\"}}","application/json"))
- .build();
-
- HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server_disk_config_auto.json","application/json; charset=UTF-8")).build();
-
- Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
- .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
- .put(listDetail, listDetailResponse)
- .put(listFlavorsDetail, listFlavorsDetailResponse)
- .put(createServer, createServerResponse)
- .put(serverDetail, serverDetailResponse).build();
-
- Injector forDiskConfig = requestsSendResponses(requestResponseMap);
-
- Template template = forDiskConfig.getInstance(TemplateBuilder.class).build();
- template.getOptions().as(NovaTemplateOptions.class).diskConfig(Server.DISK_CONFIG_AUTO);
-
- NovaComputeServiceAdapter adapter = forDiskConfig.getInstance(NovaComputeServiceAdapter.class);
-
- NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92", template);
- assertNotNull(server);
- assertEquals(server.getNode().getServer().getDiskConfig().orNull(), Server.DISK_CONFIG_AUTO);
- }
-
- public void testCreateNodeWithGroupEncodedIntoNameWithNovaNetworks() throws Exception {
-
- HttpRequest createServer = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"networks\":[{\"uuid\":\"12345\", \"port\":\"67890\", \"fixed_ip\":\"192.168.0.1\"},{\"uuid\":\"54321\", \"port\":\"09876\", \"fixed_ip\":\"192.168.0.2\"},{\"uuid\":\"non-nova-uuid\"}]}}","application/json"))
- .build();
-
- HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server_nova_networks.json","application/json; charset=UTF-8")).build();
-
- Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
- .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
- .put(listDetail, listDetailResponse)
- .put(listFlavorsDetail, listFlavorsDetailResponse)
- .put(createServer, createServerResponse)
- .put(serverDetail, serverDetailResponse).build();
-
- Injector forNovaNetworks = requestsSendResponses(requestResponseMap);
-
- Template template = forNovaNetworks.getInstance(TemplateBuilder.class).build();
- template.getOptions().as(NovaTemplateOptions.class)
- .networks("non-nova-uuid")
- .novaNetworks(
- ImmutableSet.of(
- Network.builder()
- .networkUuid("12345")
- .portUuid("67890")
- .fixedIp("192.168.0.1")
- .build(),
- Network.builder()
- .networkUuid("54321")
- .portUuid("09876")
- .fixedIp("192.168.0.2")
- .build()));
-
- NovaComputeServiceAdapter adapter = forNovaNetworks.getInstance(NovaComputeServiceAdapter.class);
-
- NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92", template);
- assertNotNull(server);
- }
-
- public void testCreateNodeWithGroupEncodedIntoNameWhenSecurityGroupsArePresent() throws Exception {
-
- HttpRequest createServer = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"security_groups\":[{\"name\":\"group1\"}, {\"name\":\"group2\"}]}}","application/json"))
- .build();
-
- HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server.json","application/json; charset=UTF-8")).build();
-
- Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
- .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
- .put(listDetail, listDetailResponse)
- .put(listFlavorsDetail, listFlavorsDetailResponse)
- .put(createServer, createServerResponse)
- .put(serverDetail, serverDetailResponse).build();
-
- Injector forSecurityGroups = requestsSendResponses(requestResponseMap);
-
- Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
- template.getOptions().as(NovaTemplateOptions.class).securityGroupNames("group1", "group2");
-
- NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);
-
- NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
- template);
- assertNotNull(server);
- assertEquals(server.getCredentials(), LoginCredentials.builder().password("ZWuHcmTMQ7eXoHeM").build());
- }
-
- /**
- * We need to choose the correct credential for attempts to start the server. cloud-init or the
- * like will set the ssh key as the login credential, and not necessarily will password
- * authentication even be available.
- */
- public void testWhenKeyPairPresentWeUsePrivateKeyAsCredentialNotPassword() throws Exception {
-
- HttpRequest createServer = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"key_name\":\"foo\"}}","application/json"))
- .build();
-
-
- HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server_no_adminpass.json","application/json; charset=UTF-8")).build();
-
- Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
- .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
- .put(listDetail, listDetailResponse)
- .put(listFlavorsDetail, listFlavorsDetailResponse)
- .put(createServer, createServerResponse)
- .put(serverDetail, serverDetailResponse).build();
-
- Injector forSecurityGroups = requestsSendResponses(requestResponseMap);
-
- Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
- template.getOptions().as(NovaTemplateOptions.class).keyPairName("foo");
-
- NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);
-
- // we expect to have already an entry in the cache for the key
- LoadingCache<ZoneAndName, KeyPair> keyPairCache = forSecurityGroups.getInstance(Key
- .get(new TypeLiteral<LoadingCache<ZoneAndName, KeyPair>>() {
- }));
- keyPairCache.put(ZoneAndName.fromZoneAndName("az-1.region-a.geo-1", "foo"), KeyPair.builder().name("foo")
- .privateKey("privateKey").build());
-
- NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
- template);
- assertNotNull(server);
- assertEquals(server.getCredentials(), LoginCredentials.builder().privateKey("privateKey").build());
- }
-
-
- /**
- * When enable_instance_password is false, then no admin pass is generated.
- * However in this case if you don't specify the name of the SSH keypair to
- * inject, then you simply cannot log in to the server.
- */
- public void testNoKeyPairOrAdminPass() throws Exception {
-
- HttpRequest createServer = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\"}}","application/json"))
- .build();
-
- HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server_no_adminpass.json","application/json; charset=UTF-8")).build();
-
- Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
- .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
- .put(listDetail, listDetailResponse)
- .put(listFlavorsDetail, listFlavorsDetailResponse)
- .put(createServer, createServerResponse)
- .put(serverDetail, serverDetailResponse).build();
-
- Injector forSecurityGroups = requestsSendResponses(requestResponseMap);
-
- Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
-
- NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);
-
- NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
- template);
- assertNotNull(server);
- assertNull(server.getCredentials());
- }
-
- @Override
- public Injector apply(ComputeServiceContext input) {
- return input.utils().injector();
- }
-
- @Override
- protected Properties setupProperties() {
- Properties overrides = super.setupProperties();
- // only specify one zone so that we don't have to configure requests for multiple zones
- overrides.setProperty("jclouds.zones", "az-1.region-a.geo-1");
- return overrides;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceExpectTest.java
deleted file mode 100644
index 1888963..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceExpectTest.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.blockUntilRunning;
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.keyPairName;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.domain.Location;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-import com.google.common.collect.Iterables;
-import com.google.inject.AbstractModule;
-import com.google.inject.TypeLiteral;
-
-/**
- * Tests the compute service abstraction of the nova api.
- *
- * @author Matt Stephenson
- */
-@Test(groups = "unit", testName = "NovaComputeServiceExpectTest")
-public class NovaComputeServiceExpectTest extends BaseNovaComputeServiceExpectTest {
-
- @Override
- protected Properties setupProperties() {
- Properties overrides = super.setupProperties();
- // only specify limited zones so that we don't have to configure requests for multiple zones.
- // since we are doing tests with keystone responses from hpcloud and also openstack, we have
- // to whitelist one zone from each
- overrides.setProperty("jclouds.zones", "az-1.region-a.geo-1,RegionOne");
- return overrides;
- }
-
- public void testListLocationsWhenResponseIs2xx() throws Exception {
-
- Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
- .put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(listDetail, listDetailResponse)
- .put(listServers, listServersResponse).put(listFlavorsDetail, listFlavorsDetailResponse).build();
-
- ComputeService apiWhenServersExist = requestsSendResponses(requestResponseMap);
-
- Set<? extends Location> locations = apiWhenServersExist.listAssignableLocations();
- assertNotNull(locations);
- assertEquals(locations.size(), 1);
- assertEquals(locations.iterator().next().getId(), "az-1.region-a.geo-1");
-
- assertNotNull(apiWhenServersExist.listNodes());
- assertEquals(apiWhenServersExist.listNodes().size(), 1);
- assertEquals(apiWhenServersExist.listNodes().iterator().next().getId(),
- "az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f000004d2");
- assertEquals(apiWhenServersExist.listNodes().iterator().next().getName(), "sample-server");
- }
-
- Map<HttpRequest, HttpResponse> defaultTemplateOpenStack = ImmutableMap
- .<HttpRequest, HttpResponse> builder()
- .put(keystoneAuthWithUsernameAndPasswordAndTenantName,
- HttpResponse
- .builder()
- .statusCode(200)
- .message("HTTP/1.1 200")
- .payload(
- payloadFromResourceWithContentType("/keystoneAuthResponse_openstack.json", "application/json"))
- .build())
- .put(extensionsOfNovaRequest.toBuilder()
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/extensions").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/extension_list_openstack.json"))
- .build())
- .put(listDetail.toBuilder()
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/images/detail").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/image_list_detail_openstack.json"))
- .build())
- .put(listServers.toBuilder()
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers/detail").build(),
- listServersResponse)
- .put(listFlavorsDetail.toBuilder()
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/flavors/detail").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/flavor_list_detail_openstack.json"))
- .build()).build();
-
- public void testDefaultTemplateOpenStack() throws Exception {
-
- ComputeService apiForOpenStack = requestsSendResponses(defaultTemplateOpenStack);
-
- Template defaultTemplate = apiForOpenStack.templateBuilder().imageId("RegionOne/15").build();
- checkTemplate(defaultTemplate);
- checkTemplate(apiForOpenStack.templateBuilder().fromTemplate(defaultTemplate).build());
-
- }
-
- private void checkTemplate(Template defaultTemplate) {
- assertEquals(defaultTemplate.getImage().getId(), "RegionOne/15");
- assertEquals(defaultTemplate.getImage().getProviderId(), "15");
- assertEquals(defaultTemplate.getHardware().getId(), "RegionOne/1");
- assertEquals(defaultTemplate.getHardware().getProviderId(), "1");
- assertEquals(defaultTemplate.getLocation().getId(), "RegionOne");
- assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
- }
-
- public void testListServersWhenReponseIs404IsEmpty() throws Exception {
- HttpRequest listServers = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/detail")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listServersResponse = HttpResponse.builder().statusCode(404).build();
-
- ComputeService apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, listServers, listServersResponse);
-
- assertTrue(apiWhenNoServersExist.listNodes().isEmpty());
- }
-
- HttpRequest list = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-security-groups")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse notFound = HttpResponse.builder().statusCode(404).build();
-
- HttpRequest createWithPrefixOnGroup = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-security-groups")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"security_group\":{\"name\":\"jclouds-test\",\"description\":\"jclouds-test\"}}",
- "application/json")).build();
-
- HttpResponse securityGroupCreated = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/securitygroup_created.json")).build();
-
- HttpRequest createRuleForDefaultPort22 = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-security-group-rules")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"security_group_rule\":{\"parent_group_id\":\"160\",\"cidr\":\"0.0.0.0/0\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
- "application/json")).build();
-
- HttpResponse securityGroupRuleCreated = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/securitygrouprule_created.json")).build();
-
- HttpRequest getSecurityGroup = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-security-groups/160")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse securityGroupWithPort22 = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/securitygroup_details_port22.json")).build();
-
- HttpRequest create = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-keypairs")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"keypair\":{\"name\":\"jclouds-test-0\"}}",
- "application/json")).build();
-
- HttpResponse keyPairWithPrivateKey = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/keypair_created_computeservice.json")).build();
-
- HttpRequest serverDetail = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers/71752")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse serverDetailResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/server_details.json")).build();
-
- @Test
- public void testCreateNodeWithGeneratedKeyPair() throws Exception {
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .putAll(defaultTemplateOpenStack);
- requestResponseMap.put(list, notFound);
-
- requestResponseMap.put(createWithPrefixOnGroup, securityGroupCreated);
-
- requestResponseMap.put(createRuleForDefaultPort22, securityGroupRuleCreated);
-
- requestResponseMap.put(getSecurityGroup, securityGroupWithPort22);
-
- requestResponseMap.put(create, keyPairWithPrivateKey);
-
- requestResponseMap.put(serverDetail, serverDetailResponse);
-
- HttpRequest createServerWithGeneratedKeyPair = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-1\",\"imageRef\":\"14\",\"flavorRef\":\"1\"," +
- "\"metadata\":{\"jclouds-group\":\"test\"},\"key_name\":\"jclouds-test-0\",\"security_groups\":[{\"name\":\"jclouds-test\"}]}}",
- "application/json")).build();
-
- HttpResponse createdServer = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server.json", "application/json; charset=UTF-8")).build();
-
- requestResponseMap.put(createServerWithGeneratedKeyPair, createdServer);
-
- ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build(), new AbstractModule() {
-
- @Override
- protected void configure() {
- // predicatable node names
- final AtomicInteger suffix = new AtomicInteger();
- bind(new TypeLiteral<Supplier<String>>() {
- }).toInstance(new Supplier<String>() {
-
- @Override
- public String get() {
- return suffix.getAndIncrement() + "";
- }
-
- });
- }
-
- });
-
- NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
- blockUntilRunning(false).generateKeyPair(true)));
- assertNotNull(node.getCredentials().getPrivateKey());
- }
-
- @Test
- public void testCreateNodeWhileUserSpecifiesKeyPair() throws Exception {
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .putAll(defaultTemplateOpenStack);
- requestResponseMap.put(list, notFound);
-
- requestResponseMap.put(createWithPrefixOnGroup, securityGroupCreated);
-
- requestResponseMap.put(createRuleForDefaultPort22, securityGroupRuleCreated);
-
- requestResponseMap.put(getSecurityGroup, securityGroupWithPort22);
-
- requestResponseMap.put(serverDetail, serverDetailResponse);
-
- HttpRequest createServerWithSuppliedKeyPair = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-0\",\"imageRef\":\"14\",\"flavorRef\":\"1\"," +
- "\"metadata\":{\"jclouds-group\":\"test\"},\"key_name\":\"fooPair\",\"security_groups\":[{\"name\":\"jclouds-test\"}]}}",
- "application/json")).build();
-
- HttpResponse createdServer = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server.json", "application/json; charset=UTF-8")).build();
-
- requestResponseMap.put(createServerWithSuppliedKeyPair, createdServer);
-
- ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build(), new AbstractModule() {
-
- @Override
- protected void configure() {
- // predicatable node names
- final AtomicInteger suffix = new AtomicInteger();
- bind(new TypeLiteral<Supplier<String>>() {
- }).toInstance(new Supplier<String>() {
-
- @Override
- public String get() {
- return suffix.getAndIncrement() + "";
- }
-
- });
- }
-
- });
-
- NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
- keyPairName("fooPair").blockUntilRunning(false)));
- // we don't have access to this private key
- assertEquals(node.getCredentials().getPrivateKey(), null);
- }
-
-
- @Test
- public void testCreateNodeWhileUserSpecifiesKeyPairAndUserSpecifiedGroups() throws Exception {
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
- .putAll(defaultTemplateOpenStack);
- requestResponseMap.put(list, notFound);
-
- requestResponseMap.put(serverDetail, serverDetailResponse);
-
- HttpRequest createServerWithSuppliedKeyPairAndGroup = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"server\":{\"name\":\"test-0\",\"imageRef\":\"14\",\"flavorRef\":\"1\"," +
- "\"metadata\":{\"jclouds-group\":\"test\"},\"key_name\":\"fooPair\",\"security_groups\":[{\"name\":\"mygroup\"}]}}",
- "application/json")).build();
-
- HttpResponse createdServer = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
- .payload(payloadFromResourceWithContentType("/new_server.json", "application/json; charset=UTF-8")).build();
-
- requestResponseMap.put(createServerWithSuppliedKeyPairAndGroup, createdServer);
-
- ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build(), new AbstractModule() {
-
- @Override
- protected void configure() {
- // predicatable node names
- final AtomicInteger suffix = new AtomicInteger();
- bind(new TypeLiteral<Supplier<String>>() {
- }).toInstance(new Supplier<String>() {
-
- @Override
- public String get() {
- return suffix.getAndIncrement() + "";
- }
-
- });
- }
-
- });
-
- NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
- keyPairName("fooPair").securityGroupNames("mygroup").blockUntilRunning(false)));
- // we don't have access to this private key
- assertEquals(node.getCredentials().getPrivateKey(), null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java
deleted file mode 100644
index d20126c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute;
-
-import static java.util.logging.Logger.getAnonymousLogger;
-
-import java.util.Properties;
-
-import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
-import org.jclouds.openstack.nova.v2_0.config.NovaProperties;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.Test;
-
-import com.google.inject.Module;
-
-/**
- *
- * @author Adrian Cole
- */
-@Test(groups = "live", singleThreaded = true, testName = "NovaComputeServiceLiveTest")
-public class NovaComputeServiceLiveTest extends BaseComputeServiceLiveTest {
-
- public NovaComputeServiceLiveTest() {
- provider = "openstack-nova";
- }
-
- @Override
- protected Module getSshModule() {
- return new SshjSshClientModule();
- }
-
- @Override
- public void testOptionToNotBlock() {
- // start call is blocking anyway.
- }
-
- @Test(enabled = true, dependsOnMethods = "testReboot")
- public void testSuspendResume() throws Exception {
- try {
- // may fail because of lack of AdminActions extension or non-admin user, so log and continue
- super.testSuspendResume();
- } catch (AuthorizationException e) {
- getAnonymousLogger().info("testSuspendResume() threw, probably due to lack of privileges: " + e.getMessage());
- } catch (UnsupportedOperationException e) {
- getAnonymousLogger().info("testSuspendResume() threw, probably due to unavailable AdminActions extension: " + e.getMessage());
- }
- }
-
- @Test(enabled = true, dependsOnMethods = "testSuspendResume")
- @Override
- public void testGetNodesWithDetails() throws Exception {
- super.testGetNodesWithDetails();
- }
-
- @Test(enabled = true, dependsOnMethods = "testSuspendResume")
- @Override
- public void testListNodes() throws Exception {
- super.testListNodes();
- }
-
- @Test(enabled = true, dependsOnMethods = "testSuspendResume")
- @Override
- public void testListNodesByIds() throws Exception {
- super.testListNodesByIds();
- }
-
- @Test(enabled = true, dependsOnMethods = { "testListNodes", "testGetNodesWithDetails", "testListNodesByIds" })
- @Override
- public void testDestroyNodes() {
- super.testDestroyNodes();
- }
-
- @Override
- protected Properties setupProperties() {
- Properties props = super.setupProperties();
- setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
- setIfTestSystemPropertyPresent(props, NovaProperties.AUTO_ALLOCATE_FLOATING_IPS);
- return props;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionExpectTest.java
deleted file mode 100644
index afd289f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionExpectTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.extensions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageTemplate;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-import com.google.common.util.concurrent.Futures;
-
-/**
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "NovaImageExtensionExpectTest")
-public class NovaImageExtensionExpectTest extends BaseNovaComputeServiceExpectTest {
-
- @Override
- protected Properties setupProperties() {
- Properties overrides = super.setupProperties();
- overrides.setProperty("jclouds.zones", "az-1.region-a.geo-1");
- return overrides;
- }
-
- HttpRequest serverDetail = HttpRequest.builder().method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/71752")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse serverDetailResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/server_details.json")).build();
-
- HttpRequest createImage = HttpRequest.builder().method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/71752/action")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"createImage\":{\"name\":\"test\", \"metadata\": {}}}",
- "application/json")).build();
-
- HttpResponse createImageResponse = HttpResponse.builder().statusCode(202)
- .addHeader("Location", "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/52415800-8b69-11e0-9b19-734f5736d2a2")
- .build();
-
- HttpRequest getImage = HttpRequest.builder().method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/52415800-8b69-11e0-9b19-734f5736d2a2")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse getImageResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/image_active.json")).build();
-
- public void testCreateImage() {
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
- requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
- requestResponseMap.put(serverDetail, serverDetailResponse).build();
- requestResponseMap.put(createImage, createImageResponse).build();
- requestResponseMap.put(getImage, getImageResponse).build();
-
- ImageExtension apiThatCreatesImage = requestsSendResponses(requestResponseMap.build()).getImageExtension().get();
-
- ImageTemplate newImageTemplate = apiThatCreatesImage.buildImageTemplateFromNode("test", "az-1.region-a.geo-1/71752");
-
- Image image = Futures.getUnchecked(apiThatCreatesImage.createImage(newImageTemplate));
- assertEquals(image.getId(), "az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f5736d2a2");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionLiveTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionLiveTest.java
deleted file mode 100644
index 463ff55..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionLiveTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.extensions;
-
-import org.jclouds.compute.extensions.internal.BaseImageExtensionLiveTest;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.Test;
-
-import com.google.inject.Module;
-
-/**
- * Live test for openstack-nova {@link ImageExtension} implementation.
- *
- * @author David Alves
- *
- */
-@Test(groups = "live", singleThreaded = true, testName = "NovaImageExtensionLiveTest")
-public class NovaImageExtensionLiveTest extends BaseImageExtensionLiveTest {
-
- public NovaImageExtensionLiveTest() {
- provider = "openstack-nova";
- }
-
- @Override
- protected Module getSshModule() {
- return new SshjSshClientModule();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionExpectTest.java
deleted file mode 100644
index 809b4da..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionExpectTest.java
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.Properties;
-import java.util.Set;
-
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.compute.extensions.SecurityGroupExtension;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.net.domain.IpProtocol;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.LinkedHashMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
-
-/**
- *
- * @author Andrew Bayer
- */
-@Test(groups = "unit", testName = "NovaSecurityGroupExtensionExpectTest")
-public class NovaSecurityGroupExtensionExpectTest extends BaseNovaComputeServiceExpectTest {
-
- protected String zone = "az-1.region-a.geo-1";
- protected HttpRequest list = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- protected HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_list_extension.json")).build();
-
- @Override
- protected Properties setupProperties() {
- Properties overrides = super.setupProperties();
- overrides.setProperty("jclouds.zones", zone);
- return overrides;
- }
-
- public void testListSecurityGroups() {
-
-
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
- requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
- requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
- requestResponseMap.put(list, listResponse).build();
-
- SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
-
- Set<SecurityGroup> groups = extension.listSecurityGroups();
- assertEquals(groups.size(), 1);
- }
-
- public void testListSecurityGroupsInLocation() {
- HttpRequest list = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_list.json")).build();
-
-
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
- requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
- requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
- requestResponseMap.put(list, listResponse).build();
-
- SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
-
- Set<SecurityGroup> groups = extension.listSecurityGroupsInLocation(new LocationBuilder()
- .scope(LocationScope.ZONE)
- .id(zone)
- .description("zone")
- .build());
- assertEquals(groups.size(), 1);
- }
-
- public void testListSecurityGroupsForNode() {
- HttpRequest serverReq = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"))
- .headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse serverResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/server_with_security_groups_extension.json")).build();
-
- HttpRequest list = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_list.json")).build();
-
-
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
- requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
- requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
- requestResponseMap.put(serverReq, serverResponse);
- requestResponseMap.put(list, listResponse).build();
-
- SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
-
- Set<SecurityGroup> groups = extension.listSecurityGroupsForNode(zone + "/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
- assertEquals(groups.size(), 1);
- }
-
- public void testGetSecurityGroupById() {
- HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension.json")).build();
-
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
- requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
- requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
- requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse);
- requestResponseMap.put(list, listResponse).build();
-
- SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
-
- SecurityGroup group = extension.getSecurityGroupById(zone + "/160");
- assertEquals(group.getId(), zone + "/160");
- }
-
- public void testCreateSecurityGroup() {
- HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension.json")).build();
-
- HttpRequest create = HttpRequest.builder().method("POST").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build())
- .payload(
- payloadFromStringWithContentType(
- "{\"security_group\":{\"name\":\"jclouds-test\",\"description\":\"jclouds-test\"}}",
- "application/json")).build();
-
- HttpResponse createResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_created.json")).build();
-
- HttpRequest list = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
- ImmutableMultimap.<String, String>builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_list_extension.json")).build();
-
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
- requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
- requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
- requestResponseMap.put(create, createResponse);
- requestResponseMap.put(list, listResponse);
- requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse).build();
-
- SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
-
- SecurityGroup group = extension.createSecurityGroup("test", new LocationBuilder()
- .scope(LocationScope.ZONE)
- .id(zone)
- .description("zone")
- .build());
- assertEquals(group.getId(), zone + "/160");
- }
-
- public void testRemoveSecurityGroup() {
- HttpRequest delete = HttpRequest.builder().method("DELETE").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160"))
- .headers(
- ImmutableMultimap.<String, String>builder().put("Accept", "application/json")
- .put("X-Auth-Token", authToken).build()).build();
-
- HttpResponse deleteResponse = HttpResponse.builder().statusCode(202).build();
-
- HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension.json")).build();
-
- Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
- requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
- requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
- requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse);
- requestResponseMap.put(delete, deleteResponse).build();
-
- SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
-
- assertTrue(extension.removeSecurityGroup(zone + "/160"), "Expected removal of securitygroup to be successful");
- }
-
- public void testAddIpPermissionCidrFromIpPermission() {
- HttpRequest createRule = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"security_group_rule\":{\"parent_group_id\":\"160\",\"cidr\":\"10.2.6.0/24\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
- "application/json")).build();
-
- HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygrouprule_created_cidr.json")).build();
-
- HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse getSecurityGroupNoRulesResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension_norules.json")).build();
-
- HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension.json")).build();
-
-
- SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
- extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
- ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
- createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();
-
- IpPermission.Builder builder = IpPermission.builder();
-
- builder.ipProtocol(IpProtocol.TCP);
- builder.fromPort(22);
- builder.toPort(22);
- builder.cidrBlock("10.2.6.0/24");
-
- IpPermission perm = builder.build();
-
- SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");
-
- assertNotNull(origGroup);
- SecurityGroup newGroup = extension.addIpPermission(perm, origGroup);
-
- assertNotNull(newGroup);
- }
-
- public void testAddIpPermissionCidrFromParams() {
- HttpRequest createRule = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"security_group_rule\":{\"parent_group_id\":\"160\",\"cidr\":\"10.2.6.0/24\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
- "application/json")).build();
-
- HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygrouprule_created_cidr.json")).build();
-
- HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse getSecurityGroupNoRulesResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension_norules.json")).build();
-
- HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension.json")).build();
-
-
- SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
- extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
- ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
- createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();
-
- SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");
-
- assertNotNull(origGroup);
- SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
- 22,
- 22,
- emptyMultimap(),
- ImmutableSet.of("10.2.6.0/24"),
- emptyStringSet(),
- origGroup);
-
- assertNotNull(newGroup);
- }
-
- public void testAddIpPermissionGroupFromIpPermission() {
- HttpRequest createRule = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"security_group_rule\":{\"group_id\":\"11111\",\"parent_group_id\":\"160\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
- "application/json")).build();
-
- HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygrouprule_created_group.json")).build();
-
- HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse getSecurityGroupNoRulesResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension_norules.json")).build();
-
- HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension.json")).build();
-
-
- SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
- extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
- ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
- createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();
-
- IpPermission.Builder builder = IpPermission.builder();
-
- builder.ipProtocol(IpProtocol.TCP);
- builder.fromPort(22);
- builder.toPort(22);
- builder.groupId("admin/11111");
-
- IpPermission perm = builder.build();
-
- SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");
-
- assertNotNull(origGroup);
- SecurityGroup newGroup = extension.addIpPermission(perm, origGroup);
-
- assertNotNull(newGroup);
- }
-
- public void testAddIpPermissionGroupFromParams() {
- HttpRequest createRule = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(
- payloadFromStringWithContentType(
- "{\"security_group_rule\":{\"group_id\":\"11111\",\"parent_group_id\":\"160\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
- "application/json")).build();
-
- HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygrouprule_created_group.json")).build();
-
- HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse getSecurityGroupNoRulesResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension_norules.json")).build();
-
- HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/securitygroup_details_extension.json")).build();
-
-
- SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
- extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
- ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
- createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();
-
- SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");
-
- assertNotNull(origGroup);
- SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
- 22,
- 22,
- emptyMultimap(),
- emptyStringSet(),
- ImmutableSet.of("admin/11111"),
- origGroup);
-
- assertNotNull(newGroup);
- }
-
- private Multimap<String, String> emptyMultimap() {
- return LinkedHashMultimap.create();
- }
-
- private Set<String> emptyStringSet() {
- return Sets.newLinkedHashSet();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionLiveTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionLiveTest.java
deleted file mode 100644
index 4a7dbed..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionLiveTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.extensions;
-
-import org.jclouds.compute.extensions.internal.BaseSecurityGroupExtensionLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * Live test for openstack-nova {@link org.jclouds.compute.extensions.SecurityGroupExtension} implementation.
- *
- * @author Andrew Bayer
- *
- */
-@Test(groups = "live", singleThreaded = true, testName = "NovaSecurityGroupExtensionLiveTest")
-public class NovaSecurityGroupExtensionLiveTest extends BaseSecurityGroupExtensionLiveTest {
-
- public NovaSecurityGroupExtensionLiveTest() {
- provider = "openstack-nova";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java
deleted file mode 100644
index a5631ca..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.net.URI;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadata.Status;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.Atomics;
-
-/**
- * Tests the compute service abstraction of the nova api.
- *
- * @author Matt Stephenson
- */
-@Test(groups = "unit", testName = "AllocateAndAddFloatingIpToNodeTest")
-public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeServiceExpectTest {
- final Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova").description(
- "openstack-nova").build();
- final Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1").scope(
- LocationScope.ZONE).parent(provider).build();
- final Location host = new LocationBuilder().scope(LocationScope.HOST).id("hostId").description("hostId")
- .parent(zone).build();
- final NodeMetadata node = new NodeMetadataBuilder().id("az-1.region-a.geo-1/71592").providerId("71592").location(
- host).name("Server 71592").status(Status.RUNNING).privateAddresses(ImmutableSet.of("10.4.27.237"))
- .credentials(LoginCredentials.builder().password("foo").build()).build();
-
- HttpRequest createFloatingIP = HttpRequest.builder().method("POST").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).payload(payloadFromStringWithContentType("{}", "application/json")).build();
-
- HttpResponse addFloatingIPResponse = HttpResponse.builder().statusCode(200).build();
-
- public void testAllocateWhenAllocationReturnsIpIsAddedToServerAndUpdatesNodeMetadataButSavesCredentials() throws Exception {
- HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/floatingip_details.json")).build();
-
- HttpRequest addFloatingIPRequest = addFloatingIPForAddress("10.0.0.3");
-
- AllocateAndAddFloatingIpToNode fn = requestsSendResponses(
- ImmutableMap.<HttpRequest, HttpResponse> builder().put(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess).put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(
- createFloatingIP, createFloatingIPResponse)
- .put(addFloatingIPRequest, addFloatingIPResponse).build()).getContext().utils().injector()
- .getInstance(AllocateAndAddFloatingIpToNode.class);
-
- AtomicReference<NodeMetadata> nodeRef = Atomics.newReference(node);
- fn.apply(nodeRef);
- NodeMetadata node1 = nodeRef.get();
- assertNotNull(node1);
- assertEquals(node1.getPublicAddresses(), ImmutableSet.of("10.0.0.3"));
- assertEquals(node1.getCredentials(), node.getCredentials());
-
- }
-
- private HttpRequest addFloatingIPForAddress(String address) {
- HttpRequest addFloatingIPRequest = HttpRequest.builder().method("POST").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/71592/action"))
- .headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "*/*")
- .put("X-Auth-Token", authToken).build()).payload(
- payloadFromStringWithContentType("{\"addFloatingIp\":{\"address\":\"" + address + "\"}}",
- "application/json")).build();
- return addFloatingIPRequest;
- }
-
- public void testAllocateWhenAllocationFailsLookupUnusedIpAddToServerAndUpdatesNodeMetadata() throws Exception {
- HttpResponse createFloatingIPResponse = HttpResponse
- .builder()
- .statusCode(400)
- .payload(
- payloadFromStringWithContentType(
- "{\"badRequest\": {\"message\": \"AddressLimitExceeded: Address quota exceeded. You cannot create any more addresses\", \"code\": 400}}",
- "application/json")).build();
-
- HttpRequest list = HttpRequest.builder().method("GET").endpoint(
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
- authToken).build()).build();
-
- HttpResponse listResponseForUnassigned = HttpResponse.builder().statusCode(200).payload(
- payloadFromResource("/floatingip_list.json")).build();
-
- HttpRequest addFloatingIPRequest = addFloatingIPForAddress("10.0.0.5");
-
- AllocateAndAddFloatingIpToNode fn = requestsSendResponses(
- ImmutableMap.<HttpRequest, HttpResponse> builder().put(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess).put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(
- createFloatingIP, createFloatingIPResponse)
- .put(addFloatingIPRequest, addFloatingIPResponse).put(list,
- listResponseForUnassigned).build()).getContext().utils().injector()
- .getInstance(AllocateAndAddFloatingIpToNode.class);
-
- AtomicReference<NodeMetadata> nodeRef = Atomics.newReference(node);
- fn.apply(nodeRef);
- NodeMetadata node1 = nodeRef.get();
- assertNotNull(node1);
- assertEquals(node1.getPublicAddresses(), ImmutableSet.of("10.0.0.5"));
-
- }
-}
[22/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
new file mode 100755
index 0000000..e26af7c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
@@ -0,0 +1,69 @@
+/*
+ * 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.vcloud.xml.ovf;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.ovf.NetworkSection;
+import org.jclouds.ovf.xml.NetworkSectionHandler;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+
+/**
+ * @author Adrian Cole
+ */
+public class VCloudNetworkSectionHandler extends ParseSax.HandlerWithResult<VCloudNetworkSection> {
+ private final NetworkSectionHandler networkSectionHandler;
+
+ @Inject
+ VCloudNetworkSectionHandler(NetworkSectionHandler networkSectionHandler) {
+ this.networkSectionHandler = networkSectionHandler;
+ }
+
+ private ReferenceType net;
+
+ public VCloudNetworkSection getResult() {
+ NetworkSection system = networkSectionHandler.getResult();
+ return new VCloudNetworkSection(net.getType(), net.getHref(), system.getInfo(), system.getNetworks());
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (equalsOrSuffix(qName, "NetworkSection")) {
+ this.net = Utils.newReferenceType(attributes);
+ }
+ networkSectionHandler.startElement(uri, localName, qName, attrs);
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ networkSectionHandler.endElement(uri, localName, qName);
+ }
+
+ public void characters(char ch[], int start, int length) {
+ networkSectionHandler.characters(ch, start, length);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
new file mode 100755
index 0000000..981388e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
@@ -0,0 +1,81 @@
+/*
+ * 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.vcloud.xml.ovf;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+
+/**
+ * @author Adrian Cole
+ */
+public class VCloudOperatingSystemHandler extends ParseSax.HandlerWithResult<VCloudOperatingSystemSection> {
+ private StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType os;
+ protected Integer id;
+ protected String info;
+ protected String vmwOsType;
+ protected String description;
+ protected ReferenceType edit;
+
+ public VCloudOperatingSystemSection getResult() {
+ VCloudOperatingSystemSection system = new VCloudOperatingSystemSection(id, info, description, os.getType(), os.getHref(),
+ vmwOsType, edit);
+ os = null;
+ id = null;
+ info = null;
+ vmwOsType = null;
+ description = null;
+ edit = null;
+ return system;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Link")) {
+ this.edit = Utils.newReferenceType(attributes);
+ } else if (qName.endsWith("OperatingSystemSection")) {
+ os = newReferenceType(attributes);
+ vmwOsType = attributes.get("osType");
+ if (attributes.containsKey("id"))
+ this.id = Integer.parseInt(attributes.get("id"));
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (qName.endsWith("Info")) {
+ this.info = currentText.toString().trim();
+ } else if (qName.endsWith("Description")) {
+ this.description = currentText.toString().trim();
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
new file mode 100755
index 0000000..85d9d8b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
@@ -0,0 +1,89 @@
+/*
+ * 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.vcloud.xml.ovf;
+
+import java.util.Map;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.ovf.EditableResourceAllocationSettingData;
+import org.jclouds.vcloud.domain.ovf.VCloudHardDisk;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkAdapter;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+
+/**
+ * @author Adrian Cole
+ */
+public class VCloudResourceAllocationSettingDataHandler extends ResourceAllocationSettingDataHandler {
+
+ private ReferenceType edit;
+
+ private long capacity;
+ private int busType;
+ private String busSubType;
+
+ private String ipAddress;
+ private boolean primaryNetworkConnection;
+ private String ipAddressingMode;
+
+ public ResourceAllocationSettingData getResult() {
+ try {
+ ResourceAllocationSettingData from = super.getResult();
+ if (edit != null) {
+ return EditableResourceAllocationSettingData.builder().fromResourceAllocationSettingData(from).edit(edit)
+ .build();
+ } else if (busSubType != null) {
+ return VCloudHardDisk.builder().fromResourceAllocationSettingData(from).capacity(capacity).busType(busType)
+ .busSubType(busSubType).build();
+ } else if (ipAddress != null) {
+ return VCloudNetworkAdapter.builder().fromResourceAllocationSettingData(from).ipAddress(ipAddress)
+ .primaryNetworkConnection(primaryNetworkConnection).ipAddressingMode(ipAddressingMode).build();
+ } else {
+ return from;
+ }
+ } finally {
+ ipAddress = null;
+ primaryNetworkConnection = false;
+ ipAddressingMode = null;
+ capacity = -1;
+ busType = -1;
+ busSubType = null;
+ edit = null;
+ }
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Link")) {
+ this.edit = Utils.newReferenceType(attributes);
+ } else if (qName.endsWith("HostResource") && attributes.size() > 0) {
+ capacity = Long.parseLong(attributes.get("capacity"));
+ busType = Integer.parseInt(attributes.get("busType"));
+ busSubType = attributes.get("busSubType");
+ } else if (qName.endsWith("Connection") && attributes.size() > 0) {
+ ipAddress = attributes.get("ipAddress");
+ primaryNetworkConnection = Boolean.parseBoolean(attributes.get("primaryNetworkConnection"));
+ ipAddressingMode = attributes.get("ipAddressingMode");
+ }
+ super.startElement(uri, localName, qName, attrs);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
new file mode 100755
index 0000000..d800a94
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
@@ -0,0 +1 @@
+org.jclouds.vcloud.VCloudApiMetadata
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
new file mode 100755
index 0000000..7840801
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.vcloud;
+
+import org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "VCloudApiMetadataTest")
+public class VCloudApiMetadataTest extends BaseComputeServiceApiMetadataTest {
+
+ public VCloudApiMetadataTest() {
+ super(new VCloudApiMetadata());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
new file mode 100755
index 0000000..9578c64
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.vcloud;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.utils.TestUtils;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code VCloudApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VCloudApiTest")
+public class VCloudApiTest extends BaseVCloudApiTest<VCloudApi> {
+
+ private VCloudApi syncClient;
+
+ public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
+ assert syncClient.getVAppApi() != null;
+ assert syncClient.getCatalogApi() != null;
+ assert syncClient.getVmApi() != null;
+ assert syncClient.getVAppTemplateApi() != null;
+ assert syncClient.getTaskApi() != null;
+ assert syncClient.getVDCApi() != null;
+ assert syncClient.getNetworkApi() != null;
+ assert syncClient.getOrgApi() != null;
+ }
+
+ @BeforeClass
+ @Override
+ protected void setupFactory() throws IOException {
+ super.setupFactory();
+ syncClient = injector.getInstance(VCloudApi.class);
+ }
+
+ @DataProvider
+ public Object[][] ignoreOnWindows() {
+ return TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS
+ : TestUtils.SINGLE_NO_ARG_INVOCATION;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
new file mode 100755
index 0000000..7c1221d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.vcloud;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * Tests session refresh works
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", singleThreaded = true)
+public class VCloudSessionRefreshLiveTest extends BaseVCloudApiLiveTest {
+
+ private static final int timeOut = 40;
+
+ @Test
+ public void testSessionRefresh() throws Exception {
+ VCloudApi connection = view.unwrapApi(VCloudApi.class);
+
+ connection.getOrgApi().findOrgNamed(null);
+ Thread.sleep(timeOut * 1000);
+ connection.getOrgApi().findOrgNamed(null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
new file mode 100755
index 0000000..569903d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.vcloud;
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.xml.SupportedVersionsHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+
+/**
+ * Tests behavior of {@code VCloudVersionsApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudVersionsApiTest")
+public class VCloudVersionsApiTest extends BaseAsyncClientTest<VCloudVersionsApi> {
+
+ public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VCloudVersionsApi.class, "getSupportedVersions");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, SupportedVersionsHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ }
+
+ @Override
+ protected ProviderMetadata createProviderMetadata() {
+ return AnonymousProviderMetadata.forApiOnEndpoint(VCloudVersionsApi.class,
+ "http://localhost:8080");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
new file mode 100755
index 0000000..93ea7cb
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests behavior of {@code BindCatalogItemToXmlPayload}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindCatalogItemToXmlPayloadTest extends BasePayloadTest {
+
+ public void testDefault() throws IOException {
+ String expected = "<CatalogItem xmlns=\"http://www.vmware.com/vcloud/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" name=\"myname\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd\"><Description>mydescription</Description><Entity href=\"http://fooentity\"/><Property key=\"foo\">bar</Property></CatalogItem>";
+
+ CatalogItemOptions options = CatalogItemOptions.Builder.description("mydescription").properties(
+ ImmutableMap.of("foo", "bar"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCatalogItemToXmlPayload binder = injector.getInstance(BindCatalogItemToXmlPayload.class);
+
+ Map<String, Object> map = ImmutableMap.<String, Object> of("name", "myname", "Entity", "http://fooentity");
+
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..6fbcd8d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * Tests behavior of {@code BindCloneVAppParamsToXmlPayload}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindCloneVAppParamsToXmlPayloadTest extends BasePayloadTest {
+
+ public void testWithDescriptionDeployOn() throws Exception {
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp.xml"));
+
+ CloneVAppOptions options = new CloneVAppOptions().deploy().powerOn().description(
+ "The description of the new vApp");
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCloneVAppParamsToXmlPayload binder = injector.getInstance(BindCloneVAppParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "new-linux-server");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vapp/201");
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+
+ public void testWithDescriptionDeployOnSourceDelete() throws Exception {
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVApp.xml"));
+
+ CloneVAppOptions options = new CloneVAppOptions().deploy().powerOn().description(
+ "The description of the new vApp");
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCloneVAppParamsToXmlPayload binder = injector.getInstance(BindCloneVAppParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "new-linux-server");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vapp/201");
+ map.put("IsSourceDelete", "true");
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+
+ public void testDefault() throws Exception {
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp-default.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindCloneVAppParamsToXmlPayload binder = injector.getInstance(BindCloneVAppParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "my-vapp");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vapp/4181");
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..e309e67
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.jclouds.util.Strings2.toStringAndClose;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * Tests behavior of {@code BindCloneVAppTemplateParamsToXmlPayload}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindCloneVAppTemplateParamsToXmlPayloadTest extends BasePayloadTest {
+ public void testWithDescription() throws IOException {
+ String expected = toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate.xml"));
+
+ CloneVAppTemplateOptions options = new CloneVAppTemplateOptions()
+ .description("The description of the new vAppTemplate");
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCloneVAppTemplateParamsToXmlPayload binder = injector
+ .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "new-linux-server");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201");
+
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+
+ public void testWithDescriptionSourceDelete() throws IOException {
+ String expected = toStringAndClose(getClass().getResourceAsStream("/moveVAppTemplate.xml"));
+
+ CloneVAppTemplateOptions options = new CloneVAppTemplateOptions()
+ .description("The description of the new vAppTemplate");
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCloneVAppTemplateParamsToXmlPayload binder = injector
+ .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "new-linux-server");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201");
+ map.put("IsSourceDelete", "true");
+
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+
+ public void testDefault() throws IOException {
+ String expected = toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate-default.xml"));
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindCloneVAppTemplateParamsToXmlPayload binder = injector
+ .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "my-vapptemplate");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181");
+
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..d943b37
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
+
+/**
+ * Tests behavior of {@code BindDeployVAppParamsToXmlPayload}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindDeployVAppParamsToXmlPayloadTest extends BasePayloadTest {
+
+ public void testPowerOnTrue() throws IOException {
+ String expected = "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>";
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindDeployVAppParamsToXmlPayload binder = injector.getInstance(BindDeployVAppParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("powerOn", "true");
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testDefault() throws IOException {
+ String expected = "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>";
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindDeployVAppParamsToXmlPayload binder = injector.getInstance(BindDeployVAppParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..b937c85
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.replay;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.nnsoft.guice.rocoto.Rocoto;
+import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+
+/**
+ * Tests behavior of {@code BindInstantiateVAppTemplateParamsToXmlPayload}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindInstantiateVAppTemplateParamsToXmlPayloadTest extends BasePayloadTest {
+ Injector createInjector(final URI vAppTemplate, final VAppTemplate value) {
+
+ return Guice.createInjector(Rocoto.expandVariables(new ConfigurationModule() {
+
+ @Provides
+ @Singleton
+ @Network
+ protected Function<VAppTemplate, String> templateToDefaultNetworkName() {
+ return Functions.forMap(ImmutableMap.of(value, "vAppNet-vApp Internal"));
+ }
+
+ @Provides
+ @Singleton
+ protected LoadingCache<URI, VAppTemplate> templateIdToVAppTemplate() {
+ return CacheBuilder.newBuilder().build(
+ CacheLoader.from(Functions.forMap(ImmutableMap.of(vAppTemplate, value))));
+ }
+
+ @Override
+ protected void bindConfigurations() {
+ bindProperties(new VCloudApiMetadata().getDefaultProperties());
+ }
+
+ @Provides
+ @Singleton
+ public FenceMode defaultFenceMode(@Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
+ return FenceMode.fromValue(fenceMode);
+ }
+
+ @Network
+ @Provides
+ @Singleton
+ Supplier<ReferenceType> provideNetwork() {
+ return Suppliers.<ReferenceType>ofInstance(new ReferenceTypeImpl(null, null, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/1990")));
+ }
+ }));
+ }
+
+ public void testDefault() throws IOException {
+ URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+ VAppTemplate template = createMock(VAppTemplate.class);
+ replay(template);
+
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(new InstantiateVAppTemplateOptions()));
+
+ BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+ BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("name", "my-vapp");
+ map.put("template", templateUri.toASCIIString());
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testDescription() throws IOException {
+ URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+ VAppTemplate template = createMock(VAppTemplate.class);
+ replay(template);
+
+ String expected = Strings2.toStringAndClose(getClass()
+ .getResourceAsStream("/instantiationparams-description.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(new InstantiateVAppTemplateOptions().description("my foo")));
+
+ BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+ BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("name", "my-vapp");
+ map.put("template", templateUri.toASCIIString());
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testWhenTemplateDoesntExist() throws IOException {
+ URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+ VAppTemplate template = createMock(VAppTemplate.class);
+ replay(template);
+
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+ BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("name", "my-vapp");
+ map.put("template", templateUri.toASCIIString());
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testWithNetworkNameFenceMode() throws IOException {
+ URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+ VAppTemplate template = createMock(VAppTemplate.class);
+ replay(template);
+
+ InstantiateVAppTemplateOptions options = addNetworkConfig(new NetworkConfig("aloha", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED));
+
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams-network.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+ BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("name", "my-vapp");
+ map.put("template", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
new file mode 100755
index 0000000..d207fb0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code BindNetworkConnectionSectionToXmlPayload}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "BindNetworkConnectionSectionToXmlPayloadTest")
+public class BindNetworkConnectionSectionToXmlPayloadTest extends BasePayloadTest {
+
+ public void testWithIpAllocationModeNONE() throws IOException {
+
+ HttpRequest request = HttpRequest.builder().endpoint("http://localhost/key").method("GET")
+ .build();
+
+ BindNetworkConnectionSectionToXmlPayload binder = injector
+ .getInstance(BindNetworkConnectionSectionToXmlPayload.class);
+
+ binder.bindToRequest(
+ request,
+ NetworkConnectionSection
+ .builder()
+ .type("application/vnd.vmware.vcloud.networkConnectionSection+xml")
+ .info("Specifies the available VM network connections")
+ .href(URI.create("https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"))
+ .connections(
+ ImmutableSet.<NetworkConnection> of(NetworkConnection.builder().network("none")
+ .ipAddressAllocationMode(IpAddressAllocationMode.NONE).build())).build());
+ assertEquals(request.getPayload().getContentMetadata().getContentType(),
+ "application/vnd.vmware.vcloud.networkConnectionSection+xml");
+
+ assertEquals(
+ request.getPayload().getRawContent(),
+ "<NetworkConnectionSection xmlns=\"http://www.vmware.com/vcloud/v1\" xmlns:ovf=\"http://schemas.dmtf.org/ovf/envelope/1\" href=\"https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/\" ovf:required=\"false\" type=\"application/vnd.vmware.vcloud.networkConnectionSection+xml\"><ovf:Info>Specifies the available VM network connections</ovf:Info><NetworkConnection network=\"none\"><NetworkConnectionIndex>0</NetworkConnectionIndex><IsConnected>false</IsConnected><IpAddressAllocationMode>NONE</IpAddressAllocationMode></NetworkConnection></NetworkConnectionSection>");
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..4f4a115
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
+
+/**
+ * Tests behavior of {@code BindUndeployVAppParamsToXmlPayload}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindUndeployVAppParamsToXmlPayloadTest extends BasePayloadTest {
+
+ public void testSaveStateTrue() throws IOException {
+ String expected = "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>";
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindUndeployVAppParamsToXmlPayload binder = injector.getInstance(BindUndeployVAppParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("saveState", "true");
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testDefault() throws IOException {
+ String expected = "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>";
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindUndeployVAppParamsToXmlPayload binder = injector.getInstance(BindUndeployVAppParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
new file mode 100755
index 0000000..bc4be3a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
@@ -0,0 +1,160 @@
+/*
+ * 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.vcloud.compute;
+
+import java.net.URI;
+import java.util.Properties;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+
+import com.google.common.base.Function;
+import com.google.common.net.HttpHeaders;
+import com.google.inject.Module;
+
+/**
+ * Base class for writing VCloud Expect tests for ComputeService operations
+ *
+ * @author Adrian Cole
+ */
+public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientExpectTest<ComputeService> {
+ protected static final String ENDPOINT = "https://zone.myvcloud.com/api";
+
+ protected HttpRequest versionsRequest = HttpRequest.builder().method("GET").endpoint(
+ URI.create(ENDPOINT + "/versions")).addHeader(HttpHeaders.ACCEPT, "*/*").build();
+
+ protected HttpResponse versionsResponseFromVCD1_5 = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/versions-vcd15.xml", "text/xml"))
+ .build();
+
+ // initial auth is using basic
+ protected HttpRequest version1_0LoginRequest = HttpRequest.builder().method("POST").endpoint(ENDPOINT + "/v1.0/login")
+ .addHeader(HttpHeaders.ACCEPT, "application/vnd.vmware.vcloud.session+xml;version=1.0")
+ .addHeader(HttpHeaders.AUTHORIZATION, "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build();
+
+ protected String sessionToken = "AtatAgvJMrwOc9pDQq4RRCRLazThpnTKJDxSVH9oB2I=";
+
+ // login response includes a cookie and also a vcloud extended header with the session token in it
+ // NOTE: vCloud Director 1.5 returns ;version=1.0 on responses to requests made in 1.0 format.
+ protected HttpResponse successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/orgList1.0-vcd15.xml", VCloudMediaType.ORGLIST_XML +";version=1.0"))
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.SET_COOKIE, String.format("vcloud-token=%s; Secure; Path=/", sessionToken)).build();
+
+ // objects are looked up by id and the format of the id is hex-hyphen
+ protected String orgId = "c076f90a-397a-49fa-89b8-b294c1599cd0";
+
+ protected HttpRequest version1_0GetOrgRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/org/" + orgId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.ORG_XML+";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/org1.0-vcd15.xml", VCloudMediaType.ORG_XML +";version=1.0"))
+ .build();
+
+ protected String catalogId = "3155f393-1e1d-4572-8c9c-d76f72ddb658";
+ protected String vdcId = "e9cd3387-ac57-4d27-a481-9bee75e0690f";
+
+ protected HttpRequest version1_0GetCatalogRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/catalog/" + catalogId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.CATALOG_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalog1.0-vcd15.xml", VCloudMediaType.CATALOG_XML +";version=1.0"))
+ .build();
+
+ protected String catalogItemId = "ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c";
+
+ protected HttpRequest version1_0GetCatalogItemRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/catalogItem/" + catalogItemId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.CATALOGITEM_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalogItem1.0-vcd15.xml", VCloudMediaType.CATALOGITEM_XML +";version=1.0"))
+ .build();
+
+ // note vAppTemplate has a prefix in its id
+ protected String templateId = "vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728";
+
+ protected HttpRequest version1_0GetVDCRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.VDC_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/vdc1.0-vcd15.xml", VCloudMediaType.VDC_XML +";version=1.0"))
+ .build();
+
+ protected String networkId = "b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1";
+
+ protected HttpRequest version1_0GetVAppTemplateRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vAppTemplate/" + templateId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.VAPPTEMPLATE_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15.xml", VCloudMediaType.VAPPTEMPLATE_XML +";version=1.0"))
+ .build();
+
+ protected HttpResponse successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithMultipleVMsAndVDCParent = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15-multi-vm.xml", VCloudMediaType.VAPPTEMPLATE_XML +";version=1.0"))
+ .build();
+
+ protected HttpRequest version1_0GetOVFForVAppTemplateRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vAppTemplate/" + templateId + "/ovf")
+ .addHeader(HttpHeaders.ACCEPT, MediaType.TEXT_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-ubuntu64.xml", MediaType.TEXT_XML +";version=1.0"))
+ .build();
+
+ protected HttpResponse successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithMultipleVMs = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-multi-vm.xml", MediaType.TEXT_XML +";version=1.0"))
+ .build();
+
+ public BaseVCloudComputeServiceExpectTest() {
+ provider = "vcloud";
+ }
+
+ @Override
+ public ComputeService createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
+ return createInjector(fn, module, props).getInstance(ComputeService.class);
+ }
+
+ @Override
+ protected ApiMetadata createApiMetadata() {
+ return new VCloudApiMetadata();
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties props = super.setupProperties();
+ props.setProperty(provider + ".endpoint", ENDPOINT);
+ return props;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
new file mode 100755
index 0000000..2abd06d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.vcloud.compute;
+
+import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.testng.annotations.Test;
+
+import com.google.inject.Module;
+
+/**
+ *
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true)
+public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
+
+ public VCloudComputeServiceLiveTest() {
+ provider = "vcloud";
+ }
+
+ @Override
+ public void setServiceDefaults() {
+ // extremely short names needed so that we don't get errors relating to
+ // guestCustomization.computerName being too long
+ group = "vcd";
+ }
+
+ @Override
+ public void testOptionToNotBlock() {
+ // start call has to block until deploy
+ }
+
+ @Override
+ protected Module getSshModule() {
+ return new SshjSshClientModule();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
new file mode 100755
index 0000000..39ae435
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code FindLocationForResource}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class FindLocationForResourceTest {
+ public void testMatchWhenIdIsHref() {
+ Location location = new LocationBuilder().id("http://foo").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ FindLocationForResource converter = new FindLocationForResource(
+ Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(location)));
+ assertEquals(converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo"))), location);
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testGracefulWhenHrefIsntLocationId() {
+ FindLocationForResource converter = new FindLocationForResource(
+ Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(new LocationBuilder()
+ .id("http://bar").description("description").scope(LocationScope.PROVIDER).build())));
+ converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo")));
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testGracefulWhenLocationIdIsntURI() {
+ FindLocationForResource converter = new FindLocationForResource(
+ Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(new LocationBuilder().id("1")
+ .description("description").scope(LocationScope.PROVIDER).build())));
+ converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
new file mode 100755
index 0000000..f95b192
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.jclouds.cim.OSType;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.CIMOperatingSystem;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.location.suppliers.all.JustProvider;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(singleThreaded = true, testName = "ListImagesInVCloudExpectTest")
+public class ListImagesInVCloudExpectTest extends BaseVCloudComputeServiceExpectTest {
+
+ public void testListImagesUsingVCloud1_0ApiOnServerRunningVCloudDirector1_5ReturnsImageWithLocationForVAppTemplateInVDC() throws Exception {
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse>builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+ .build());
+
+ Location provider = Iterables.getOnlyElement(compute.getContext().utils().injector().getInstance(JustProvider.class).get());
+
+ Location orgLocation = new LocationBuilder().id(ENDPOINT + "/v1.0/org/" + orgId).scope(LocationScope.REGION)
+ .description("jclouds").parent(provider).build();
+
+ Location vdcLocation = new LocationBuilder().id(ENDPOINT + "/v1.0/vdc/" + vdcId).scope(LocationScope.ZONE)
+ .description("orgVDC-jclouds-Tier1-PAYG").parent(orgLocation).build();
+
+ Set<? extends Image> currentImages = compute.listImages();
+ assertEquals(compute.listImages().size(), 1);
+ Image onlyImage = Iterables.get(currentImages, 0);
+
+
+ Image expectedImage = new ImageBuilder()
+ .ids(ENDPOINT + "/v1.0/vAppTemplate/" + templateId)
+ .uri(URI.create(ENDPOINT + "/v1.0/vAppTemplate/" + templateId))
+ .name("UbuntuServer-x64-2GB")
+ .operatingSystem(new CIMOperatingSystem(OSType.UBUNTU_64, "", null, "Ubuntu Linux (64-bit)"))
+ // TODO: this looks like a bug, as it says network interfaces
+ .description("This is a special place-holder used for disconnected network interfaces.")
+ .defaultCredentials(LoginCredentials.builder().identity("root").build())
+ .status(Image.Status.AVAILABLE)
+ .location(vdcLocation).build();
+
+ assertEquals(onlyImage, expectedImage);
+ assertEquals(onlyImage.getStatus(), Image.Status.AVAILABLE);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
new file mode 100755
index 0000000..32bb50d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
@@ -0,0 +1,228 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.io.InputStream;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.inject.Singleton;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.domain.Credentials;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.compute.config.VCloudComputeServiceDependenciesModule;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.internal.VAppImpl;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+import com.google.inject.name.Names;
+
+/**
+ * Tests behavior of {@code VAppToNodeMetadata}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class VAppToNodeMetadataTest {
+
+ public Injector createInjectorWithLocation(final Location location) {
+ return Guice.createInjector(new SaxParserModule(), new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ Names.bindProperties(binder(), new VCloudApiMetadata().getDefaultProperties());
+ bind(new TypeLiteral<Function<ReferenceType, Location>>() {
+ }).to(new TypeLiteral<FindLocationForResource>() {
+ });
+ bind(new TypeLiteral<Function<VApp, Hardware>>() {
+ }).to(new TypeLiteral<HardwareForVApp>() {
+ });
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ }
+
+ @Memoized
+ @Singleton
+ @Provides
+ Supplier<Set<? extends Location>> supplyLocations() {
+ return Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(location));
+ }
+
+ @Singleton
+ @Provides
+ Map<String, Credentials> supplyCreds() {
+ return Maps.newConcurrentMap();
+ }
+
+ @Singleton
+ @Provides
+ protected Map<Status, NodeMetadata.Status> provideVAppStatusToNodeStatus() {
+ return VCloudComputeServiceDependenciesModule.toPortableNodeStatus;
+ }
+
+ });
+ }
+
+ public void testWhenVDCIsLocation() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getUserMetadata(), ImmutableMap.<String, String>of());
+ assertEquals(node.getTags(), ImmutableSet.<String>of());
+ assertEquals(node.getLocation(), location);
+ assertEquals(node.getPrivateAddresses(), ImmutableSet.of("172.16.7.230"));
+ assertEquals(node.getPublicAddresses(), ImmutableSet.of());
+ }
+
+ public void testWithMetadataParseException() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of();
+ ImmutableSet<String> tags = ImmutableSet.<String>of();
+
+ String description = " user=user_ssoid_1\nuid=3b7bb605-bb30-4e62-a3de-9076b052dee7 label='foo-DEVELOPMENT' date=2013-01-22 17:39:28.252";
+
+ result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+ description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+ result.getNetworkSection());
+
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getUserMetadata(), metadata);
+ assertEquals(node.getTags(), tags);
+ }
+
+ public void testWithMetadataNoNewLines() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of();
+ ImmutableSet<String> tags = ImmutableSet.<String>of();
+
+ String description = " user=user_ssoid_1 uid=3b7bb605-bb30-4e62-a3de-9076b052dee7 label='foo-DEVELOPMENT' date=2013-01-22 17:39:28.252";
+
+ result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+ description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+ result.getNetworkSection());
+
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getUserMetadata(), metadata);
+ assertEquals(node.getTags(), tags);
+ }
+
+ public void testWithEncodedMetadata() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of("foo", "bar");
+ ImmutableSet<String> tags = ImmutableSet.<String>of("tag1", "tag2");
+
+ String description = Joiner
+ .on('\n')
+ .withKeyValueSeparator("=")
+ .join(ImmutableMap.<String, String> builder().putAll(metadata)
+ .put("jclouds_tags", Joiner.on(',').join(tags)).build());
+
+ result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+ description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+ result.getNetworkSection());
+
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getUserMetadata(), metadata);
+ assertEquals(node.getTags(), tags);
+
+ }
+
+ public void testGracefulWhenNoIPs() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-none.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getLocation(), location);
+ assertEquals(node.getPrivateAddresses(), ImmutableSet.of());
+ assertEquals(node.getPublicAddresses(), ImmutableSet.of());
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testGracefulWhenVDCIsNotLocation() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/11111").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getLocation(), location);
+ }
+}
[06/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java
deleted file mode 100644
index f45826c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.features;
-
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
-import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.binders.BindMetadataToJsonPayload;
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-import org.jclouds.openstack.nova.v2_0.functions.internal.OnlyMetadataValueOrNull;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseImageDetails;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseImages;
-import org.jclouds.openstack.v2_0.domain.Resource;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Transform;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Images via the REST API.
- * <p/>
- *
- * @see ImageApi
- * @author Jeremy Daggett
- */
-@RequestFilters(AuthenticateRequest.class)
-public interface ImageAsyncApi {
-
- /**
- * @see ImageApi#list()
- */
- @Named("image:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/images")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseImages.class)
- @Transform(ParseImages.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends Resource>> list();
-
- /** @see ImageApi#list(PaginationOptions) */
- @Named("image:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/images")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseImages.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends Resource>> list(PaginationOptions options);
-
- /**
- * @see ImageApi#listInDetail()
- */
- @Named("image:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/images/detail")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseImageDetails.class)
- @Transform(ParseImageDetails.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends Image>> listInDetail();
-
- /** @see ImageApi#listInDetail(PaginationOptions) */
- @Named("image:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/images/detail")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseImageDetails.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends Image>> listInDetail(PaginationOptions options);
-
- /**
- * @see ImageApi#get
- */
- @Named("image:get")
- @GET
- @SelectJson("image")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/images/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Image> get(@PathParam("id") String id);
-
- /**
- * @see ImageApi#delete
- */
- @Named("image:delete")
- @DELETE
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/images/{id}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> delete(@PathParam("id") String id);
-
- /**
- * @see ImageApi#getMetadata
- */
- @Named("image:getmetadata")
- @GET
- @SelectJson("metadata")
- @Path("/images/{id}/metadata")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyMapOnNotFoundOr404.class)
- ListenableFuture<Map<String, String>> getMetadata(@PathParam("id") String id);
-
- /**
- * @see ImageApi#setMetadata
- */
- @Named("image:setmetadata")
- @PUT
- @SelectJson("metadata")
- @Path("/images/{id}/metadata")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(EmptyMapOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<Map<String, String>> setMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map<String, String> metadata);
-
- /**
- * @see ImageApi#updateMetadata
- */
- @Named("image:updatemetadata")
- @POST
- @SelectJson("metadata")
- @Path("/images/{id}/metadata")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(EmptyMapOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<? extends Map<String, String>> updateMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map<String, String> metadata);
-
- /**
- * @see ImageApi#getMetadata
- */
- @Named("image:getmetadata")
- @GET
- @Path("/images/{id}/metadata/{key}")
- @Consumes(MediaType.APPLICATION_JSON)
- @ResponseParser(OnlyMetadataValueOrNull.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<String> getMetadata(@PathParam("id") String id, @PathParam("key") String key);
-
- /**
- * @see ImageApi#updateMetadata
- */
- @Named("image:updatemetadata")
- @PUT
- @Path("/images/{id}/metadata/{key}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @ResponseParser(OnlyMetadataValueOrNull.class)
- @MapBinder(BindMetadataToJsonPayload.class)
- ListenableFuture<String> updateMetadata(@PathParam("id") String id,
- @PathParam("key") @PayloadParam("key") String key, @PathParam("value") @PayloadParam("value") String value);
-
-
- /**
- * @see ImageApi#deleteMetadata
- */
- @Named("image:deletemetadata")
- @DELETE
- @Consumes
- @Path("/images/{id}/metadata/{key}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> deleteMetadata(@PathParam("id") String id, @PathParam("key") String key);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java
deleted file mode 100644
index 9354d9a..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.features;
-
-import com.google.common.base.Optional;
-import java.util.Map;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.domain.RebootType;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
-import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
-import org.jclouds.openstack.nova.v2_0.options.RebuildServerOptions;
-import org.jclouds.openstack.v2_0.domain.Resource;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * Provides synchronous access to Server.
- * <p/>
- *
- * @see ServerAsyncApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-compute/1.1/content/Servers-d1e2073.html"
- * />
- * @author Adrian Cole
- */
-public interface ServerApi {
-
- /**
- * List all servers (IDs, names, links)
- *
- * @return all servers (IDs, names, links)
- */
- PagedIterable<? extends Resource> list();
-
- PaginatedCollection<? extends Resource> list(PaginationOptions options);
-
- /**
- * List all servers (all details)
- *
- * @return all servers (all details)
- */
- PagedIterable<? extends Server> listInDetail();
-
- PaginatedCollection<? extends Server> listInDetail(PaginationOptions options);
-
- /**
- * List details of the specified server
- *
- * @param id
- * id of the server
- * @return server or null if not found
- */
- Server get(String id);
-
- /**
- * Create a new server
- *
- * @param name
- * name of the server to create
- * @param imageRef
- * reference to the image for the server to use
- * @param flavorRef
- * reference to the flavor to use when creating the server
- * @param options
- * optional parameters to be passed into the server creation
- * request
- * @return the newly created server
- */
- ServerCreated create(String name, String imageRef, String flavorRef, CreateServerOptions... options);
-
- /**
- * Terminate and delete a server.
- *
- * @param id
- * id of the server
- * @return True if successful, False otherwise
- */
- boolean delete(String id);
-
- /**
- * Start a server
- *
- * @param id
- * id of the server
- */
- void start(String id);
-
- /**
- * Stop a server
- *
- * @param id
- * id of the server
- */
- void stop(String id);
-
- /**
- * Reboot a server.
- *
- * @param id
- * id of the server
- * @param rebootType
- * The type of reboot to perform (Hard/Soft)
- */
- void reboot(String id, RebootType rebootType);
-
- /**
- * Resize a server to a new flavor size.
- *
- * @param id
- * id of the server
- * @param flavorId
- * id of the new flavor to use
- */
- void resize(String id, String flavorId);
-
- /**
- * Confirm a resize operation.
- *
- * @param id
- * id of the server
- */
- void confirmResize(String id);
-
- /**
- * Revert a resize operation.
- *
- * @param id
- * id of the server
- */
- void revertResize(String id);
-
- /**
- * Rebuild a server.
- *
- * @param id
- * id of the server
- * @param options
- * Optional parameters to the rebuilding operation.
- */
- void rebuild(String id, RebuildServerOptions... options);
-
- /**
- * Change the administrative password to a server.
- *
- * @param id
- * id of the server
- * @param adminPass
- * The new administrative password to use
- */
- void changeAdminPass(String id, String adminPass);
-
- /**
- * Rename a server.
- *
- * @param id
- * id of the server
- * @param newName
- * The new name for the server
- */
- void rename(String id, String newName);
-
- /**
- * Create an image from a server.
- *
- * @param name
- * The name of the new image
- * @param id
- * id of the server
- *
- * @return ID of the new / updated image
- */
- String createImageFromServer(String name, String id);
-
- /**
- * List all metadata for a server.
- *
- * @param id
- * id of the server
- *
- * @return the metadata as a Map<String, String>
- */
- Map<String, String> getMetadata(String id);
-
- /**
- * Set the metadata for a server.
- *
- * @param id
- * id of the server
- * @param metadata
- * a Map containing the metadata
- * @return the metadata as a Map<String, String>
- */
- Map<String, String> setMetadata(String id, Map<String, String> metadata);
-
- /**
- * Update the metadata for a server.
- *
- * @param id
- * id of the server
- * @param metadata
- * a Map containing the metadata
- * @return the metadata as a Map<String, String>
- */
- Map<String, String> updateMetadata(String id, Map<String, String> metadata);
-
- /**
- * Update the metadata for a server.
- *
- * @param id
- * id of the image
- * @param metadata
- * a Map containing the metadata
- * @return the value or null if not present
- */
- @Nullable
- String getMetadata(String id, String key);
-
- /**
- * Set a metadata item for a server.
- *
- * @param id
- * id of the image
- * @param key
- * the name of the metadata item
- * @param value
- * the value of the metadata item
- * @return the value you updated
- */
- String updateMetadata(String id, String key, String value);
-
- /**
- * Delete a metadata item from a server.
- *
- * @param id
- * id of the image
- * @param key
- * the name of the metadata item
- */
- void deleteMetadata(String id, String key);
-
-
- /**
- * Get usage information about the server such as CPU usage, Memory and IO.
- * The information returned by this method is dependent on the hypervisor
- * in use by the OpenStack installation and whether that hypervisor supports
- * this method. More information can be found in the
- * <a href="http://api.openstack.org/api-ref.html"> OpenStack API
- * reference</a>. <br/>
- * At the moment the returned response is a generic map. In future versions
- * of OpenStack this might be subject to change.
- *
- * @param id
- * id of the server
- * @return A Map containing the collected values organized by key - value.
- * @Beta
- */
- Optional<Map<String, String>> getDiagnostics(String id);
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java
deleted file mode 100644
index 2d63d65..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.features;
-
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.AbsentOn403Or404Or500;
-import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
-import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
-import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.binders.BindMetadataToJsonPayload;
-import org.jclouds.openstack.nova.v2_0.domain.RebootType;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
-import org.jclouds.openstack.nova.v2_0.functions.ParseImageIdFromLocationHeader;
-import org.jclouds.openstack.nova.v2_0.functions.internal.OnlyMetadataValueOrNull;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseDiagnostics;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServerDetails;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServers;
-import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
-import org.jclouds.openstack.nova.v2_0.options.RebuildServerOptions;
-import org.jclouds.openstack.v2_0.domain.Resource;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Transform;
-import org.jclouds.rest.annotations.Unwrap;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Server via their REST API.
- * <p/>
- *
- * @see ServerApi
- * @see <a href= "http://docs.openstack.org/api/openstack-compute/1.1/content/Servers-d1e2073.html"
- * />
- * @author Adrian Cole
- */
-@RequestFilters(AuthenticateRequest.class)
-public interface ServerAsyncApi {
-
- /**
- * @see ServerApi#list()
- */
- @Named("server:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/servers")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseServers.class)
- @Transform(ParseServers.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends Resource>> list();
-
- /** @see ServerApi#list(PaginationOptions) */
- @Named("server:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/servers")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseServers.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends Resource>> list(PaginationOptions options);
-
- /**
- * @see ServerApi#listInDetail()
- */
- @Named("server:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/servers/detail")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseServerDetails.class)
- @Transform(ParseServerDetails.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends Server>> listInDetail();
-
- /** @see ServerApi#listInDetail(PaginationOptions) */
- @Named("server:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/servers/detail")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseServerDetails.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends Server>> listInDetail(PaginationOptions options);
-
- /**
- * @see ServerApi#get
- */
- @Named("server:get")
- @GET
- @SelectJson("server")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/servers/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Server> get(@PathParam("id") String id);
-
- /**
- * @see ServerApi#delete
- */
- @Named("server:delete")
- @DELETE
- @Consumes
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/servers/{id}")
- ListenableFuture<Boolean> delete(@PathParam("id") String id);
-
- /**
- * @see ServerApi#start
- */
- @Named("server:start")
- @POST
- @Path("/servers/{id}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"os-start\":null}")
- ListenableFuture<Void> start(@PathParam("id") String id);
-
- /**
- * @see ServerApi#stop
- */
- @Named("server:stop")
- @POST
- @Path("/servers/{id}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"os-stop\":null}")
- ListenableFuture<Void> stop(@PathParam("id") String id);
-
- /**
- * @see ServerApi#reboot
- */
- @Named("server:reboot")
- @POST
- @Path("/servers/{id}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"reboot\":%7B\"type\":\"{type}\"%7D%7D")
- ListenableFuture<Void> reboot(@PathParam("id") String id, @PayloadParam("type") RebootType rebootType);
-
- /**
- * @see ServerApi#resize
- */
- @Named("server:resize")
- @POST
- @Path("/servers/{id}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"resize\":%7B\"flavorRef\":{flavorId}%7D%7D")
- ListenableFuture<Void> resize(@PathParam("id") String id, @PayloadParam("flavorId") String flavorId);
-
- /**
- * @see ServerApi#confirmResize
- */
- @Named("server:resize")
- @POST
- @Path("/servers/{id}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"confirmResize\":null}")
- ListenableFuture<Void> confirmResize(@PathParam("id") String id);
-
- /**
- * @see ServerApi#revertResize
- */
- @Named("server:resize")
- @POST
- @Path("/servers/{id}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"revertResize\":null}")
- ListenableFuture<Void> revertResize(@PathParam("id") String id);
-
- /**
- * @see ServerApi#create
- */
- @Named("server:create")
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/servers")
- @MapBinder(CreateServerOptions.class)
- ListenableFuture<ServerCreated> create(@PayloadParam("name") String name, @PayloadParam("imageRef") String imageRef,
- @PayloadParam("flavorRef") String flavorRef, CreateServerOptions... options);
-
- /**
- * @see ServerApi#rebuild
- */
- @Named("server:rebuild")
- @POST
- @Path("/servers/{id}/action")
- @Consumes
- @MapBinder(RebuildServerOptions.class)
- ListenableFuture<Void> rebuild(@PathParam("id") String id, RebuildServerOptions... options);
-
- /**
- * @see ServerApi#changeAdminPass
- */
- @Named("server:changeadminpass")
- @POST
- @Path("/servers/{id}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"changePassword\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
- ListenableFuture<Void> changeAdminPass(@PathParam("id") String id, @PayloadParam("adminPass") String adminPass);
-
- /**
- * @see ServerApi#rename
- */
- @Named("server:rename")
- @PUT
- @Path("/servers/{id}")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"server\":%7B\"name\":\"{name}\"%7D%7D")
- ListenableFuture<Void> rename(@PathParam("id") String id, @PayloadParam("name") String newName);
-
- /**
- * @see ServerApi#createImageFromServer
- */
- @Named("server:create")
- @POST
- @Path("/servers/{id}/action")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"createImage\":%7B\"name\":\"{name}\", \"metadata\": %7B%7D%7D%7D")
- @Fallback(MapHttp4xxCodesToExceptions.class)
- @ResponseParser(ParseImageIdFromLocationHeader.class)
- ListenableFuture<String> createImageFromServer(@PayloadParam("name") String name, @PathParam("id") String id);
-
- /**
- * @see ServerApi#getMetadata
- */
- @Named("server:getmetadata")
- @GET
- @SelectJson("metadata")
- @Path("/servers/{id}/metadata")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyMapOnNotFoundOr404.class)
- ListenableFuture<? extends Map<String, String>> getMetadata(@PathParam("id") String id);
-
- /**
- * @see ServerApi#setMetadata
- */
- @Named("server:setmetadata")
- @PUT
- @SelectJson("metadata")
- @Path("/servers/{id}/metadata")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(EmptyMapOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<? extends Map<String, String>> setMetadata(@PathParam("id") String id,
- @PayloadParam("metadata") Map<String, String> metadata);
-
- /**
- * @see ServerApi#updateMetadata
- */
- @Named("server:updatemetadata")
- @POST
- @SelectJson("metadata")
- @Path("/servers/{id}/metadata")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(EmptyMapOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<? extends Map<String, String>> updateMetadata(@PathParam("id") String id,
- @PayloadParam("metadata") Map<String, String> metadata);
-
- /**
- * @see ServerApi#getMetadata
- */
- @Named("server:getmetadata")
- @GET
- @Path("/servers/{id}/metadata/{key}")
- @Consumes(MediaType.APPLICATION_JSON)
- @ResponseParser(OnlyMetadataValueOrNull.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<String> getMetadata(@PathParam("id") String id, @PathParam("key") String key);
-
- /**
- * @see ServerApi#updateMetadata
- */
- @Named("server:updatemetadata")
- @PUT
- @Path("/servers/{id}/metadata/{key}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @ResponseParser(OnlyMetadataValueOrNull.class)
- @MapBinder(BindMetadataToJsonPayload.class)
- ListenableFuture<String> updateMetadata(@PathParam("id") String id,
- @PathParam("key") @PayloadParam("key") String key, @PathParam("value") @PayloadParam("value") String value);
-
- /**
- * @see ServerApi#deleteMetadata
- */
- @Named("server:deletemetadata")
- @DELETE
- @Consumes
- @Path("/servers/{id}/metadata/{key}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> deleteMetadata(@PathParam("id") String id, @PathParam("key") String key);
-
-
- /**
- * @see ServerApi#getDiagnostics
- */
- @Named("server:getdiagnostics")
- @GET
- @Path("/servers/{id}/diagnostics")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(AbsentOn403Or404Or500.class)
- @ResponseParser(ParseDiagnostics.class)
- ListenableFuture<Optional<Map<String, String>>> getDiagnostics(@PathParam("id") String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/FieldValueResponseParsers.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/FieldValueResponseParsers.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/FieldValueResponseParsers.java
deleted file mode 100644
index f137c59..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/FieldValueResponseParsers.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseFirstJsonValueNamed;
-import org.jclouds.json.internal.GsonWrapper;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.TypeLiteral;
-
-/**
- * Parsers for extracting a single field value from a response and comparing it to an expected value
- */
-public class FieldValueResponseParsers {
- @Singleton
- public static class StatusEnabledResponseParser extends FieldValueResponseParser<String> {
- @Inject
- public StatusEnabledResponseParser(GsonWrapper wrapper) {
- super(wrapper, "status", "enabled");
- }
- }
-
- @Singleton
- public static class StatusDisabledResponseParser extends FieldValueResponseParser<String> {
- @Inject
- public StatusDisabledResponseParser(GsonWrapper wrapper) {
- super(wrapper, "status", "disabled");
- }
- }
-
- @Singleton
- public static class MaintenanceModeEnabledResponseParser extends FieldValueResponseParser<String> {
- @Inject
- public MaintenanceModeEnabledResponseParser(GsonWrapper wrapper) {
- super(wrapper, "maintenance_mode", "on_maintenance");
- }
- }
-
- @Singleton
- public static class MaintenanceModeDisabledResponseParser extends FieldValueResponseParser<String> {
- @Inject
- public MaintenanceModeDisabledResponseParser(GsonWrapper wrapper) {
- super(wrapper, "maintenance_mode", "off_maintenance");
- }
- }
-
- @Singleton
- public static class PowerIsStartupResponseParser extends FieldValueResponseParser<String> {
- @Inject
- public PowerIsStartupResponseParser(GsonWrapper wrapper) {
- super(wrapper, "power_action", "startup");
- }
- }
-
- @Singleton
- public static class PowerIsShutdownResponseParser extends FieldValueResponseParser<String> {
- @Inject
- public PowerIsShutdownResponseParser(GsonWrapper wrapper) {
- super(wrapper, "power_action", "shutdown");
- }
- }
-
- @Singleton
- public static class PowerIsRebootResponseParser extends FieldValueResponseParser<String> {
- @Inject
- public PowerIsRebootResponseParser(GsonWrapper wrapper) {
- super(wrapper, "power_action", "reboot");
- }
- }
-
- public abstract static class FieldValueResponseParser<T> implements Function<HttpResponse, Boolean> {
- private final T expectedValue;
- private final ParseFirstJsonValueNamed<T> valueParser;
-
- public FieldValueResponseParser(GsonWrapper wrapper, String fieldName, T expectedValue) {
- valueParser = new ParseFirstJsonValueNamed<T>(wrapper, new TypeLiteral<T>() {
- }, fieldName);
- this.expectedValue = expectedValue;
- }
-
- @Override
- public Boolean apply(HttpResponse response) {
- return Objects.equal(expectedValue, valueParser.apply(response));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/OverLimitParser.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/OverLimitParser.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/OverLimitParser.java
deleted file mode 100644
index 9627ece..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/OverLimitParser.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.jclouds.json.Json;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableMap;
-
-/**
- *
- * The expected body contains the time as in this (real) response
- *
- * <pre>
- * {
- * "overLimit" : {
- * "code" : 413,
- * "message" : "OverLimit Retry...",
- * "details" : "Error Details...",
- * "retryAt" : "2012-11-14T21:51:28UTC"
- * }
- * }
- * </pre>
- *
- * or
- *
- * <pre>
- * {
- * "overLimit": {
- * "message": "This request was rate-limited.",
- * "code": 413,
- * "retryAfter": "54",
- * "details": "Only 1 POST request(s) can be made to \"*\" every minute."
- * }
- * }
- * </pre>
- *
- * @author Adrian Cole, Steve Loughran
- *
- */
-public class OverLimitParser implements Function<String, Map<String, String>> {
-
- @Resource
- private Logger logger = Logger.NULL;
- private final Json json;
-
- @Inject
- public OverLimitParser(Json json) {
- this.json = checkNotNull(json, "json");
- }
-
- private static class Holder {
- Map<String, String> overLimit = ImmutableMap.of();
- }
-
- /**
- * parses or returns an empty map.
- */
- @Override
- public Map<String, String> apply(String in) {
- try {
- return json.fromJson(in, OverLimitParser.Holder.class).overLimit;
- } catch (RuntimeException e) {
- // an error was raised during parsing -which can include badly
- // formatted fields.
- logger.error("Failed to parse " + in + "", e);
- return ImmutableMap.of();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/ParseImageIdFromLocationHeader.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/ParseImageIdFromLocationHeader.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/ParseImageIdFromLocationHeader.java
deleted file mode 100644
index 1ca6f68..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/ParseImageIdFromLocationHeader.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions;
-
-import javax.inject.Singleton;
-import javax.ws.rs.core.HttpHeaders;
-
-import org.jclouds.http.HttpResponse;
-
-import com.google.common.base.Function;
-
-/**
- * This parses {@link Image} from the body of the link in the Location header of the HTTPResponse.
- *
- * @author Tim Miller
- */
-@Singleton
-public class ParseImageIdFromLocationHeader implements Function<HttpResponse, String> {
-
- public String apply(HttpResponse response) {
- String location = response.getFirstHeaderOrNull(HttpHeaders.LOCATION);
- String[] parts = location.split("/");
- return parts[parts.length - 1];
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/OnlyMetadataValueOrNull.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/OnlyMetadataValueOrNull.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/OnlyMetadataValueOrNull.java
deleted file mode 100644
index 8183f84..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/OnlyMetadataValueOrNull.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.internal.GsonWrapper;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
-import com.google.inject.TypeLiteral;
-
-/**
- *
- * @author Adrian Cole
- */
-@Singleton
-public class OnlyMetadataValueOrNull implements Function<HttpResponse, String> {
- private final ParseJson<Wrapper> parser;
-
- private static class Wrapper implements Supplier<String> {
- private Map<String, String> metadata;
-
- @Override
- public String get() {
- return metadata == null ? null : Iterables.get(metadata.values(), 0, null);
- }
-
- }
-
- @Inject
- public OnlyMetadataValueOrNull(GsonWrapper gsonView) {
- this.parser = new ParseJson<Wrapper>(checkNotNull(gsonView, "gsonView"), new TypeLiteral<Wrapper>() {
- });
- }
-
- public String apply(HttpResponse response) {
- checkNotNull(response, "response");
- return parser.apply(response).get();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseDiagnostics.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseDiagnostics.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseDiagnostics.java
deleted file mode 100644
index 366aa4c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseDiagnostics.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseJson;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.inject.Inject;
-import java.util.Map;
-
-/**
- * @author Leander Beernaert
- */
-public class ParseDiagnostics implements Function<HttpResponse, Optional <Map<String,String>>> {
-
-
- private final ParseJson<Optional <Map<String,String>>> parser;
-
- @Inject
- public ParseDiagnostics(ParseJson<Optional <Map<String,String>>> parser) {
- this.parser = parser;
- }
-
- @Override
- public Optional <Map<String,String>> apply(HttpResponse response) {
- checkNotNull(response, "response");
- return parser.apply(response);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavorDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavorDetails.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavorDetails.java
deleted file mode 100644
index 7e15016..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavorDetails.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import com.google.common.base.Optional;
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.collect.internal.Arg0ToPagedIterable;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.Flavor;
-import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseFlavorDetails.Flavors;
-import org.jclouds.openstack.v2_0.domain.Link;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * boiler plate until we determine a better way
- *
- * @author Adrian Cole
- */
-@Beta
-@Singleton
-public class ParseFlavorDetails extends ParseJson<Flavors> {
- static class Flavors extends PaginatedCollection<Flavor> {
-
- @ConstructorProperties({ "flavors", "flavors_links" })
- protected Flavors(Iterable<Flavor> flavors, Iterable<Link> flavors_links) {
- super(flavors, flavors_links);
- }
-
- }
-
- @Inject
- public ParseFlavorDetails(Json json) {
- super(json, TypeLiteral.get(Flavors.class));
- }
-
- public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Flavor, ToPagedIterable> {
-
- private final NovaApi api;
-
- @Inject
- protected ToPagedIterable(NovaApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<Flavor>> markerToNextForArg0(Optional<Object> arg0) {
- String zone = arg0.get().toString();
- final FlavorApi flavorApi = api.getFlavorApiForZone(zone);
- return new Function<Object, IterableWithMarker<Flavor>>() {
-
- @SuppressWarnings("unchecked")
- @Override
- public IterableWithMarker<Flavor> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return IterableWithMarker.class.cast(flavorApi.listInDetail(paginationOptions));
- }
-
- @Override
- public String toString() {
- return "listFlavorsInDetail()";
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavors.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavors.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavors.java
deleted file mode 100644
index 5d183f4..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseFlavors.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import com.google.common.base.Optional;
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.collect.internal.Arg0ToPagedIterable;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseFlavors.Flavors;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * boiler plate until we determine a better way
- *
- * @author Adrian Cole
- */
-@Beta
-@Singleton
-public class ParseFlavors extends ParseJson<Flavors> {
- static class Flavors extends PaginatedCollection<Resource> {
-
- @ConstructorProperties({ "flavors", "flavors_links" })
- protected Flavors(Iterable<Resource> flavors, Iterable<Link> flavors_links) {
- super(flavors, flavors_links);
- }
-
- }
-
- @Inject
- public ParseFlavors(Json json) {
- super(json, TypeLiteral.get(Flavors.class));
- }
-
- public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Resource, ToPagedIterable> {
-
- private final NovaApi api;
-
- @Inject
- protected ToPagedIterable(NovaApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
- String zone = arg0.get().toString();
- final FlavorApi flavorApi = api.getFlavorApiForZone(zone);
- return new Function<Object, IterableWithMarker<Resource>>() {
-
- @SuppressWarnings("unchecked")
- @Override
- public IterableWithMarker<Resource> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return IterableWithMarker.class.cast(flavorApi.list(paginationOptions));
- }
-
- @Override
- public String toString() {
- return "listFlavors()";
- }
- };
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImageDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImageDetails.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImageDetails.java
deleted file mode 100644
index c69103a..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImageDetails.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import com.google.common.base.Optional;
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.collect.internal.Arg0ToPagedIterable;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-import org.jclouds.openstack.nova.v2_0.features.ImageApi;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseImageDetails.Images;
-import org.jclouds.openstack.v2_0.domain.Link;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * boiler plate until we determine a better way
- *
- * @author Adrian Cole
- */
-@Beta
-@Singleton
-public class ParseImageDetails extends ParseJson<Images> {
- static class Images extends PaginatedCollection<Image> {
-
- @ConstructorProperties({ "images", "images_links" })
- protected Images(Iterable<Image> images, Iterable<Link> images_links) {
- super(images, images_links);
- }
-
- }
-
- @Inject
- public ParseImageDetails(Json json) {
- super(json, TypeLiteral.get(Images.class));
- }
-
- public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Image, ToPagedIterable> {
-
- private final NovaApi api;
-
- @Inject
- protected ToPagedIterable(NovaApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<Image>> markerToNextForArg0(Optional<Object> arg0) {
- String zone = arg0.get().toString();
- final ImageApi imageApi = api.getImageApiForZone(zone);
- return new Function<Object, IterableWithMarker<Image>>() {
-
- @SuppressWarnings("unchecked")
- @Override
- public IterableWithMarker<Image> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return IterableWithMarker.class.cast(imageApi.listInDetail(paginationOptions));
- }
-
- @Override
- public String toString() {
- return "listInDetail()";
- }
- };
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImages.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImages.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImages.java
deleted file mode 100644
index a939134..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseImages.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import com.google.common.base.Optional;
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.collect.internal.Arg0ToPagedIterable;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.features.ImageApi;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseImages.Images;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * boiler plate until we determine a better way
- *
- * @author Adrian Cole
- */
-@Beta
-@Singleton
-public class ParseImages extends ParseJson<Images> {
- static class Images extends PaginatedCollection<Resource> {
-
- @ConstructorProperties({ "images", "images_links" })
- protected Images(Iterable<Resource> images, Iterable<Link> images_links) {
- super(images, images_links);
- }
-
- }
-
- @Inject
- public ParseImages(Json json) {
- super(json, TypeLiteral.get(Images.class));
- }
-
- public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Resource, ToPagedIterable> {
-
- private final NovaApi api;
-
- @Inject
- protected ToPagedIterable(NovaApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
- String zone = arg0.get().toString();
- final ImageApi imageApi = api.getImageApiForZone(zone);
- return new Function<Object, IterableWithMarker<Resource>>() {
-
- @SuppressWarnings("unchecked")
- @Override
- public IterableWithMarker<Resource> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return IterableWithMarker.class.cast(imageApi.list(paginationOptions));
- }
-
- @Override
- public String toString() {
- return "list()";
- }
- };
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseKeyPairs.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseKeyPairs.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseKeyPairs.java
deleted file mode 100644
index 96566ff..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseKeyPairs.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseFirstJsonValueNamed;
-import org.jclouds.json.internal.GsonWrapper;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.FluentIterable;
-import com.google.inject.Inject;
-import com.google.inject.TypeLiteral;
-
-/**
- *
- * @author Adrian Cole
- */
-@Singleton
-public class ParseKeyPairs implements Function<HttpResponse, FluentIterable<? extends KeyPair>> {
- private final ParseFirstJsonValueNamed<FluentIterable<Wrapper>> parser;
-
- private static class Wrapper implements Supplier<KeyPair> {
- private KeyPair keypair;
-
- @Override
- public KeyPair get() {
- return keypair;
- }
-
- }
-
- @Inject
- public ParseKeyPairs(GsonWrapper gsonView) {
- this.parser = new ParseFirstJsonValueNamed<FluentIterable<Wrapper>>(checkNotNull(gsonView, "gsonView"),
- new TypeLiteral<FluentIterable<Wrapper>>() {
- }, "keypairs");
- }
-
- public FluentIterable<? extends KeyPair> apply(HttpResponse response) {
- checkNotNull(response, "response");
- return parser.apply(response).transform(Suppliers.<KeyPair> supplierFunction());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
deleted file mode 100644
index 4af2cea..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import com.google.common.base.Optional;
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.collect.internal.Arg0ToPagedIterable;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.features.ServerApi;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServerDetails.Servers;
-import org.jclouds.openstack.v2_0.domain.Link;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * boiler plate until we determine a better way
- *
- * @author Adrian Cole
- */
-@Beta
-@Singleton
-public class ParseServerDetails extends ParseJson<Servers> {
- static class Servers extends PaginatedCollection<Server> {
-
- @ConstructorProperties({ "servers", "servers_links" })
- protected Servers(Iterable<Server> servers, Iterable<Link> servers_links) {
- super(servers, servers_links);
- }
-
- }
-
- @Inject
- public ParseServerDetails(Json json) {
- super(json, TypeLiteral.get(Servers.class));
- }
-
- public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Server, ToPagedIterable> {
-
- private final NovaApi api;
-
- @Inject
- protected ToPagedIterable(NovaApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<Server>> markerToNextForArg0(Optional<Object> arg0) {
- String zone = arg0.get().toString();
- final ServerApi serverApi = api.getServerApiForZone(zone);
- return new Function<Object, IterableWithMarker<Server>>() {
-
- @SuppressWarnings("unchecked")
- @Override
- public IterableWithMarker<Server> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return IterableWithMarker.class.cast(serverApi.listInDetail(paginationOptions));
- }
-
- @Override
- public String toString() {
- return "listInDetail()";
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
deleted file mode 100644
index 2de8c76..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.functions.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import com.google.common.base.Optional;
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.collect.internal.Arg0ToPagedIterable;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.features.ServerApi;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServers.Servers;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * boiler plate until we determine a better way
- *
- * @author Adrian Cole
- */
-@Beta
-@Singleton
-public class ParseServers extends ParseJson<Servers> {
- static class Servers extends PaginatedCollection<Resource> {
-
- @ConstructorProperties({ "servers", "servers_links" })
- protected Servers(Iterable<Resource> servers, Iterable<Link> servers_links) {
- super(servers, servers_links);
- }
-
- }
-
- @Inject
- public ParseServers(Json json) {
- super(json, TypeLiteral.get(Servers.class));
- }
-
- public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Resource, ToPagedIterable> {
-
- private final NovaApi api;
-
- @Inject
- protected ToPagedIterable(NovaApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
- String zone = arg0.get().toString();
- final ServerApi serverApi = api.getServerApiForZone(zone);
- return new Function<Object, IterableWithMarker<Resource>>() {
-
- @SuppressWarnings("unchecked")
- @Override
- public IterableWithMarker<Resource> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return IterableWithMarker.class.cast(serverApi.list(paginationOptions));
- }
-
- @Override
- public String toString() {
- return "list()";
- }
- };
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
deleted file mode 100644
index 4bfb51b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.handlers;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.in;
-import static com.google.common.base.Strings.emptyToNull;
-import static com.google.common.collect.Maps.filterKeys;
-import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.date.DateCodecFactory;
-import org.jclouds.fallbacks.HeaderToRetryAfterException;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.functions.OverLimitParser;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.InsufficientResourcesException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.jclouds.rest.RetryAfterException;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Ticker;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- *
- * @author Adrian Cole, Steve Loughran
- *
- */
-// TODO: is there error spec someplace? let's type errors, etc.
-@Singleton
-public class NovaErrorHandler implements HttpErrorHandler {
-
- @Resource
- protected Logger logger = Logger.NULL;
- protected final HeaderToRetryAfterException retryAfterParser;
- protected final OverLimitParser overLimitParser;
-
- protected NovaErrorHandler(HeaderToRetryAfterException retryAfterParser, OverLimitParser overLimitParser) {
- this.retryAfterParser = checkNotNull(retryAfterParser, "retryAfterParser");
- this.overLimitParser = checkNotNull(overLimitParser, "overLimitParser");
- }
-
- /**
- * in current format, retryAt has a value of {@code 2012-11-14T21:51:28UTC}, which is an ISO-8601 seconds (not milliseconds) format.
- */
- @Inject
- public NovaErrorHandler(DateCodecFactory factory, OverLimitParser overLimitParser) {
- this(HeaderToRetryAfterException.create(Ticker.systemTicker(), factory.iso8601Seconds()), overLimitParser);
- }
-
- public void handleError(HttpCommand command, HttpResponse response) {
- // it is important to always read fully and close streams
- byte[] data = closeClientButKeepContentStream(response);
- String content = data != null ? emptyToNull(new String(data)) : null;
-
- Exception exception = content != null ? new HttpResponseException(command, response, content)
- : new HttpResponseException(command, response);
- String requestLine = command.getCurrentRequest().getRequestLine();
- String message = content != null ? content : String.format("%s -> %s", requestLine, response.getStatusLine());
- switch (response.getStatusCode()) {
- case 400:
- if (message.indexOf("quota exceeded") != -1)
- exception = new InsufficientResourcesException(message, exception);
- else if (message.indexOf("has no fixed_ips") != -1)
- exception = new IllegalStateException(message, exception);
- else if (message.indexOf("already exists") != -1)
- exception = new IllegalStateException(message, exception);
- break;
- case 401:
- case 403:
- exception = new AuthorizationException(message, exception);
- break;
- case 404:
- if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- exception = new ResourceNotFoundException(message, exception);
- }
- break;
- case 413:
- if (content == null) {
- exception = new InsufficientResourcesException(message, exception);
- break;
- }
- exception = parseAndBuildRetryException(content, message, exception);
- }
- command.setException(exception);
- }
-
- /**
- * Build an exception from the response. If it contains the JSON payload then
- * that is parsed to create a {@link RetryAfterException}, otherwise a
- * {@link InsufficientResourcesException} is returned
- *
- */
- private Exception parseAndBuildRetryException(String json, String message, Exception exception) {
- Set<String> retryFields = ImmutableSet.of("retryAfter", "retryAt");
- for (String value : filterKeys(overLimitParser.apply(json), in(retryFields)).values()) {
- Optional<RetryAfterException> retryException = retryAfterParser.tryCreateRetryAfterException(exception, value);
- if (retryException.isPresent())
- return retryException.get();
- }
- return new InsufficientResourcesException(message, exception);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
deleted file mode 100644
index e6002e5..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.options;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-/**
- * @author Adam Lowe
- */
-public class CreateBackupOfServerOptions implements MapBinder {
- public static final CreateBackupOfServerOptions NONE = new CreateBackupOfServerOptions();
-
- @Inject
- protected BindToJsonPayload jsonBinder;
-
- private Map<String, String> metadata = ImmutableMap.of();
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- Map<String, Object> data = Maps.newHashMap();
- data.putAll(postParams);
- data.put("metadata", metadata);
- return jsonBinder.bindToRequest(request, ImmutableMap.of("createBackup", data));
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
- throw new IllegalStateException("createBackup is a POST operation");
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (!(object instanceof CreateBackupOfServerOptions)) return false;
- final CreateBackupOfServerOptions other = CreateBackupOfServerOptions.class.cast(object);
- return equal(metadata, other.metadata);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(metadata);
- }
-
- protected ToStringHelper string() {
- return toStringHelper("").add("metadata", metadata);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- /** @see #getMetadata() */
- public CreateBackupOfServerOptions metadata(Map<String, String> metadata) {
- this.metadata = metadata;
- return this;
- }
-
- /**
- * Extra image properties to include
- */
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public static class Builder {
- /**
- * @see CreateBackupOfServerOptions#getMetadata()
- */
- public static CreateBackupOfServerOptions metadata(Map<String, String> metadata) {
- return new CreateBackupOfServerOptions().metadata(metadata);
- }
- }
-
-}
[09/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
deleted file mode 100644
index dcaf6fc..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import java.beans.ConstructorProperties;
-import java.util.Set;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-
-/**
- * Server Resource with administrative password returned by ServerApi#CreateServer calls
- *
- * @author Adam Lowe
- * @see <a href=
- "http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
- />
-*/
-public class ServerCreated extends Resource {
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return builder().fromServerCreated(this);
- }
-
- public static final class Builder extends Resource.Builder<Builder> {
- protected String adminPass;
- protected String diskConfig;
-
- /**
- * @see ServerCreated#getAdminPass()
- */
- public Builder adminPass(String adminPass) {
- this.adminPass = adminPass;
- return self();
- }
-
- /**
- * @see ServerCreated#getDiskConfig()
- */
- public Builder diskConfig(String diskConfig) {
- this.diskConfig = diskConfig;
- return self();
- }
-
- public ServerCreated build() {
- return new ServerCreated(id, name, links, adminPass, diskConfig);
- }
-
- public Builder fromServerCreated(ServerCreated in) {
- return super.fromResource(in).adminPass(in.getAdminPass().orNull()).diskConfig(in.getDiskConfig().orNull());
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-
- private final Optional<String> adminPass;
- private final Optional<String> diskConfig;
-
- @ConstructorProperties({
- "id", "name", "links", "adminPass", "OS-DCF:diskConfig"
- })
- protected ServerCreated(String id, @Nullable String name, Set<Link> links, @Nullable String adminPass,
- @Nullable String diskConfig) {
- super(id, name, links);
- this.adminPass = Optional.fromNullable(adminPass);
- this.diskConfig = Optional.fromNullable(diskConfig);
- }
-
- /**
- * present unless the nova install was configured with the option {@code enable_instance_password=false}
- */
- public Optional<String> getAdminPass() {
- return this.adminPass;
- }
-
- /**
- * @see CreateServerOptions#getDiskConfig()
- */
- public Optional<String> getDiskConfig() {
- return this.diskConfig;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(adminPass, diskConfig);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ServerCreated that = ServerCreated.class.cast(obj);
- return super.equals(that) && Objects.equal(this.adminPass, that.adminPass)
- && Objects.equal(this.diskConfig, that.diskConfig);
- }
-
- @Override
- protected ToStringHelper string() {
- return super.string().add("adminPass", adminPass.orNull()).add("diskConfig", diskConfig.orNull());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
deleted file mode 100644
index 1390660..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Additional attributes delivered by Extended Server Attributes extension (alias "OS-EXT-SRV-ATTR")
- *
- * @author Adam Lowe
- * @see <a href=
- "http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_server_attributes.html"
- />
- * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
- * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
-*/
-public class ServerExtendedAttributes {
-
- public static String PREFIX;
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromServerExtendedAttributes(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String instanceName;
- protected String hostName;
- protected String hypervisorHostName;
-
- /**
- * @see ServerExtendedAttributes#getInstanceName()
- */
- public T instanceName(String instanceName) {
- this.instanceName = instanceName;
- return self();
- }
-
- /**
- * @see ServerExtendedAttributes#getHostName()
- */
- public T hostName(String hostName) {
- this.hostName = hostName;
- return self();
- }
-
- /**
- * @see ServerExtendedAttributes#getHypervisorHostName()
- */
- public T hypervisorHostName(String hypervisorHostName) {
- this.hypervisorHostName = hypervisorHostName;
- return self();
- }
-
- public ServerExtendedAttributes build() {
- return new ServerExtendedAttributes(instanceName, hostName, hypervisorHostName);
- }
-
- public T fromServerExtendedAttributes(ServerExtendedAttributes in) {
- return this
- .instanceName(in.getInstanceName())
- .hostName(in.getHostName())
- .hypervisorHostName(in.getHypervisorHostName());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("OS-EXT-SRV-ATTR:instance_name")
- private final String instanceName;
- @Named("OS-EXT-SRV-ATTR:host")
- private final String hostName;
- @Named("OS-EXT-SRV-ATTR:hypervisor_hostname")
- private final String hypervisorHostName;
-
- @ConstructorProperties({
- "OS-EXT-SRV-ATTR:instance_name", "OS-EXT-SRV-ATTR:host", "OS-EXT-SRV-ATTR:hypervisor_hostname"
- })
- protected ServerExtendedAttributes(@Nullable String instanceName, @Nullable String hostName, @Nullable String hypervisorHostName) {
- this.instanceName = instanceName;
- this.hostName = hostName;
- this.hypervisorHostName = hypervisorHostName;
- }
-
- @Nullable
- public String getInstanceName() {
- return this.instanceName;
- }
-
- @Nullable
- public String getHostName() {
- return this.hostName;
- }
-
- @Nullable
- public String getHypervisorHostName() {
- return this.hypervisorHostName;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(instanceName, hostName, hypervisorHostName);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ServerExtendedAttributes that = ServerExtendedAttributes.class.cast(obj);
- return Objects.equal(this.instanceName, that.instanceName)
- && Objects.equal(this.hostName, that.hostName)
- && Objects.equal(this.hypervisorHostName, that.hypervisorHostName);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("instanceName", instanceName).add("hostName", hostName).add("hypervisorHostName", hypervisorHostName);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
deleted file mode 100644
index 33dcb75..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Additional attributes delivered by Extended Server Status extension (alias "OS-EXT-STS")
- *
- * @author Adam Lowe
- * @see <a href=
- "http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_status.html"
- />
- * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
- * @see org.jclouds.openstack.nova.v1_1.extensions.ExtensionNamespaces#EXTENDED_STATUS (extended status?)
-*/
-public class ServerExtendedStatus {
-
- public static String PREFIX;
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromServerExtendedStatus(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String taskState;
- protected String vmState;
- protected int powerState;
-
- /**
- * @see ServerExtendedStatus#getTaskState()
- */
- public T taskState(String taskState) {
- this.taskState = taskState;
- return self();
- }
-
- /**
- * @see ServerExtendedStatus#getVmState()
- */
- public T vmState(String vmState) {
- this.vmState = vmState;
- return self();
- }
-
- /**
- * @see ServerExtendedStatus#getPowerState()
- */
- public T powerState(int powerState) {
- this.powerState = powerState;
- return self();
- }
-
- public ServerExtendedStatus build() {
- return new ServerExtendedStatus(taskState, vmState, powerState);
- }
-
- public T fromServerExtendedStatus(ServerExtendedStatus in) {
- return this
- .taskState(in.getTaskState())
- .vmState(in.getVmState())
- .powerState(in.getPowerState());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("OS-EXT-STS:task_state")
- private final String taskState;
- @Named("OS-EXT-STS:vm_state")
- private final String vmState;
- @Named("OS-EXT-STS:power_state")
- private final int powerState;
-
- @ConstructorProperties({
- "OS-EXT-STS:task_state", "OS-EXT-STS:vm_state", "OS-EXT-STS:power_state"
- })
- protected ServerExtendedStatus(@Nullable String taskState, @Nullable String vmState, int powerState) {
- this.taskState = taskState;
- this.vmState = vmState;
- this.powerState = powerState;
- }
-
- @Nullable
- public String getTaskState() {
- return this.taskState;
- }
-
- @Nullable
- public String getVmState() {
- return this.vmState;
- }
-
- public int getPowerState() {
- return this.powerState;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(taskState, vmState, powerState);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ServerExtendedStatus that = ServerExtendedStatus.class.cast(obj);
- return Objects.equal(this.taskState, that.taskState)
- && Objects.equal(this.vmState, that.vmState)
- && Objects.equal(this.powerState, that.powerState);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("taskState", taskState).add("vmState", vmState).add("powerState", powerState);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
deleted file mode 100644
index 3d7a9b9..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Multimap;
-
-/**
- * Extended server returned by ServerWithSecurityGroupsApi
- *
- * @author Adam Lowe
- * @see <a href=
-"http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
-/>
-*/
-public class ServerWithSecurityGroups extends Server {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromServerWithSecurityGroups(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Server.Builder<T> {
- protected Set<String> securityGroupNames = ImmutableSet.of();
-
- /**
- * @see ServerWithSecurityGroups#getSecurityGroupNames()
- */
- public T securityGroupNames(Set<String> securityGroupNames) {
- this.securityGroupNames = ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames"));
- return self();
- }
-
- public T securityGroupNames(String... in) {
- return securityGroupNames(ImmutableSet.copyOf(in));
- }
-
- public ServerWithSecurityGroups build() {
- return new ServerWithSecurityGroups(id, name, links, uuid, tenantId, userId, updated, created, hostId,
- accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses,
- metadata, extendedStatus, extendedAttributes, diskConfig, securityGroupNames);
- }
-
- public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) {
- return super.fromServer(in)
- .securityGroupNames(in.getSecurityGroupNames());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("security_groups")
- private final Set<String> securityGroupNames;
-
- @ConstructorProperties({
- "id", "name", "links", "uuid", "tenant_id", "user_id", "updated", "created", "hostId", "accessIPv4", "accessIPv6", "status", "image", "flavor", "key_name", "config_drive", "addresses", "metadata", "extendedStatus", "extendedAttributes", "OS-DCF:diskConfig", "security_groups"
- })
- protected ServerWithSecurityGroups(String id, @Nullable String name, Set<Link> links, @Nullable String uuid,
- String tenantId, String userId, Date updated, Date created, @Nullable String hostId,
- @Nullable String accessIPv4, @Nullable String accessIPv6, Server.Status status, Resource image,
- Resource flavor, @Nullable String keyName, @Nullable String configDrive,
- Multimap<String, Address> addresses, Map<String, String> metadata,
- @Nullable ServerExtendedStatus extendedStatus, @Nullable ServerExtendedAttributes extendedAttributes,
- @Nullable String diskConfig, Set<String> securityGroupNames) {
- super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
- this.securityGroupNames = ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames"));
- }
-
- public Set<String> getSecurityGroupNames() {
- return this.securityGroupNames;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(securityGroupNames);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ServerWithSecurityGroups that = ServerWithSecurityGroups.class.cast(obj);
- return super.equals(that) && Objects.equal(this.securityGroupNames, that.securityGroupNames);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("securityGroupNames", securityGroupNames);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
deleted file mode 100644
index eba8531..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Information the SimpleTenantUsage extension return data about each Server
- *
- * @author Adam Lowe
-*/
-public class SimpleServerUsage {
-
- /**
- */
- public static enum Status {
-
- UNRECOGNIZED, ACTIVE;
-
- public String value() {
- return name();
- }
-
- public static Status fromValue(String v) {
- try {
- return valueOf(v.toUpperCase());
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
- }
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromSimpleServerUsage(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String instanceName;
- protected double hours;
- protected double flavorMemoryMb;
- protected double flavorLocalGb;
- protected double flavorVcpus;
- protected String tenantId;
- protected String flavorName;
- protected Date instanceCreated;
- protected Date instanceTerminated;
- protected SimpleServerUsage.Status instanceStatus;
- protected long uptime;
-
- /**
- * @see SimpleServerUsage#getInstanceName()
- */
- public T instanceName(String instanceName) {
- this.instanceName = instanceName;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getHours()
- */
- public T hours(double hours) {
- this.hours = hours;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getFlavorMemoryMb()
- */
- public T flavorMemoryMb(double flavorMemoryMb) {
- this.flavorMemoryMb = flavorMemoryMb;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getFlavorLocalGb()
- */
- public T flavorLocalGb(double flavorLocalGb) {
- this.flavorLocalGb = flavorLocalGb;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getFlavorVcpus()
- */
- public T flavorVcpus(double flavorVcpus) {
- this.flavorVcpus = flavorVcpus;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getTenantId()
- */
- public T tenantId(String tenantId) {
- this.tenantId = tenantId;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getFlavorName()
- */
- public T flavorName(String flavorName) {
- this.flavorName = flavorName;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getInstanceCreated()
- */
- public T instanceCreated(Date instanceCreated) {
- this.instanceCreated = instanceCreated;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getInstanceTerminated()
- */
- public T instanceTerminated(Date instanceTerminated) {
- this.instanceTerminated = instanceTerminated;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getInstanceStatus()
- */
- public T instanceStatus(SimpleServerUsage.Status instanceStatus) {
- this.instanceStatus = instanceStatus;
- return self();
- }
-
- /**
- * @see SimpleServerUsage#getUptime()
- */
- public T uptime(long uptime) {
- this.uptime = uptime;
- return self();
- }
-
- public SimpleServerUsage build() {
- return new SimpleServerUsage(instanceName, hours, flavorMemoryMb, flavorLocalGb, flavorVcpus, tenantId, flavorName, instanceCreated, instanceTerminated, instanceStatus, uptime);
- }
-
- public T fromSimpleServerUsage(SimpleServerUsage in) {
- return this
- .instanceName(in.getInstanceName())
- .hours(in.getHours())
- .flavorMemoryMb(in.getFlavorMemoryMb())
- .flavorLocalGb(in.getFlavorLocalGb())
- .flavorVcpus(in.getFlavorVcpus())
- .tenantId(in.getTenantId())
- .flavorName(in.getFlavorName())
- .instanceCreated(in.getInstanceCreated())
- .instanceTerminated(in.getInstanceTerminated())
- .instanceStatus(in.getInstanceStatus())
- .uptime(in.getUptime());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("name")
- private final String instanceName;
- private final double hours;
- @Named("memory_mb")
- private final double flavorMemoryMb;
- @Named("local_gb")
- private final double flavorLocalGb;
- @Named("vcpus")
- private final double flavorVcpus;
- @Named("tenant_id")
- private final String tenantId;
- @Named("flavor")
- private final String flavorName;
- @Named("started_at")
- private final Date instanceCreated;
- @Named("ended_at")
- private final Date instanceTerminated;
- @Named("state")
- private final SimpleServerUsage.Status instanceStatus;
- private final long uptime;
-
- @ConstructorProperties({
- "name", "hours", "memory_mb", "local_gb", "vcpus", "tenant_id", "flavor", "started_at", "ended_at", "state", "uptime"
- })
- protected SimpleServerUsage(String instanceName, double hours, double flavorMemoryMb, double flavorLocalGb, double flavorVcpus, String tenantId, String flavorName, Date instanceCreated, @Nullable Date instanceTerminated, SimpleServerUsage.Status instanceStatus, long uptime) {
- this.instanceName = checkNotNull(instanceName, "instanceName");
- this.hours = hours;
- this.flavorMemoryMb = flavorMemoryMb;
- this.flavorLocalGb = flavorLocalGb;
- this.flavorVcpus = flavorVcpus;
- this.tenantId = checkNotNull(tenantId, "tenantId");
- this.flavorName = checkNotNull(flavorName, "flavorName");
- this.instanceCreated = checkNotNull(instanceCreated, "instanceCreated");
- this.instanceTerminated = instanceTerminated;
- this.instanceStatus = checkNotNull(instanceStatus, "instanceStatus");
- this.uptime = uptime;
- }
-
- public String getInstanceName() {
- return this.instanceName;
- }
-
- public double getHours() {
- return this.hours;
- }
-
- public double getFlavorMemoryMb() {
- return this.flavorMemoryMb;
- }
-
- public double getFlavorLocalGb() {
- return this.flavorLocalGb;
- }
-
- public double getFlavorVcpus() {
- return this.flavorVcpus;
- }
-
- public String getTenantId() {
- return this.tenantId;
- }
-
- public String getFlavorName() {
- return this.flavorName;
- }
-
- public Date getInstanceCreated() {
- return this.instanceCreated;
- }
-
- @Nullable
- public Date getInstanceTerminated() {
- return this.instanceTerminated;
- }
-
- public SimpleServerUsage.Status getInstanceStatus() {
- return this.instanceStatus;
- }
-
- public long getUptime() {
- return this.uptime;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(instanceName, hours, flavorMemoryMb, flavorLocalGb, flavorVcpus, tenantId, flavorName, instanceCreated, instanceTerminated, instanceStatus, uptime);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- SimpleServerUsage that = SimpleServerUsage.class.cast(obj);
- return Objects.equal(this.instanceName, that.instanceName)
- && Objects.equal(this.hours, that.hours)
- && Objects.equal(this.flavorMemoryMb, that.flavorMemoryMb)
- && Objects.equal(this.flavorLocalGb, that.flavorLocalGb)
- && Objects.equal(this.flavorVcpus, that.flavorVcpus)
- && Objects.equal(this.tenantId, that.tenantId)
- && Objects.equal(this.flavorName, that.flavorName)
- && Objects.equal(this.instanceCreated, that.instanceCreated)
- && Objects.equal(this.instanceTerminated, that.instanceTerminated)
- && Objects.equal(this.instanceStatus, that.instanceStatus)
- && Objects.equal(this.uptime, that.uptime);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("instanceName", instanceName).add("hours", hours).add("flavorMemoryMb", flavorMemoryMb).add("flavorLocalGb", flavorLocalGb).add("flavorVcpus", flavorVcpus).add("tenantId", tenantId).add("flavorName", flavorName).add("instanceCreated", instanceCreated).add("instanceTerminated", instanceTerminated).add("instanceStatus", instanceStatus).add("uptime", uptime);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
deleted file mode 100644
index 61cec18..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-import java.util.Set;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Information the SimpleTenantUsage extension returns data about each tenant
- *
- * @author Adam Lowe
-*/
-public class SimpleTenantUsage {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromSimpleTenantUsage(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String tenantId;
- protected double totalLocalGbUsage;
- protected double totalVcpusUsage;
- protected double totalMemoryMbUsage;
- protected double totalHours;
- protected Date start;
- protected Date stop;
- protected Set<SimpleServerUsage> serverUsages = ImmutableSet.of();
-
- /**
- * @see SimpleTenantUsage#getTenantId()
- */
- public T tenantId(String tenantId) {
- this.tenantId = tenantId;
- return self();
- }
-
- /**
- * @see SimpleTenantUsage#getTotalLocalGbUsage()
- */
- public T totalLocalGbUsage(double totalLocalGbUsage) {
- this.totalLocalGbUsage = totalLocalGbUsage;
- return self();
- }
-
- /**
- * @see SimpleTenantUsage#getTotalVcpusUsage()
- */
- public T totalVcpusUsage(double totalVcpusUsage) {
- this.totalVcpusUsage = totalVcpusUsage;
- return self();
- }
-
- /**
- * @see SimpleTenantUsage#getTotalMemoryMbUsage()
- */
- public T totalMemoryMbUsage(double totalMemoryMbUsage) {
- this.totalMemoryMbUsage = totalMemoryMbUsage;
- return self();
- }
-
- /**
- * @see SimpleTenantUsage#getTotalHours()
- */
- public T totalHours(double totalHours) {
- this.totalHours = totalHours;
- return self();
- }
-
- /**
- * @see SimpleTenantUsage#getStart()
- */
- public T start(Date start) {
- this.start = start;
- return self();
- }
-
- /**
- * @see SimpleTenantUsage#getStop()
- */
- public T stop(Date stop) {
- this.stop = stop;
- return self();
- }
-
- /**
- * @see SimpleTenantUsage#getServerUsages()
- */
- public T serverUsages(Set<SimpleServerUsage> serverUsages) {
- this.serverUsages = ImmutableSet.copyOf(checkNotNull(serverUsages, "serverUsages"));
- return self();
- }
-
- public T serverUsages(SimpleServerUsage... in) {
- return serverUsages(ImmutableSet.copyOf(in));
- }
-
- public SimpleTenantUsage build() {
- return new SimpleTenantUsage(tenantId, totalLocalGbUsage, totalVcpusUsage, totalMemoryMbUsage, totalHours, start, stop, serverUsages);
- }
-
- public T fromSimpleTenantUsage(SimpleTenantUsage in) {
- return this
- .tenantId(in.getTenantId())
- .totalLocalGbUsage(in.getTotalLocalGbUsage())
- .totalVcpusUsage(in.getTotalVcpusUsage())
- .totalMemoryMbUsage(in.getTotalMemoryMbUsage())
- .totalHours(in.getTotalHours())
- .start(in.getStart())
- .stop(in.getStop())
- .serverUsages(in.getServerUsages());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("tenant_id")
- private final String tenantId;
- @Named("total_local_gb_usage")
- private final double totalLocalGbUsage;
- @Named("total_vcpus_usage")
- private final double totalVcpusUsage;
- @Named("total_memory_mb_usage")
- private final double totalMemoryMbUsage;
- @Named("total_hours")
- private final double totalHours;
- private final Date start;
- private final Date stop;
- @Named("server_usages")
- private final Set<SimpleServerUsage> serverUsages;
-
- @ConstructorProperties({
- "tenant_id", "total_local_gb_usage", "total_vcpus_usage", "total_memory_mb_usage", "total_hours", "start", "stop", "server_usages"
- })
- protected SimpleTenantUsage(String tenantId, double totalLocalGbUsage, double totalVcpusUsage, double totalMemoryMbUsage, double totalHours, @Nullable Date start, @Nullable Date stop, @Nullable Set<SimpleServerUsage> serverUsages) {
- this.tenantId = checkNotNull(tenantId, "tenantId");
- this.totalLocalGbUsage = totalLocalGbUsage;
- this.totalVcpusUsage = totalVcpusUsage;
- this.totalMemoryMbUsage = totalMemoryMbUsage;
- this.totalHours = totalHours;
- this.start = start;
- this.stop = stop;
- this.serverUsages = serverUsages == null ? ImmutableSet.<SimpleServerUsage>of() : ImmutableSet.copyOf(serverUsages);
- }
-
- public String getTenantId() {
- return this.tenantId;
- }
-
- public double getTotalLocalGbUsage() {
- return this.totalLocalGbUsage;
- }
-
- public double getTotalVcpusUsage() {
- return this.totalVcpusUsage;
- }
-
- public double getTotalMemoryMbUsage() {
- return this.totalMemoryMbUsage;
- }
-
- public double getTotalHours() {
- return this.totalHours;
- }
-
- @Nullable
- public Date getStart() {
- return this.start;
- }
-
- @Nullable
- public Date getStop() {
- return this.stop;
- }
-
- public Set<SimpleServerUsage> getServerUsages() {
- return this.serverUsages;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(tenantId, totalLocalGbUsage, totalVcpusUsage, totalMemoryMbUsage, totalHours, start, stop, serverUsages);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- SimpleTenantUsage that = SimpleTenantUsage.class.cast(obj);
- return Objects.equal(this.tenantId, that.tenantId)
- && Objects.equal(this.totalLocalGbUsage, that.totalLocalGbUsage)
- && Objects.equal(this.totalVcpusUsage, that.totalVcpusUsage)
- && Objects.equal(this.totalMemoryMbUsage, that.totalMemoryMbUsage)
- && Objects.equal(this.totalHours, that.totalHours)
- && Objects.equal(this.start, that.start)
- && Objects.equal(this.stop, that.stop)
- && Objects.equal(this.serverUsages, that.serverUsages);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("tenantId", tenantId).add("totalLocalGbUsage", totalLocalGbUsage).add("totalVcpusUsage", totalVcpusUsage).add("totalMemoryMbUsage", totalMemoryMbUsage).add("totalHours", totalHours).add("start", start).add("stop", stop).add("serverUsages", serverUsages);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
deleted file mode 100644
index c90f40e..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Class TenantIdAndName
- *
- * @author Adrian Cole
-*/
-public class TenantIdAndName {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromTenantIdAndName(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String tenantId;
- protected String name;
-
- /**
- * @see TenantIdAndName#getTenantId()
- */
- public T tenantId(String tenantId) {
- this.tenantId = tenantId;
- return self();
- }
-
- /**
- * @see TenantIdAndName#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- public TenantIdAndName build() {
- return new TenantIdAndName(tenantId, name);
- }
-
- public T fromTenantIdAndName(TenantIdAndName in) {
- return this
- .tenantId(in.getTenantId())
- .name(in.getName());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("tenant_id")
- private final String tenantId;
- private final String name;
-
- @ConstructorProperties({
- "tenant_id", "name"
- })
- protected TenantIdAndName(String tenantId, String name) {
- this.tenantId = checkNotNull(tenantId, "tenantId");
- this.name = checkNotNull(name, "name");
- }
-
- public String getTenantId() {
- return this.tenantId;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(tenantId, name);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- TenantIdAndName that = TenantIdAndName.class.cast(obj);
- return Objects.equal(this.tenantId, that.tenantId)
- && Objects.equal(this.name, that.name);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("tenantId", tenantId).add("name", name);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
deleted file mode 100644
index b77f242..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Represents a Virtual Interface (VIF)
- *
- * @author Adam Lowe
- * @see org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi
-*/
-public class VirtualInterface {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromVirtualInterface(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected String macAddress;
-
- /**
- * @see VirtualInterface#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see VirtualInterface#getMacAddress()
- */
- public T macAddress(String macAddress) {
- this.macAddress = macAddress;
- return self();
- }
-
- public VirtualInterface build() {
- return new VirtualInterface(id, macAddress);
- }
-
- public T fromVirtualInterface(VirtualInterface in) {
- return this
- .id(in.getId())
- .macAddress(in.getMacAddress());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- @Named("mac_address")
- private final String macAddress;
-
- @ConstructorProperties({
- "id", "mac_address"
- })
- protected VirtualInterface(String id, String macAddress) {
- this.id = checkNotNull(id, "id");
- this.macAddress = checkNotNull(macAddress, "macAddress");
- }
-
- public String getId() {
- return this.id;
- }
-
- public String getMacAddress() {
- return this.macAddress;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, macAddress);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- VirtualInterface that = VirtualInterface.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.macAddress, that.macAddress);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("macAddress", macAddress);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
deleted file mode 100644
index 7fecfb2..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * An OpenStack Nova Volume
-*/
-public class Volume {
-
- /**
- */
- public static enum Status {
- CREATING, AVAILABLE, IN_USE, DELETING, ERROR, UNRECOGNIZED;
- public String value() {
- return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
- }
-
- @Override
- public String toString() {
- return value();
- }
-
- public static Status fromValue(String status) {
- try {
- return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(status, "status")));
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
- }
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromVolume(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected Volume.Status status;
- protected int size;
- protected String zone;
- protected Date created;
- protected Set<VolumeAttachment> attachments = ImmutableSet.of();
- protected String volumeType;
- protected String snapshotId;
- protected String name;
- protected String description;
- protected Map<String, String> metadata = ImmutableMap.of();
-
- /**
- * @see Volume#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see Volume#getStatus()
- */
- public T status(Volume.Status status) {
- this.status = status;
- return self();
- }
-
- /**
- * @see Volume#getSize()
- */
- public T size(int size) {
- this.size = size;
- return self();
- }
-
- /**
- * @see Volume#getZone()
- */
- public T zone(String zone) {
- this.zone = zone;
- return self();
- }
-
- /**
- * @see Volume#getCreated()
- */
- public T created(Date created) {
- this.created = created;
- return self();
- }
-
- /**
- * @see Volume#getAttachments()
- */
- public T attachments(Set<VolumeAttachment> attachments) {
- this.attachments = ImmutableSet.copyOf(checkNotNull(attachments, "attachments"));
- return self();
- }
-
- public T attachments(VolumeAttachment... in) {
- return attachments(ImmutableSet.copyOf(in));
- }
-
- /**
- * @see Volume#getVolumeType()
- */
- public T volumeType(String volumeType) {
- this.volumeType = volumeType;
- return self();
- }
-
- /**
- * @see Volume#getSnapshotId()
- */
- public T snapshotId(String snapshotId) {
- this.snapshotId = snapshotId;
- return self();
- }
-
- /**
- * @see Volume#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see Volume#getDescription()
- */
- public T description(String description) {
- this.description = description;
- return self();
- }
-
- /**
- * @see Volume#getMetadata()
- */
- public T metadata(Map<String, String> metadata) {
- this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
- return self();
- }
-
- public Volume build() {
- return new Volume(id, status, size, zone, created, attachments, volumeType, snapshotId, name, description, metadata);
- }
-
- public T fromVolume(Volume in) {
- return this
- .id(in.getId())
- .status(in.getStatus())
- .size(in.getSize())
- .zone(in.getZone())
- .created(in.getCreated())
- .attachments(in.getAttachments())
- .volumeType(in.getVolumeType())
- .snapshotId(in.getSnapshotId())
- .name(in.getName())
- .description(in.getDescription())
- .metadata(in.getMetadata());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- private final Volume.Status status;
- private final int size;
- @Named("availabilityZone")
- private final String zone;
- @Named("createdAt")
- private final Date created;
- private final Set<VolumeAttachment> attachments;
- private final String volumeType;
- private final String snapshotId;
- @Named("displayName")
- private final String name;
- @Named("displayDescription")
- private final String description;
- private final Map<String, String> metadata;
-
- @ConstructorProperties({
- "id", "status", "size", "availabilityZone", "createdAt", "attachments", "volumeType", "snapshotId", "displayName", "displayDescription", "metadata"
- })
- protected Volume(String id, Volume.Status status, int size, String zone, Date created, @Nullable Set<VolumeAttachment> attachments, @Nullable String volumeType, @Nullable String snapshotId, @Nullable String name, @Nullable String description, @Nullable Map<String, String> metadata) {
- this.id = checkNotNull(id, "id");
- this.status = checkNotNull(status, "status");
- this.size = size;
- this.zone = checkNotNull(zone, "zone");
- this.created = checkNotNull(created, "created");
- this.attachments = attachments == null ? ImmutableSet.<VolumeAttachment>of() : ImmutableSet.copyOf(attachments);
- this.volumeType = volumeType;
- this.snapshotId = snapshotId;
- this.name = name;
- this.description = description;
- this.metadata = metadata == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(metadata);
- }
-
- /**
- * @return the id of this volume
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * @return the status of this volume
- */
- public Volume.Status getStatus() {
- return this.status;
- }
-
- /**
- * @return the size in GB of this volume
- */
- public int getSize() {
- return this.size;
- }
-
- /**
- * @return the availabilityZone containing this volume
- */
- public String getZone() {
- return this.zone;
- }
-
- /**
- * @return the time this volume was created
- */
- public Date getCreated() {
- return this.created;
- }
-
- /**
- * @return the set of attachments (to Servers)
- */
- public Set<VolumeAttachment> getAttachments() {
- return this.attachments;
- }
-
- /**
- * @return the type of this volume
- */
- @Nullable
- public String getVolumeType() {
- return this.volumeType;
- }
-
- @Nullable
- public String getSnapshotId() {
- return this.snapshotId;
- }
-
- /**
- * @return the name of this volume - as displayed in the openstack console
- */
- @Nullable
- public String getName() {
- return this.name;
- }
-
- /**
- * @return the description of this volume - as displayed in the openstack console
- */
- @Nullable
- public String getDescription() {
- return this.description;
- }
-
- public Map<String, String> getMetadata() {
- return this.metadata;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, status, size, zone, created, attachments, volumeType, snapshotId, name, description, metadata);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Volume that = Volume.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.status, that.status)
- && Objects.equal(this.size, that.size)
- && Objects.equal(this.zone, that.zone)
- && Objects.equal(this.created, that.created)
- && Objects.equal(this.attachments, that.attachments)
- && Objects.equal(this.volumeType, that.volumeType)
- && Objects.equal(this.snapshotId, that.snapshotId)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.description, that.description)
- && Objects.equal(this.metadata, that.metadata);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("status", status).add("size", size).add("zone", zone).add("created", created).add("attachments", attachments).add("volumeType", volumeType).add("snapshotId", snapshotId).add("name", name).add("description", description).add("metadata", metadata);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
deleted file mode 100644
index 894f85b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * An OpenStack Nova Volume Attachment (describes how Volumes are attached to Servers)
-*/
-public class VolumeAttachment {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromVolumeAttachment(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected String volumeId;
- protected String serverId;
- protected String device;
-
- /**
- * @see VolumeAttachment#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see VolumeAttachment#getVolumeId()
- */
- public T volumeId(String volumeId) {
- this.volumeId = volumeId;
- return self();
- }
-
- /**
- * @see VolumeAttachment#getServerId()
- */
- public T serverId(String serverId) {
- this.serverId = serverId;
- return self();
- }
-
- /**
- * @see VolumeAttachment#getDevice()
- */
- public T device(String device) {
- this.device = device;
- return self();
- }
-
- public VolumeAttachment build() {
- return new VolumeAttachment(id, volumeId, serverId, device);
- }
-
- public T fromVolumeAttachment(VolumeAttachment in) {
- return this
- .id(in.getId())
- .volumeId(in.getVolumeId())
- .serverId(in.getServerId())
- .device(in.getDevice());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- private final String volumeId;
- private final String serverId;
- private final String device;
-
- @ConstructorProperties({
- "id", "volumeId", "serverId", "device"
- })
- protected VolumeAttachment(String id, String volumeId, @Nullable String serverId, @Nullable String device) {
- this.id = checkNotNull(id, "id");
- this.volumeId = checkNotNull(volumeId, "volumeId");
- this.serverId = serverId;
- this.device = device;
- }
-
- /**
- * @return the attachment id (typically the same as #getVolumeId())
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * @return the id of the volume attached
- */
- public String getVolumeId() {
- return this.volumeId;
- }
-
- /**
- * @return the id of the server the volume is attached to
- */
- @Nullable
- public String getServerId() {
- return this.serverId;
- }
-
- /**
- * @return the device name (e.g. "/dev/vdc")
- */
- @Nullable
- public String getDevice() {
- return this.device;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, volumeId, serverId, device);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- VolumeAttachment that = VolumeAttachment.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.volumeId, that.volumeId)
- && Objects.equal(this.serverId, that.serverId)
- && Objects.equal(this.device, that.device);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("volumeId", volumeId).add("serverId", serverId).add("device", device);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeSnapshot.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeSnapshot.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeSnapshot.java
deleted file mode 100644
index bbd45a4..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeSnapshot.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * An OpenStack Nova Volume Snapshot
-*/
-public class VolumeSnapshot {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromVolumeSnapshot(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected String volumeId;
- protected Volume.Status status;
- protected int size;
- protected Date created;
- protected String name;
- protected String description;
-
- /**
- * @see VolumeSnapshot#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see VolumeSnapshot#getVolumeId()
- */
- public T volumeId(String volumeId) {
- this.volumeId = volumeId;
- return self();
- }
-
- /**
- * @see VolumeSnapshot#getStatus()
- */
- public T status(Volume.Status status) {
- this.status = status;
- return self();
- }
-
- /**
- * @see VolumeSnapshot#getSize()
- */
- public T size(int size) {
- this.size = size;
- return self();
- }
-
- /**
- * @see VolumeSnapshot#getCreated()
- */
- public T created(Date created) {
- this.created = created;
- return self();
- }
-
- /**
- * @see VolumeSnapshot#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see VolumeSnapshot#getDescription()
- */
- public T description(String description) {
- this.description = description;
- return self();
- }
-
- public VolumeSnapshot build() {
- return new VolumeSnapshot(id, volumeId, status, size, created, name, description);
- }
-
- public T fromVolumeSnapshot(VolumeSnapshot in) {
- return this
- .id(in.getId())
- .volumeId(in.getVolumeId())
- .status(in.getStatus())
- .size(in.getSize())
- .created(in.getCreated())
- .name(in.getName())
- .description(in.getDescription());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- private final String volumeId;
- private final Volume.Status status;
- private final int size;
- @Named("createdAt")
- private final Date created;
- @Named("displayName")
- private final String name;
- @Named("displayDescription")
- private final String description;
-
- @ConstructorProperties({
- "id", "volumeId", "status", "size", "createdAt", "displayName", "displayDescription"
- })
- protected VolumeSnapshot(String id, String volumeId, Volume.Status status, int size, @Nullable Date created, @Nullable String name, @Nullable String description) {
- this.id = checkNotNull(id, "id");
- this.volumeId = checkNotNull(volumeId, "volumeId");
- this.status = checkNotNull(status, "status");
- this.size = size;
- this.created = created;
- this.name = name;
- this.description = description;
- }
-
- /**
- * @return the id of this snapshot
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * @return the id of the Volume this snapshot was taken from
- */
- public String getVolumeId() {
- return this.volumeId;
- }
-
- /**
- * @return the status of this snapshot
- */
- public Volume.Status getStatus() {
- return this.status;
- }
-
- /**
- * @return the size in GB of the volume this snapshot was taken from
- */
- public int getSize() {
- return this.size;
- }
-
- /**
- * @return the data the snapshot was taken
- */
- @Nullable
- public Date getCreated() {
- return this.created;
- }
-
- /**
- * @return the name of this snapshot - as displayed in the openstack console
- */
- @Nullable
- public String getName() {
- return this.name;
- }
-
- /**
- * @return the description of this snapshot - as displayed in the openstack console
- */
- @Nullable
- public String getDescription() {
- return this.description;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, volumeId, status, size, created, name, description);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- VolumeSnapshot that = VolumeSnapshot.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.volumeId, that.volumeId)
- && Objects.equal(this.status, that.status)
- && Objects.equal(this.size, that.size)
- && Objects.equal(this.created, that.created)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.description, that.description);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("volumeId", volumeId).add("status", status).add("size", size).add("created", created).add("name", name).add("description", description);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeType.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeType.java
deleted file mode 100644
index 43a0aba..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeType.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-import java.util.Map;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Volume Type used in the Volume Type Extension for Nova
- *
- * @see org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi
-*/
-public class VolumeType {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromVolumeType(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected String name;
- protected Date created;
- protected Date updated;
- protected Map<String, String> extraSpecs = ImmutableMap.of();
-
- /**
- * @see VolumeType#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see VolumeType#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see VolumeType#getCreated()
- */
- public T created(Date created) {
- this.created = created;
- return self();
- }
-
- /**
- * @see VolumeType#getUpdated()
- */
- public T updated(Date updated) {
- this.updated = updated;
- return self();
- }
-
- /**
- * @see VolumeType#getExtraSpecs()
- */
- public T extraSpecs(Map<String, String> extraSpecs) {
- this.extraSpecs = ImmutableMap.copyOf(checkNotNull(extraSpecs, "extraSpecs"));
- return self();
- }
-
- public VolumeType build() {
- return new VolumeType(id, name, created, updated, extraSpecs);
- }
-
- public T fromVolumeType(VolumeType in) {
- return this
- .id(in.getId())
- .name(in.getName())
- .created(in.getCreated())
- .updated(in.getUpdated().orNull())
- .extraSpecs(in.getExtraSpecs());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- private final String name;
- @Named("created_at")
- private final Date created;
- @Named("updated_at")
- private final Optional<Date> updated;
- @Named("extra_specs")
- private final Map<String, String> extraSpecs;
-
- @ConstructorProperties({
- "id", "name", "created_at", "updated_at", "extra_specs"
- })
- protected VolumeType(String id, String name, Date created, @Nullable Date updated, Map<String, String> extraSpecs) {
- this.id = checkNotNull(id, "id");
- this.name = checkNotNull(name, "name");
- this.created = checkNotNull(created, "created");
- this.updated = Optional.fromNullable(updated);
- this.extraSpecs = ImmutableMap.copyOf(checkNotNull(extraSpecs, "extraSpecs"));
- }
-
- public String getId() {
- return this.id;
- }
-
- public String getName() {
- return this.name;
- }
-
- /**
- * The Date the VolumeType was created
- */
- public Date getCreated() {
- return this.created;
- }
-
- /**
- * The Date the VolumeType as last updated - absent if no updates have taken place
- */
- public Optional<Date> getUpdated() {
- return this.updated;
- }
-
- public Map<String, String> getExtraSpecs() {
- return this.extraSpecs;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, name, created, updated, extraSpecs);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- VolumeType that = VolumeType.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.created, that.created)
- && Objects.equal(this.updated, that.updated)
- && Objects.equal(this.extraSpecs, that.extraSpecs);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("name", name).add("created", created).add("updated", updated).add("extraSpecs", extraSpecs);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
deleted file mode 100644
index 6946961..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.domain.zonescoped;
-
-import com.google.common.base.Objects;
-import com.google.gson.annotations.SerializedName;
-
-import java.beans.ConstructorProperties;
-
-/**
- * @author Inbar Stolberg
- */
-public class AvailabilityZone {
-
- @SerializedName("zoneName")
- private final String name;
- private final ZoneState state;
-
- @ConstructorProperties({"zoneName" , "zoneState"})
- protected AvailabilityZone(String name, ZoneState state) {
- this.name = name;
- this.state = state;
- }
-
- public String getName() {
- return name;
- }
-
- public ZoneState getState() {
- return state;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name, state);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this != obj) return false;
- if (obj == null || getClass() != obj.getClass()) return false;
- AvailabilityZone that = AvailabilityZone.class.cast(obj);
- return Objects.equal(this.name, that.name) && Objects.equal(this.state, that.state);
- }
-
- protected Objects.ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("name", name)
- .add("state", state);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/FlavorInZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/FlavorInZone.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/FlavorInZone.java
deleted file mode 100644
index 5836ac2..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/FlavorInZone.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain.zonescoped;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.openstack.nova.v2_0.domain.Flavor;
-
-/**
- * @author Adrian Cole
- */
-public class FlavorInZone extends ZoneAndId {
- protected final Flavor image;
-
- public FlavorInZone(Flavor image, String zoneId) {
- super(zoneId, checkNotNull(image, "image").getId());
- this.image = image;
- }
-
- public Flavor getFlavor() {
- return image;
- }
-
- // superclass hashCode/equals are good enough, and help us use ZoneAndId and FlavorInZone
- // interchangeably as Map keys
-
- @Override
- public String toString() {
- return "[image=" + image + ", zoneId=" + zoneId + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ImageInZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ImageInZone.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ImageInZone.java
deleted file mode 100644
index b7d03f4..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ImageInZone.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain.zonescoped;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-
-/**
- * @author Adrian Cole
- */
-public class ImageInZone extends ZoneAndId {
- protected final Image image;
-
- public ImageInZone(Image image, String zoneId) {
- super(zoneId, checkNotNull(image, "image").getId());
- this.image = image;
- }
-
- public Image getImage() {
- return image;
- }
-
- // superclass hashCode/equals are good enough, and help us use ZoneAndId and ImageInZone
- // interchangeably as Map keys
-
- @Override
- public String toString() {
- return "[image=" + image + ", zoneId=" + zoneId + "]";
- }
-
-}
[40/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardwareTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardwareTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardwareTest.java
new file mode 100644
index 0000000..b3a0e30
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardwareTest.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.openstack.nova.v2_0.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.FlavorInZone;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests the function used to transform Flavor objects into Hardware objects
+ *
+ * @author Matt Stephenson, Adrian Cole
+ */
+@Test(testName = "FlavorInZoneToHardwareTest")
+public class FlavorInZoneToHardwareTest {
+ Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova").description(
+ "openstack-nova").build();
+ Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1").scope(
+ LocationScope.ZONE).parent(provider).build();
+ Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
+ .<String, Location> of("az-1.region-a.geo-1", zone));
+
+ @Test
+ public void testConversionWhereLocationFound() {
+
+ UUID id = UUID.randomUUID();
+
+ FlavorInZone flavorInZoneToConvert = new FlavorInZone(Flavor.builder().id(id.toString())
+ .name("Test Flavor " + id).ram(262144).disk(10000).vcpus(16).build(), "az-1.region-a.geo-1");
+
+ Hardware converted = new FlavorInZoneToHardware(locationIndex).apply(flavorInZoneToConvert);
+
+ Flavor flavorToConvert = flavorInZoneToConvert.getFlavor();
+ assertEquals(converted.getName(), flavorToConvert.getName());
+ assertEquals(converted.getId(), flavorInZoneToConvert.slashEncode());
+ assertEquals(converted.getProviderId(), flavorToConvert.getId());
+ assertEquals(converted.getLocation(), locationIndex.get().get("az-1.region-a.geo-1"));
+
+ assertEquals(converted.getRam(), flavorToConvert.getRam());
+
+ assertNotNull(converted.getProcessors());
+ assertFalse(converted.getProcessors().isEmpty());
+ assertEquals(converted.getProcessors().iterator().next().getCores(), (double) flavorToConvert.getVcpus());
+
+ assertNotNull(converted.getVolumes());
+ assertFalse(converted.getVolumes().isEmpty());
+ assertEquals(converted.getVolumes().iterator().next().getSize(), Float.valueOf(flavorToConvert.getDisk()));
+
+ }
+
+ @Test(expectedExceptions = IllegalStateException.class)
+ public void testConversionWhereLocationNotFound() {
+
+ UUID id = UUID.randomUUID();
+
+ FlavorInZone flavorInZoneToConvert = new FlavorInZone(Flavor.builder().id(id.toString())
+ .name("Test Flavor " + id).ram(262144).disk(10000).vcpus(16).build(), "South");
+ new FlavorInZoneToHardware(locationIndex).apply(flavorInZoneToConvert);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImageTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImageTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImageTest.java
new file mode 100644
index 0000000..dfc15f4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImageTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextModule;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests the function that transforms nova-specific images to generic images.
+ *
+ * @author Matt Stephenson, Adrian Cole
+ */
+@Test(testName = "ImageInZoneToHardwareTest")
+public class ImageInZoneToImageTest {
+
+ Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova").description(
+ "openstack-nova").build();
+ Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1").scope(
+ LocationScope.ZONE).parent(provider).build();
+ Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
+ .<String, Location> of("az-1.region-a.geo-1", zone));
+
+ @Test
+ public void testConversionWhereLocationFound() {
+ UUID id = UUID.randomUUID();
+ Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).status(Image.Status.DELETED).build();
+ OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86",
+ "My Test OS", true);
+ ImageInZoneToImage converter = new ImageInZoneToImage(NovaComputeServiceContextModule.toPortableImageStatus,
+ constant(operatingSystem), locationIndex);
+
+ ImageInZone novaImageInZoneToConvert = new ImageInZone(novaImageToConvert, "az-1.region-a.geo-1");
+
+ org.jclouds.compute.domain.Image convertedImage = converter.apply(novaImageInZoneToConvert);
+
+ assertEquals(convertedImage.getId(), novaImageInZoneToConvert.slashEncode());
+ assertEquals(convertedImage.getProviderId(), novaImageToConvert.getId());
+ assertEquals(convertedImage.getLocation(), locationIndex.get().get("az-1.region-a.geo-1"));
+
+ assertEquals(convertedImage.getName(), novaImageToConvert.getName());
+ assertEquals(convertedImage.getStatus(), org.jclouds.compute.domain.Image.Status.DELETED);
+ assertEquals(convertedImage.getOperatingSystem(), operatingSystem);
+ }
+
+ @Test(expectedExceptions = IllegalStateException.class)
+ public void testConversionWhereLocationNotFound() {
+ UUID id = UUID.randomUUID();
+ Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).build();
+ OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86",
+ "My Test OS", true);
+ ImageInZoneToImage converter = new ImageInZoneToImage(NovaComputeServiceContextModule.toPortableImageStatus,
+ constant(operatingSystem), locationIndex);
+
+ ImageInZone novaImageInZoneToConvert = new ImageInZone(novaImageToConvert, "South");
+
+ converter.apply(novaImageInZoneToConvert);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Function<Image, OperatingSystem> constant(OperatingSystem operatingSystem) {
+ return Function.class.cast(Functions.constant(operatingSystem));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystemTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystemTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystemTest.java
new file mode 100644
index 0000000..2fdc0a4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystemTest.java
@@ -0,0 +1,192 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+
+/**
+ * Tests for the function for transforming a nova specific Image into a generic
+ * OperatingSystem object.
+ *
+ * @author Matt Stephenson
+ */
+public class ImageToOperatingSystemTest {
+
+ @Test(dataProvider = "getOsFamilyValues")
+ public void testOsFamilyValues(OsFamily family) {
+
+ Image imageToConvert = Image.builder().id("id-" + family.name()).name(family.name()).build();
+
+ ImageToOperatingSystem converter = new ImageToOperatingSystem(
+ new HashMap<OsFamily, Map<String, String>>());
+
+ OperatingSystem convertedOs = converter.apply(imageToConvert);
+
+ assertEquals(convertedOs.getName(), imageToConvert.getName());
+ assertEquals(convertedOs.getFamily(), family);
+ assertEquals(convertedOs.getDescription(), imageToConvert.getName());
+ assertEquals(convertedOs.getVersion(), null);
+ assertEquals(convertedOs.getArch(), null);
+ assertTrue(convertedOs.is64Bit());
+ }
+
+ @DataProvider
+ public Object[][] getOsFamilyValues() {
+ return Iterables.toArray(
+ Iterables.transform(Arrays.asList(OsFamily.values()), new Function<OsFamily, Object[]>() {
+ @Override
+ public Object[] apply(OsFamily osFamily) {
+ return new Object[] { osFamily };
+ }
+ }), Object[].class);
+ }
+
+ @Test
+ public void testWindowsServer2008R2x64() {
+ String name = "Windows Server 2008 R2 x64";
+
+ Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
+
+ Map<OsFamily, Map<String, String>> osFamilyMap = Maps.newHashMap();
+ osFamilyMap.put(OsFamily.WINDOWS, ImmutableMap.of("Server 2008 R2", "Server-2008-R2"));
+
+ ImageToOperatingSystem converter = new ImageToOperatingSystem(osFamilyMap);
+
+ OperatingSystem convertedOs = converter.apply(imageToConvert);
+
+ assertEquals(convertedOs.getName(), imageToConvert.getName());
+ assertEquals(convertedOs.getFamily(), OsFamily.WINDOWS);
+ assertEquals(convertedOs.getDescription(), imageToConvert.getName());
+ assertEquals(convertedOs.getVersion(), "Server-2008-R2");
+ assertEquals(convertedOs.getArch(), null);
+ assertTrue(convertedOs.is64Bit());
+ }
+
+ @Test
+ public void testWindows98x86() {
+ String name = "Windows 98 x86";
+
+ Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
+
+ Map<OsFamily, Map<String, String>> osFamilyMap = Maps.newHashMap();
+ osFamilyMap.put(OsFamily.WINDOWS, ImmutableMap.of("98", "98"));
+
+ ImageToOperatingSystem converter = new ImageToOperatingSystem(osFamilyMap);
+
+ OperatingSystem convertedOs = converter.apply(imageToConvert);
+
+ assertEquals(convertedOs.getName(), imageToConvert.getName());
+ assertEquals(convertedOs.getFamily(), OsFamily.WINDOWS);
+ assertEquals(convertedOs.getDescription(), imageToConvert.getName());
+ assertEquals(convertedOs.getVersion(), "98");
+ assertEquals(convertedOs.getArch(), null);
+ assertFalse(convertedOs.is64Bit());
+ }
+
+ @Test
+ public void testRHEL() {
+ String name = "Red Hat EL";
+
+ Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
+
+ ImageToOperatingSystem converter = new ImageToOperatingSystem(
+ new HashMap<OsFamily, Map<String, String>>());
+
+ OperatingSystem convertedOs = converter.apply(imageToConvert);
+
+ assertEquals(convertedOs.getName(), imageToConvert.getName());
+ assertEquals(convertedOs.getFamily(), OsFamily.RHEL);
+ assertEquals(convertedOs.getDescription(), imageToConvert.getName());
+ assertEquals(convertedOs.getVersion(), null);
+ assertEquals(convertedOs.getArch(), null);
+ assertTrue(convertedOs.is64Bit());
+ }
+
+ @Test
+ public void testOEL() {
+ String name = "Oracle EL";
+
+ Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
+
+ ImageToOperatingSystem converter = new ImageToOperatingSystem(
+ new HashMap<OsFamily, Map<String, String>>());
+
+ OperatingSystem convertedOs = converter.apply(imageToConvert);
+
+ assertEquals(convertedOs.getName(), imageToConvert.getName());
+ assertEquals(convertedOs.getFamily(), OsFamily.OEL);
+ assertEquals(convertedOs.getDescription(), imageToConvert.getName());
+ assertEquals(convertedOs.getVersion(), null);
+ assertEquals(convertedOs.getArch(), null);
+ assertTrue(convertedOs.is64Bit());
+ }
+
+
+ ImageToOperatingSystem converterForUbuntu = new ImageToOperatingSystem(ImmutableMap.<OsFamily, Map<String, String>> of(
+ OsFamily.UBUNTU, ImmutableMap.of("lucid", "10.04", "maverick", "10.10", "natty", "11.04", "oneiric",
+ "11.10")));
+ @Test
+ public void testTryStackOneric() {
+
+ String name = "oneiric-server-cloudimg-amd64";
+
+ Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
+
+ OperatingSystem convertedOs = converterForUbuntu.apply(imageToConvert);
+
+ assertEquals(convertedOs.getName(), imageToConvert.getName());
+ assertEquals(convertedOs.getFamily(), OsFamily.UBUNTU);
+ assertEquals(convertedOs.getDescription(), imageToConvert.getName());
+ assertEquals(convertedOs.getVersion(), "11.10");
+ assertEquals(convertedOs.getArch(), null);
+ assertTrue(convertedOs.is64Bit());
+ }
+
+ @Test
+ public void testTryStackNatty() {
+
+ String name = "natty-server-cloudimg-amd64";
+
+ Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
+
+ OperatingSystem convertedOs = converterForUbuntu.apply(imageToConvert);
+
+ assertEquals(convertedOs.getName(), imageToConvert.getName());
+ assertEquals(convertedOs.getFamily(), OsFamily.UBUNTU);
+ assertEquals(convertedOs.getDescription(), imageToConvert.getName());
+ assertEquals(convertedOs.getVersion(), "11.04");
+ assertEquals(convertedOs.getArch(), null);
+ assertTrue(convertedOs.is64Bit());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroupTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroupTest.java
new file mode 100644
index 0000000..c884987
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroupTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.collect.Iterables.transform;
+import static org.jclouds.openstack.nova.v2_0.compute.functions.NovaSecurityGroupToSecurityGroupTest.securityGroupWithCidr;
+import static org.jclouds.openstack.nova.v2_0.compute.functions.NovaSecurityGroupToSecurityGroupTest.securityGroupWithGroup;
+import static org.testng.Assert.assertEquals;
+
+import java.util.Map;
+
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Andrew Bayer
+ */
+@Test(groups = "unit", testName = "NovaSecurityGroupInZoneToSecurityGroupTest")
+public class NovaSecurityGroupInZoneToSecurityGroupTest {
+
+ Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova")
+ .description("openstack-nova").build();
+ Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1")
+ .scope(LocationScope.ZONE).parent(provider).build();
+ Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
+ .<String, Location>of("az-1.region-a.geo-1", zone));
+
+
+ @Test
+ public void testApplyWithGroup() {
+ NovaSecurityGroupInZoneToSecurityGroup parser = createGroupParser();
+
+ SecurityGroupInZone origGroup = new SecurityGroupInZone(securityGroupWithGroup(), zone.getId());
+
+ SecurityGroup newGroup = parser.apply(origGroup);
+
+ assertEquals(newGroup.getId(), origGroup.getZone() + "/" + origGroup.getSecurityGroup().getId());
+ assertEquals(newGroup.getProviderId(), origGroup.getSecurityGroup().getId());
+ assertEquals(newGroup.getName(), origGroup.getSecurityGroup().getName());
+ assertEquals(newGroup.getOwnerId(), origGroup.getSecurityGroup().getTenantId());
+ assertEquals(newGroup.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getSecurityGroup().getRules(),
+ NovaSecurityGroupToSecurityGroupTest.ruleConverter)));
+ assertEquals(newGroup.getLocation().getId(), origGroup.getZone());
+ }
+
+ @Test
+ public void testApplyWithCidr() {
+
+ NovaSecurityGroupInZoneToSecurityGroup parser = createGroupParser();
+
+ SecurityGroupInZone origGroup = new SecurityGroupInZone(securityGroupWithCidr(), zone.getId());
+
+ SecurityGroup newGroup = parser.apply(origGroup);
+
+ assertEquals(newGroup.getId(), origGroup.getZone() + "/" + origGroup.getSecurityGroup().getId());
+ assertEquals(newGroup.getProviderId(), origGroup.getSecurityGroup().getId());
+ assertEquals(newGroup.getName(), origGroup.getSecurityGroup().getName());
+ assertEquals(newGroup.getOwnerId(), origGroup.getSecurityGroup().getTenantId());
+ assertEquals(newGroup.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getSecurityGroup().getRules(),
+ NovaSecurityGroupToSecurityGroupTest.ruleConverter)));
+ assertEquals(newGroup.getLocation().getId(), origGroup.getZone());
+ }
+
+ private NovaSecurityGroupInZoneToSecurityGroup createGroupParser() {
+ NovaSecurityGroupToSecurityGroup baseParser = new NovaSecurityGroupToSecurityGroup(NovaSecurityGroupToSecurityGroupTest.ruleConverter);
+
+ NovaSecurityGroupInZoneToSecurityGroup parser = new NovaSecurityGroupInZoneToSecurityGroup(baseParser, locationIndex);
+
+ return parser;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroupTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroupTest.java
new file mode 100644
index 0000000..6754087
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroupTest.java
@@ -0,0 +1,155 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static com.google.common.collect.Iterables.transform;
+import static org.testng.Assert.assertEquals;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.domain.TenantIdAndName;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Functions;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Andrew Bayer
+ */
+@Test(groups = "unit", testName = "NovaSecurityGroupToSecurityGroupTest")
+public class NovaSecurityGroupToSecurityGroupTest {
+
+ private static final Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova")
+ .description("openstack-nova").build();
+ private static final Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1")
+ .scope(LocationScope.ZONE).parent(provider).build();
+ private static final Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
+ .<String, Location>of("az-1.region-a.geo-1", zone));
+
+
+ private static final Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = Predicates.alwaysTrue();
+
+ private static final Map<ZoneAndName, SecurityGroupInZone> groupMap = ImmutableMap.of(
+ ZoneAndName.fromZoneAndName("az-1.region-a.geo-1", "some-group"), new SecurityGroupInZone(securityGroupWithGroup(), "az-1.region-a.geo-1"),
+ ZoneAndName.fromZoneAndName("az-1.region-a.geo-1", "some-other-group"), new SecurityGroupInZone(securityGroupWithCidr(), "az-1.region-a.geo-1"));
+
+ // weird compilation error means have to declare extra generics for call to build() - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818
+ private static final Supplier <LoadingCache<ZoneAndName, SecurityGroupInZone>> groupCache = Suppliers.<LoadingCache<ZoneAndName,SecurityGroupInZone>> ofInstance(
+ CacheBuilder.newBuilder().<ZoneAndName, SecurityGroupInZone>build(CacheLoader.from(Functions.forMap(groupMap))));
+
+ public static final SecurityGroupRuleToIpPermission ruleConverter = new SecurityGroupRuleToIpPermission(returnSecurityGroupExistsInZone, locationIndex,
+ groupCache.get());
+
+ public static org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroupWithGroup() {
+ TenantIdAndName group = TenantIdAndName.builder().tenantId("tenant").name("some-other-group").build();
+
+ SecurityGroupRule ruleToConvert = SecurityGroupRule.builder()
+ .id("some-id")
+ .ipProtocol(IpProtocol.TCP)
+ .fromPort(10)
+ .toPort(20)
+ .group(group)
+ .parentGroupId("some-other-id")
+ .build();
+
+ org.jclouds.openstack.nova.v2_0.domain.SecurityGroup origGroup = org.jclouds.openstack.nova.v2_0.domain.SecurityGroup.builder()
+ .tenantId("tenant")
+ .id("some-id")
+ .name("some-group")
+ .description("some-description")
+ .rules(ruleToConvert)
+ .build();
+
+ return origGroup;
+ }
+
+ public static org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroupWithCidr() {
+ SecurityGroupRule ruleToConvert = SecurityGroupRule.builder()
+ .id("some-id")
+ .ipProtocol(IpProtocol.TCP)
+ .fromPort(10)
+ .toPort(20)
+ .ipRange("0.0.0.0/0")
+ .parentGroupId("some-other-id")
+ .build();
+
+ org.jclouds.openstack.nova.v2_0.domain.SecurityGroup origGroup = org.jclouds.openstack.nova.v2_0.domain.SecurityGroup.builder()
+ .tenantId("tenant")
+ .id("some-id")
+ .name("some-other-group")
+ .description("some-description")
+ .rules(ruleToConvert)
+ .build();
+
+ return origGroup;
+ }
+
+ @Test
+ public void testApplyWithGroup() {
+ NovaSecurityGroupToSecurityGroup parser = createGroupParser();
+
+ org.jclouds.openstack.nova.v2_0.domain.SecurityGroup origGroup = securityGroupWithGroup();
+
+ SecurityGroup newGroup = parser.apply(origGroup);
+
+ assertEquals(newGroup.getId(), origGroup.getId());
+ assertEquals(newGroup.getProviderId(), origGroup.getId());
+ assertEquals(newGroup.getName(), origGroup.getName());
+ assertEquals(newGroup.getOwnerId(), origGroup.getTenantId());
+ assertEquals(newGroup.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getRules(), ruleConverter)));
+ }
+
+ @Test
+ public void testApplyWithCidr() {
+
+ NovaSecurityGroupToSecurityGroup parser = createGroupParser();
+
+ org.jclouds.openstack.nova.v2_0.domain.SecurityGroup origGroup = securityGroupWithCidr();
+
+ SecurityGroup group = parser.apply(origGroup);
+
+ assertEquals(group.getId(), origGroup.getId());
+ assertEquals(group.getProviderId(), origGroup.getId());
+ assertEquals(group.getName(), origGroup.getName());
+ assertEquals(group.getOwnerId(), origGroup.getTenantId());
+ assertEquals(group.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getRules(), ruleConverter)));
+ }
+
+ private NovaSecurityGroupToSecurityGroup createGroupParser() {
+ NovaSecurityGroupToSecurityGroup parser = new NovaSecurityGroupToSecurityGroup(ruleConverter);
+
+ return parser;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneIdTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneIdTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneIdTest.java
new file mode 100644
index 0000000..1f520dc
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneIdTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextModule;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicates;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+
+/**
+ *
+ *
+ * @author Adrian Cole
+ */
+@Test(testName = "OrphanedGroupsByZoneIdTest")
+public class OrphanedGroupsByZoneIdTest {
+
+ Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova").description(
+ "openstack-nova").build();
+ Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1").scope(
+ LocationScope.ZONE).parent(provider).build();
+ Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
+ .<String, Location> of("az-1.region-a.geo-1", zone));
+
+ GroupNamingConvention.Factory namingConvention = Guice.createInjector().getInstance(GroupNamingConvention.Factory.class);
+
+ @Test
+ public void testWhenComputeServiceSaysAllNodesAreDeadBothGroupsAreReturned() {
+
+ ServerInZone withoutHost = new ServerInZone(new ServerInZoneToNodeMetadataTest().expectedServer(), "az-1.region-a.geo-1");
+ ServerInZone withHost = new ServerInZone(new ParseServerTest().expected(), "az-1.region-a.geo-1");
+
+ ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
+ NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
+ .<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
+ .<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
+
+ Set<? extends NodeMetadata> set = ImmutableSet.of(converter.apply(withHost), converter.apply(withoutHost));
+
+ assertEquals(new OrphanedGroupsByZoneId(Predicates.<ZoneAndName> alwaysTrue()).apply(set), ImmutableMultimap
+ .<String, String> builder().putAll("az-1.region-a.geo-1", "sample", "test").build());
+ }
+
+ @Test
+ public void testWhenComputeServiceSaysAllNodesAreDeadNoGroupsAreReturned() {
+
+ ServerInZone withoutHost = new ServerInZone(new ServerInZoneToNodeMetadataTest().expectedServer(), "az-1.region-a.geo-1");
+ ServerInZone withHost = new ServerInZone(new ParseServerTest().expected(), "az-1.region-a.geo-1");
+
+ ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
+ NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
+ .<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
+ .<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
+
+ Set<? extends NodeMetadata> set = ImmutableSet.of(converter.apply(withHost), converter.apply(withoutHost));
+
+ assertEquals(new OrphanedGroupsByZoneId(Predicates.<ZoneAndName> alwaysFalse()).apply(set), ImmutableMultimap
+ .<String, String> of());
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermissionTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermissionTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermissionTest.java
new file mode 100644
index 0000000..59c59d0
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermissionTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.net.domain.IpPermission;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.domain.TenantIdAndName;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+
+/**
+ * Tests for the function for transforming a nova specific SecurityGroupRule into a generic
+ * IpPermission object.
+ *
+ * @author Andrew Bayer
+ */
+public class SecurityGroupRuleToIpPermissionTest {
+
+ @Test
+ public void testApplyWithGroup() {
+
+ TenantIdAndName group = TenantIdAndName.builder().tenantId("tenant").name("some-group").build();
+
+ SecurityGroupRule ruleToConvert = SecurityGroupRule.builder()
+ .id("some-id")
+ .ipProtocol(IpProtocol.TCP)
+ .fromPort(10)
+ .toPort(20)
+ .group(group)
+ .parentGroupId("some-other-id")
+ .build();
+
+ IpPermission convertedPerm = NovaSecurityGroupToSecurityGroupTest.ruleConverter.apply(ruleToConvert);
+
+ assertEquals(convertedPerm.getIpProtocol(), ruleToConvert.getIpProtocol());
+ assertEquals(convertedPerm.getFromPort(), ruleToConvert.getFromPort());
+ assertEquals(convertedPerm.getToPort(), ruleToConvert.getToPort());
+ assertTrue(convertedPerm.getGroupIds().contains("az-1.region-a.geo-1/some-id"));
+ assertTrue(convertedPerm.getCidrBlocks().size() == 0);
+ }
+
+ @Test
+ public void testApplyWithCidr() {
+ SecurityGroupRule ruleToConvert = SecurityGroupRule.builder()
+ .id("some-id")
+ .ipProtocol(IpProtocol.TCP)
+ .fromPort(10)
+ .toPort(20)
+ .ipRange("0.0.0.0/0")
+ .parentGroupId("some-other-id")
+ .build();
+
+ IpPermission convertedPerm = NovaSecurityGroupToSecurityGroupTest.ruleConverter.apply(ruleToConvert);
+
+ assertEquals(convertedPerm.getIpProtocol(), ruleToConvert.getIpProtocol());
+ assertEquals(convertedPerm.getFromPort(), ruleToConvert.getFromPort());
+ assertEquals(convertedPerm.getToPort(), ruleToConvert.getToPort());
+ assertEquals(convertedPerm.getCidrBlocks(), ImmutableSet.of("0.0.0.0/0"));
+ assertTrue(convertedPerm.getTenantIdGroupNamePairs().size() == 0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadataTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadataTest.java
new file mode 100644
index 0000000..7ef9fa7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadataTest.java
@@ -0,0 +1,311 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Set;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.HardwareBuilder;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextModule;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerTest;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+
+/**
+ * Tests for the function for transforming a nova specific Server into a generic
+ * NodeMetadata object.
+ *
+ * @author Matt Stephenson, Adam Lowe, Adrian Cole
+ */
+@Test(testName = "ServerInZoneToNodeMetadataTest")
+public class ServerInZoneToNodeMetadataTest {
+
+ Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova")
+ .description("openstack-nova").build();
+ Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1")
+ .scope(LocationScope.ZONE).parent(provider).build();
+ Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
+ .<String, Location> of("az-1.region-a.geo-1", zone));
+
+ GroupNamingConvention.Factory namingConvention = Guice.createInjector().getInstance(GroupNamingConvention.Factory.class);
+
+ @Test
+ public void testWhenNoHardwareOrImageMatchServerScopedIdsImageIdIsStillSet() {
+
+ Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/FOOOOOOOO").providerId("FOOOOOOOO")
+ .location(zone).build();
+ Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/FOOOOOOOO")
+ .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
+ .providerId("FOOOOOOOO").description("foobuntu").location(zone).status(Image.Status.AVAILABLE).build();
+
+ checkHardwareAndImageStatus(null, existingHardware, "az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54",
+ null, existingImage);
+ }
+
+ @Test
+ public void testWhenNoHardwareAndImageMatchServerScopedIdsHardwareOperatingSystemAndImageIdAreSet() {
+
+ Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
+ .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
+ Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
+ .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
+ .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
+ .location(zone).build();
+
+ checkHardwareAndImageStatus(existingHardware, existingHardware, existingImage.getId(),
+ existingImage.getOperatingSystem(), existingImage);
+ }
+
+ @Test
+ public void testNullAccessIPs() {
+ Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
+ .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
+ Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
+ .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
+ .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
+ .location(zone).build();
+
+ Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
+ Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
+ .of(existingHardware);
+ Server serverToConvert = new ParseServerTest().expected().toBuilder()
+ .accessIPv4(null)
+ .accessIPv6(null)
+ .build();
+
+ ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
+
+ ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
+ NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
+ .<Set<? extends Image>> ofInstance(images), Suppliers
+ .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
+
+ NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
+
+ assertNotNull(convertedNodeMetadata.getPrivateAddresses());
+ assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
+
+ assertNotNull(convertedNodeMetadata.getPublicAddresses());
+ // note jclouds doesn't yet support ipv6 b/c not tested yet
+ assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131"));
+ }
+
+ @Test
+ public void testDuplicateAccessIPs() {
+ Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
+ .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
+ Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
+ .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
+ .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
+ .location(zone).build();
+
+ Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
+ Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
+ .of(existingHardware);
+ Server serverToConvert = new ParseServerTest().expected().toBuilder()
+ .accessIPv4("67.23.10.132")
+ .accessIPv6("::babe:67.23.10.132")
+ .build();
+
+ ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
+
+ ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
+ NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
+ .<Set<? extends Image>> ofInstance(images), Suppliers
+ .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
+
+ NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
+
+ assertNotNull(convertedNodeMetadata.getPrivateAddresses());
+ assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
+
+ assertNotNull(convertedNodeMetadata.getPublicAddresses());
+ // note jclouds doesn't yet support ipv6 b/c not tested yet
+ assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131"));
+ }
+
+ @Test
+ public void testAlternateAccessIPs() {
+ Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
+ .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
+ Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
+ .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
+ .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
+ .location(zone).build();
+
+ Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
+ Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
+ .of(existingHardware);
+ Server serverToConvert = new ParseServerTest().expected().toBuilder()
+ .accessIPv4("76.32.1.231")
+ .accessIPv6("::babe:76.32.1.231")
+ .build();
+
+ ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
+
+ ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
+ NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
+ .<Set<? extends Image>> ofInstance(images), Suppliers
+ .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
+
+ NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
+
+ assertNotNull(convertedNodeMetadata.getPrivateAddresses());
+ assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
+
+ assertNotNull(convertedNodeMetadata.getPublicAddresses());
+ // note jclouds doesn't yet support ipv6 b/c not tested yet
+ assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131", "76.32.1.231"));
+ }
+
+ // TODO: clean up this syntax
+ private void checkHardwareAndImageStatus(Hardware expectedHardware, Hardware existingHardware,
+ String expectedImageId, OperatingSystem expectedOs, Image existingImage) {
+
+ Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
+ Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
+ .of(existingHardware);
+ Server serverToConvert = new ParseServerTest().expected();
+
+ ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
+
+ ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
+ NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
+ .<Set<? extends Image>> ofInstance(images), Suppliers
+ .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
+
+ NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
+
+ assertEquals(serverInZoneToConvert.slashEncode(), convertedNodeMetadata.getId());
+ assertEquals(serverToConvert.getId(), convertedNodeMetadata.getProviderId());
+
+ assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.HOST);
+ assertEquals(convertedNodeMetadata.getLocation().getId(), "e4d909c290d0fb1ca068ffaddf22cbd0");
+
+ assertEquals(convertedNodeMetadata.getLocation().getParent(), locationIndex.get().get("az-1.region-a.geo-1"));
+
+ assertEquals(serverToConvert.getName(), convertedNodeMetadata.getName());
+ assertEquals(convertedNodeMetadata.getGroup(), "sample");
+
+ assertEquals(convertedNodeMetadata.getImageId(), expectedImageId);
+ assertEquals(convertedNodeMetadata.getOperatingSystem(), expectedOs);
+
+ assertEquals(convertedNodeMetadata.getHardware(), expectedHardware);
+
+ assertEquals(NovaComputeServiceContextModule.toPortableNodeStatus.get(serverToConvert.getStatus()),
+ convertedNodeMetadata.getStatus());
+
+ assertNotNull(convertedNodeMetadata.getPrivateAddresses());
+ assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
+
+ assertNotNull(convertedNodeMetadata.getPublicAddresses());
+ // note jclouds doesn't yet support ipv6 b/c not tested yet
+ assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131"));
+
+ assertNotNull(convertedNodeMetadata.getUserMetadata());
+ assertEquals(convertedNodeMetadata.getUserMetadata(),
+ ImmutableMap.<String, String> of("Server Label", "Web Head 1", "Image Version", "2.1"));
+
+ URI expectedURI = URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f6f006e54");
+ assertEquals(convertedNodeMetadata.getUri(), expectedURI);
+ }
+
+ @Test
+ public void testNewServerWithoutHostIdSetsZoneAsLocation() {
+
+ Set<Image> images = ImmutableSet.<Image> of();
+ Set<Hardware> hardwares = ImmutableSet.<Hardware> of();
+
+ Server serverToConvert = expectedServer();
+
+ ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
+
+ ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
+ NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
+ .<Set<? extends Image>> ofInstance(images), Suppliers
+ .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
+
+ NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
+
+ assertEquals(serverInZoneToConvert.slashEncode(), convertedNodeMetadata.getId());
+ assertEquals(serverToConvert.getId(), convertedNodeMetadata.getProviderId());
+
+ assertEquals(convertedNodeMetadata.getLocation(), zone);
+
+ URI expectedURI = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752");
+ assertEquals(convertedNodeMetadata.getUri(), expectedURI);
+ }
+
+ public Server expectedServer() {
+ return Server
+ .builder()
+ .id("71752")
+ .uuid("47491020-6a78-4f63-9475-23195ac4515c")
+ .tenantId("37936628937291")
+ .userId("54297837463082")
+ .name("test-e92")
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-03-19T06:21:13Z"))
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-03-19T06:21:13Z"))
+ .status(Server.Status.BUILD)
+ .image(
+ Resource
+ .builder()
+ .id("1241")
+ .links(
+ Link.create(
+ Link.Relation.BOOKMARK,
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241")))
+ .build())
+ .flavor(
+ Resource
+ .builder()
+ .id("100")
+ .links(
+ Link.create(
+ Link.Relation.BOOKMARK,
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100")))
+ .build())
+ .links(
+ Link.create(Link.Relation.SELF, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752")),
+ Link.create(Link.Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752"))).build();
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java
new file mode 100644
index 0000000..9bca8e1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.openstack.nova.v2_0.compute.loaders;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.testng.Assert.assertEquals;
+
+import java.net.UnknownHostException;
+
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.TypeLiteral;
+
+/**
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "CreateUniqueKeyPairTest")
+public class CreateUniqueKeyPairTest {
+
+ @Test
+ public void testApply() throws UnknownHostException {
+ final NovaApi api = createMock(NovaApi.class);
+ KeyPairApi keyApi = createMock(KeyPairApi.class);
+
+ KeyPair pair = createMock(KeyPair.class);
+
+ Optional optKeyApi = Optional.of(keyApi);
+
+ expect(api.getKeyPairExtensionForZone("zone")).andReturn(optKeyApi).atLeastOnce();
+
+ expect(keyApi.create("group-1")).andReturn(pair);
+
+ replay(api, keyApi);
+
+ CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral<Supplier<String>>() {
+ }).toInstance(Suppliers.ofInstance("1"));
+ bind(NovaApi.class).toInstance(api);
+ }
+
+ }).getInstance(CreateUniqueKeyPair.class);
+
+ assertEquals(parser.load(ZoneAndName.fromZoneAndName("zone", "group")), pair);
+
+ verify(api, keyApi);
+ }
+
+ @Test
+ public void testApplyWithIllegalStateException() throws UnknownHostException {
+ final NovaApi api = createMock(NovaApi.class);
+ KeyPairApi keyApi = createMock(KeyPairApi.class);
+ @SuppressWarnings("unchecked")
+ final Supplier<String> uniqueIdSupplier = createMock(Supplier.class);
+
+ KeyPair pair = createMock(KeyPair.class);
+
+ expect(api.getKeyPairExtensionForZone("zone")).andReturn((Optional) Optional.of(keyApi)).atLeastOnce();
+
+ expect(uniqueIdSupplier.get()).andReturn("1");
+ expect(keyApi.create("group-1")).andThrow(new IllegalStateException());
+ expect(uniqueIdSupplier.get()).andReturn("2");
+ expect(keyApi.create("group-2")).andReturn(pair);
+
+ replay(api, keyApi, uniqueIdSupplier);
+
+ CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral<Supplier<String>>() {
+ }).toInstance(uniqueIdSupplier);
+ bind(NovaApi.class).toInstance(api);
+ }
+
+ }).getInstance(CreateUniqueKeyPair.class);
+
+ assertEquals(parser.load(ZoneAndName.fromZoneAndName("zone", "group")), pair);
+
+ verify(api, keyApi, uniqueIdSupplier);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreateTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreateTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreateTest.java
new file mode 100644
index 0000000..62f45fd
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreateTest.java
@@ -0,0 +1,144 @@
+/*
+ * 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.openstack.nova.v2_0.compute.loaders;
+
+import static org.easymock.EasyMock.createMock;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", singleThreaded = true, testName = "FindSecurityGroupOrCreateTest")
+public class FindSecurityGroupOrCreateTest {
+
+ @Test
+ public void testWhenNotFoundCreatesANewSecurityGroup() throws Exception {
+ Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = Predicates.alwaysFalse();
+
+ SecurityGroupInZone securityGroupInZone = createMock(SecurityGroupInZone.class);
+
+ ZoneSecurityGroupNameAndPorts input = new ZoneSecurityGroupNameAndPorts("zone", "groupName", ImmutableSet
+ .<Integer> of(22, 8080));
+
+ Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = Functions.forMap(ImmutableMap
+ .<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> of(input, securityGroupInZone));
+
+ FindSecurityGroupOrCreate parser = new FindSecurityGroupOrCreate(
+ returnSecurityGroupExistsInZone, groupCreator);
+
+ assertEquals(parser.load(input), securityGroupInZone);
+
+ }
+
+ @Test
+ public void testWhenFoundReturnsSecurityGroupFromAtomicReferenceValueUpdatedDuringPredicateCheck() throws Exception {
+ final SecurityGroupInZone securityGroupInZone = createMock(SecurityGroupInZone.class);
+
+ Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = new Predicate<AtomicReference<ZoneAndName>>() {
+
+ @Override
+ public boolean apply(AtomicReference<ZoneAndName> input) {
+ input.set(securityGroupInZone);
+ return true;
+ }
+
+ };
+
+ ZoneAndName input = ZoneAndName.fromZoneAndName("zone", "groupName");
+
+ Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = new Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>() {
+
+ @Override
+ public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts input) {
+ fail();
+ return null;
+ }
+
+ };
+
+ FindSecurityGroupOrCreate parser = new FindSecurityGroupOrCreate(
+ returnSecurityGroupExistsInZone, groupCreator);
+
+ assertEquals(parser.load(input), securityGroupInZone);
+
+ }
+
+
+ @Test(expectedExceptions = IllegalStateException.class)
+ public void testWhenFoundPredicateMustUpdateAtomicReference() throws Exception {
+
+ Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = Predicates.alwaysTrue();
+
+ ZoneAndName input = ZoneAndName.fromZoneAndName("zone", "groupName");
+
+ Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = new Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>() {
+
+ @Override
+ public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts input) {
+ fail();
+ return null;
+ }
+
+ };
+
+ FindSecurityGroupOrCreate parser = new FindSecurityGroupOrCreate(
+ returnSecurityGroupExistsInZone, groupCreator);
+
+ parser.load(input);
+
+ }
+
+
+
+ @Test(expectedExceptions = IllegalStateException.class)
+ public void testWhenNotFoundInputMustBeZoneSecurityGroupNameAndPorts() throws Exception {
+ Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = Predicates.alwaysFalse();
+
+ ZoneAndName input = ZoneAndName.fromZoneAndName("zone", "groupName");
+
+ Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = new Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>() {
+
+ @Override
+ public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts input) {
+ fail();
+ return null;
+ }
+
+ };
+
+ FindSecurityGroupOrCreate parser = new FindSecurityGroupOrCreate(
+ returnSecurityGroupExistsInZone, groupCreator);
+
+ parser.load(input);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java
new file mode 100644
index 0000000..771d63f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.openstack.nova.v2_0.compute.loaders;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.testng.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+
+
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", singleThreaded = true, testName = "LoadFloatingIpsForInstanceTest")
+public class LoadFloatingIpsForInstanceTest {
+
+ @Test
+ public void testReturnsPublicIpOnMatch() throws Exception {
+ NovaApi api = createMock(NovaApi.class);
+ FloatingIPApi ipApi = createMock(FloatingIPApi.class);
+ FloatingIP testIp = FloatingIP.builder().id("1").ip("1.1.1.1").fixedIp("10.1.1.1").instanceId("i-blah").build();
+
+ expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
+ expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(testIp)))
+ .atLeastOnce();
+
+ replay(api);
+ replay(ipApi);
+
+ LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
+
+ assertEquals(ImmutableSet.copyOf(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah"))), ImmutableSet.of(testIp));
+
+ verify(api);
+ verify(ipApi);
+ }
+
+ @Test
+ public void testReturnsNullWhenNotFound() throws Exception {
+ NovaApi api = createMock(NovaApi.class);
+ FloatingIPApi ipApi = createMock(FloatingIPApi.class);
+
+ expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
+
+ expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of()))
+ .atLeastOnce();
+
+ replay(api);
+ replay(ipApi);
+
+ LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
+
+ assertFalse(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah")).iterator().hasNext());
+
+ verify(api);
+ verify(ipApi);
+
+ }
+
+ @Test
+ public void testReturnsNullWhenNotAssigned() throws Exception {
+ NovaApi api = createMock(NovaApi.class);
+ FloatingIPApi ipApi = createMock(FloatingIPApi.class);
+
+ expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
+
+ expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(FloatingIP.builder().id("1").ip("1.1.1.1").build())))
+ .atLeastOnce();
+
+ replay(api);
+ replay(ipApi);
+
+ LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
+
+ assertFalse(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah")).iterator().hasNext());
+
+ verify(api);
+ verify(ipApi);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptionsTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptionsTest.java
new file mode 100644
index 0000000..106da5b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptionsTest.java
@@ -0,0 +1,263 @@
+/*
+ * 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.openstack.nova.v2_0.compute.options;
+
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.authorizePublicKey;
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.autoAssignFloatingIp;
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.blockOnPort;
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.generateKeyPair;
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.inboundPorts;
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.installPrivateKey;
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.securityGroupNames;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests possible uses of NovaTemplateOptions and NovaTemplateOptions.Builder.*
+ *
+ * @author Adrian Cole
+ */
+@Test(testName = "NovaTemplateOptionsTest")
+public class NovaTemplateOptionsTest {
+
+ public void testAs() {
+ TemplateOptions options = new NovaTemplateOptions();
+ assertEquals(options.as(NovaTemplateOptions.class), options);
+ }
+
+ @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "all security groups must be non-empty")
+ public void testsecurityGroupNamesIterableBadFormat() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.securityGroupNames(ImmutableSet.of("group1", ""));
+ }
+
+ @Test
+ public void testsecurityGroupNamesIterable() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.securityGroupNames(ImmutableSet.of("group1", "group2"));
+ assertEquals(options.getSecurityGroupNames(), Optional.of(ImmutableSet.of("group1", "group2")));
+
+ }
+
+ @Test
+ public void testsecurityGroupNamesIterableStatic() {
+ NovaTemplateOptions options = securityGroupNames(ImmutableSet.of("group1", "group2"));
+ assertEquals(options.getSecurityGroupNames(), Optional.of(ImmutableSet.of("group1", "group2")));
+ }
+
+ @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "all security groups must be non-empty")
+ public void testsecurityGroupNamesVarArgsBadFormat() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.securityGroupNames("mygroup", "");
+ }
+
+ @Test
+ public void testsecurityGroupNamesVarArgs() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.securityGroupNames("group1", "group2");
+ assertEquals(options.getSecurityGroupNames(), Optional.of(ImmutableSet.of("group1", "group2")));
+
+ }
+
+ @Test
+ public void testDefaultGroupsVarArgsEmpty() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ assertEquals(options.getSecurityGroupNames(), Optional.absent());
+ }
+
+ @Test
+ public void testsecurityGroupNamesVarArgsStatic() {
+ NovaTemplateOptions options = securityGroupNames("group1", "group2");
+ assertEquals(options.getSecurityGroupNames(), Optional.of(ImmutableSet.of("group1", "group2")));
+ }
+
+ @Test
+ public void testautoAssignFloatingIpDefault() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ assert !options.shouldAutoAssignFloatingIp();
+ }
+
+ @Test
+ public void testautoAssignFloatingIp() {
+ NovaTemplateOptions options = new NovaTemplateOptions().autoAssignFloatingIp(true);
+ assert options.shouldAutoAssignFloatingIp();
+ }
+
+ @Test
+ public void testautoAssignFloatingIpStatic() {
+ NovaTemplateOptions options = autoAssignFloatingIp(true);
+ assert options.shouldAutoAssignFloatingIp();
+ }
+
+ @Test
+ public void testGenerateKeyPairDefault() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ assert !options.shouldGenerateKeyPair();
+ }
+
+ @Test
+ public void testGenerateKeyPair() {
+ NovaTemplateOptions options = new NovaTemplateOptions().generateKeyPair(true);
+ assert options.shouldGenerateKeyPair();
+ }
+
+ @Test
+ public void testGenerateKeyPairStatic() {
+ NovaTemplateOptions options = generateKeyPair(true);
+ assert options.shouldGenerateKeyPair();
+ }
+
+ // superclass tests
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testinstallPrivateKeyBadFormat() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.installPrivateKey("whompy");
+ }
+
+ @Test
+ public void testinstallPrivateKey() throws IOException {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
+ assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
+ }
+
+ @Test
+ public void testNullinstallPrivateKey() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ assertEquals(options.getPrivateKey(), null);
+ }
+
+ @Test
+ public void testinstallPrivateKeyStatic() throws IOException {
+ NovaTemplateOptions options = installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
+ assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testinstallPrivateKeyNPE() {
+ installPrivateKey(null);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testauthorizePublicKeyBadFormat() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.authorizePublicKey("whompy");
+ }
+
+ @Test
+ public void testauthorizePublicKey() throws IOException {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.authorizePublicKey("ssh-rsa");
+ assertEquals(options.getPublicKey(), "ssh-rsa");
+ }
+
+ @Test
+ public void testNullauthorizePublicKey() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ assertEquals(options.getPublicKey(), null);
+ }
+
+ @Test
+ public void testauthorizePublicKeyStatic() throws IOException {
+ NovaTemplateOptions options = authorizePublicKey("ssh-rsa");
+ assertEquals(options.getPublicKey(), "ssh-rsa");
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testauthorizePublicKeyNPE() {
+ authorizePublicKey(null);
+ }
+
+ @Test
+ public void testUserData() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.userData("test".getBytes());
+ assertEquals(new String(options.getUserData()), "test");
+ }
+
+ @Test
+ public void testDiskConfig() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.diskConfig(Server.DISK_CONFIG_AUTO);
+ assertEquals(options.getDiskConfig(), Server.DISK_CONFIG_AUTO);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testblockOnPortBadFormat() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.blockOnPort(-1, -1);
+ }
+
+ @Test
+ public void testblockOnPort() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.blockOnPort(22, 30);
+ assertEquals(options.getPort(), 22);
+ assertEquals(options.getSeconds(), 30);
+
+ }
+
+ @Test
+ public void testNullblockOnPort() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ assertEquals(options.getPort(), -1);
+ assertEquals(options.getSeconds(), -1);
+ }
+
+ @Test
+ public void testblockOnPortStatic() {
+ NovaTemplateOptions options = blockOnPort(22, 30);
+ assertEquals(options.getPort(), 22);
+ assertEquals(options.getSeconds(), 30);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testinboundPortsBadFormat() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.inboundPorts(-1, -1);
+ }
+
+ @Test
+ public void testinboundPorts() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ options.inboundPorts(22, 30);
+ assertEquals(options.getInboundPorts()[0], 22);
+ assertEquals(options.getInboundPorts()[1], 30);
+
+ }
+
+ @Test
+ public void testDefaultOpen22() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ assertEquals(options.getInboundPorts()[0], 22);
+ }
+
+ @Test
+ public void testinboundPortsStatic() {
+ NovaTemplateOptions options = inboundPorts(22, 30);
+ assertEquals(options.getInboundPorts()[0], 22);
+ assertEquals(options.getInboundPorts()[1], 30);
+ }
+}
[29/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/util/VCloudComputeUtils.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/util/VCloudComputeUtils.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/util/VCloudComputeUtils.java
new file mode 100755
index 0000000..45262e9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/util/VCloudComputeUtils.java
@@ -0,0 +1,116 @@
+/*
+ * 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.vcloud.compute.util;
+
+import static com.google.common.collect.Iterables.filter;
+
+import java.util.Set;
+
+import org.jclouds.cim.CIMPredicates;
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
+import org.jclouds.compute.domain.CIMOperatingSystem;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkAdapter;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+import com.google.common.collect.Iterables;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class VCloudComputeUtils {
+ public static OperatingSystem toComputeOs(VApp vApp, OperatingSystem defaultOs) {
+ CIMOperatingSystem cimOs = toComputeOs(vApp);
+ return cimOs != null ? cimOs : defaultOs;
+ }
+
+ public static CIMOperatingSystem toComputeOs(VApp vApp) {
+ // TODO we need to change the design so that it doesn't assume single-vms
+ return vApp.getChildren().size() > 0 ? toComputeOs(Iterables.get(vApp.getChildren(), 0)) : null;
+ }
+
+ public static CIMOperatingSystem toComputeOs(Vm vm) {
+ return CIMOperatingSystem.toComputeOs(vm.getOperatingSystemSection());
+ }
+
+ public static String getVirtualSystemIdentifierOfFirstVMIn(VApp vApp) {
+ return vApp.getChildren().size() > 0 ? getVirtualSystemIdentifierOf(Iterables.get(vApp.getChildren(), 0)) : null;
+ }
+
+ public static String getVirtualSystemIdentifierOf(Vm vm) {
+ if (vm.getVirtualHardwareSection() != null && vm.getVirtualHardwareSection().getSystem() != null)
+ return vm.getVirtualHardwareSection().getSystem().getVirtualSystemIdentifier();
+ return null;
+ }
+
+ public static LoginCredentials getCredentialsFrom(VApp vApp) {
+ return vApp.getChildren().size() > 0 ? getCredentialsFrom(Iterables.get(vApp.getChildren(), 0)) : null;
+ }
+
+ public static LoginCredentials getCredentialsFrom(VAppTemplate vApp) {
+ return vApp.getChildren().size() > 0 ? getCredentialsFrom(Iterables.get(vApp.getChildren(), 0)) : null;
+ }
+
+ public static LoginCredentials getCredentialsFrom(Vm vm) {
+ LoginCredentials.Builder builder = LoginCredentials.builder();
+ if (vm.getGuestCustomizationSection() != null)
+ builder.password(vm.getGuestCustomizationSection().getAdminPassword());
+ return builder.build();
+ }
+
+ public static Set<String> getIpsFromVApp(VApp vApp) {
+ // TODO make this work with composite vApps
+ if (vApp.getChildren().size() == 0)
+ return ImmutableSet.of();
+ Builder<String> ips = ImmutableSet.builder();
+ Vm vm = Iterables.get(vApp.getChildren(), 0);
+ // TODO: figure out how to differentiate public from private ip addresses
+ // assumption is that we'll do this from the network object, which may
+ // have
+ // enough data to tell whether or not it is a public network without
+ // string
+ // parsing. At worst, we could have properties set per cloud provider to
+ // declare the networks which are public, then check against these in
+ // networkconnection.getNetwork
+ if (vm.getNetworkConnectionSection() != null) {
+ for (NetworkConnection connection : vm.getNetworkConnectionSection().getConnections()) {
+ if (connection.getIpAddress() != null)
+ ips.add(connection.getIpAddress());
+ if (connection.getExternalIpAddress() != null)
+ ips.add(connection.getExternalIpAddress());
+ }
+ } else {
+ for (ResourceAllocationSettingData net : filter(vm.getVirtualHardwareSection().getItems(),
+ CIMPredicates.resourceTypeIn(ResourceType.ETHERNET_ADAPTER))) {
+ if (net instanceof VCloudNetworkAdapter) {
+ VCloudNetworkAdapter vNet = VCloudNetworkAdapter.class.cast(net);
+ if (vNet.getIpAddress() != null)
+ ips.add(vNet.getIpAddress());
+ }
+ }
+ }
+ return ips.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultCatalogForOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultCatalogForOrg.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultCatalogForOrg.java
new file mode 100755
index 0000000..09e3168
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultCatalogForOrg.java
@@ -0,0 +1,63 @@
+/*
+ * 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.vcloud.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CATALOG;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class DefaultCatalogForOrg implements Function<ReferenceType, ReferenceType> {
+ private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
+ private final Supplier<Map<String, Org>> nameToOrg;
+
+ @Inject
+ public DefaultCatalogForOrg(ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull,
+ @Catalog Predicate<ReferenceType> defaultSelector, Supplier<Map<String, Org>> nameToOrg) {
+ this.selector = new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(checkNotNull(
+ valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull"), PROPERTY_VCLOUD_DEFAULT_CATALOG,
+ checkNotNull(defaultSelector, "defaultSelector"));
+ this.nameToOrg = checkNotNull(nameToOrg, "nameToOrg");
+ }
+
+ @Override
+ public ReferenceType apply(ReferenceType defaultOrg) {
+ Org org = nameToOrg.get().get(defaultOrg.getName());
+ checkState(org != null, "could not retrieve Org at %s", defaultOrg);
+ return selector.apply(org.getCatalogs().values());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultNetworkForVDC.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultNetworkForVDC.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultNetworkForVDC.java
new file mode 100755
index 0000000..d4c67c4
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultNetworkForVDC.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.vcloud.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class DefaultNetworkForVDC implements Function<ReferenceType, ReferenceType> {
+
+ private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
+ private final Supplier<Map<URI, VDC>> uriToVDC;
+
+ @Inject
+ public DefaultNetworkForVDC(ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull,
+ @Network Predicate<ReferenceType> defaultSelector, Supplier<Map<URI, VDC>> uriToVDC) {
+ this.selector = new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(checkNotNull(
+ valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull"), PROPERTY_VCLOUD_DEFAULT_NETWORK,
+ checkNotNull(defaultSelector, "defaultSelector"));
+ this.uriToVDC = checkNotNull(uriToVDC, "uriToVDC");
+ }
+
+ @Override
+ public ReferenceType apply(ReferenceType defaultVDC) {
+ org.jclouds.vcloud.domain.VDC vDC = uriToVDC.get().get(defaultVDC.getHref());
+ checkState(vDC != null, "could not retrieve VDC at %s", defaultVDC);
+ return selector.apply(vDC.getAvailableNetworks().values());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
new file mode 100755
index 0000000..6de2674
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
@@ -0,0 +1,58 @@
+/*
+ * 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.vcloud.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class DefaultOrgForUser implements Supplier<ReferenceType> {
+
+ private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
+ private final Supplier<VCloudSession> session;
+
+ @Inject
+ public DefaultOrgForUser(ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull,
+ @Org Predicate<ReferenceType> defaultSelector, Supplier<VCloudSession> session) {
+ this.selector = new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(checkNotNull(
+ valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull"), PROPERTY_VCLOUD_DEFAULT_ORG, checkNotNull(
+ defaultSelector, "defaultSelector"));
+ this.session = checkNotNull(session, "session");
+ }
+
+ @Override
+ public ReferenceType get() {
+ return selector.apply(session.get().getOrgs().values());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultTasksListForOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultTasksListForOrg.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultTasksListForOrg.java
new file mode 100755
index 0000000..9a499aa
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultTasksListForOrg.java
@@ -0,0 +1,53 @@
+/*
+ * 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.vcloud.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class DefaultTasksListForOrg implements Function<ReferenceType, ReferenceType> {
+ private final Supplier<Map<String, Org>> nameToOrg;
+
+ @Inject
+ public DefaultTasksListForOrg(Supplier<Map<String, Org>> nameToOrg) {
+ this.nameToOrg = checkNotNull(nameToOrg, "nameToOrg");
+ }
+
+ @Override
+ public ReferenceType apply(ReferenceType defaultOrg) {
+ org.jclouds.vcloud.domain.Org org = nameToOrg.get().get(defaultOrg.getName());
+ checkState(org != null, "could not retrieve Org at %s", defaultOrg);
+ return org.getTasksList();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
new file mode 100755
index 0000000..dff7556
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
@@ -0,0 +1,165 @@
+/*
+ * 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.vcloud.config;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.inject.AbstractModule;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class DefaultVCloudReferencesModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral<Supplier<ReferenceType>>() {
+ }).annotatedWith(Org.class).to(DefaultOrgForUser.class);
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.Org
+ protected Predicate<ReferenceType> provideDefaultOrgSelector(Injector i) {
+ return Predicates.alwaysTrue();
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.TasksList
+ @Singleton
+ protected Supplier<ReferenceType> provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.compose(defaultTasksListURIForOrg, defaultOrg);
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.Catalog
+ @Singleton
+ protected Supplier<ReferenceType> provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.compose(defaultCatalogURIForOrg, defaultOrg);
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.Catalog
+ protected Predicate<ReferenceType> provideDefaultCatalogSelector(Injector i) {
+ return i.getInstance(WriteableCatalog.class);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<URI, org.jclouds.vcloud.domain.Catalog>> provideCatalogsById(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> supplier) {
+ return Suppliers
+ .compose(
+ new Function<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>, Map<URI, org.jclouds.vcloud.domain.Catalog>>() {
+
+ @Override
+ public Map<URI, Catalog> apply(Map<String, Map<String, Catalog>> arg0) {
+ Builder<URI, Catalog> builder = ImmutableMap.builder();
+ for (Map<String, Catalog> v1 : arg0.values()) {
+ for (Catalog v2 : v1.values()) {
+ builder.put(v2.getHref(), v2);
+ }
+ }
+ return builder.build();
+ }
+
+ }, supplier);
+ }
+
+ @Singleton
+ public static class WriteableCatalog implements Predicate<ReferenceType> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final Supplier<Map<URI, org.jclouds.vcloud.domain.Catalog>> catalogsByIdSupplier;
+
+ @Inject
+ public WriteableCatalog(Supplier<Map<URI, org.jclouds.vcloud.domain.Catalog>> catalogsByIdSupplier) {
+ this.catalogsByIdSupplier = catalogsByIdSupplier;
+ }
+
+ @Override
+ public boolean apply(ReferenceType arg0) {
+ // TODO: this is inefficient, calculating the index each time, but
+ // shouldn't be added to constructor as the supplier is an expensive
+ // call
+ Map<URI, Catalog> index = catalogsByIdSupplier.get();
+ Catalog catalog = index.get(arg0.getHref());
+ if (catalog == null) {
+ if (logger.isTraceEnabled())
+ logger.trace("didn't find catalog %s", arg0);
+ return false;
+ } else
+ return !catalog.isReadOnly();
+ }
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.VDC
+ @Singleton
+ protected Supplier<ReferenceType> provideDefaultVDC(DefaultVDCForOrg defaultVDCURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.compose(defaultVDCURIForOrg, defaultOrg);
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.VDC
+ protected Predicate<ReferenceType> provideDefaultVDCSelector(Injector i) {
+ return Predicates.alwaysTrue();
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.Network
+ @Singleton
+ protected Supplier<ReferenceType> provideDefaultNetwork(DefaultNetworkForVDC defaultNetworkURIForVDC,
+ @org.jclouds.vcloud.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
+ return Suppliers.compose(defaultNetworkURIForVDC, defaultVDC);
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.Network
+ protected Predicate<ReferenceType> provideDefaultNetworkSelector(Injector i) {
+ return Predicates.alwaysTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVDCForOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVDCForOrg.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVDCForOrg.java
new file mode 100755
index 0000000..bbeb0af
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVDCForOrg.java
@@ -0,0 +1,63 @@
+/*
+ * 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.vcloud.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.VDC;
+import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class DefaultVDCForOrg implements Function<ReferenceType, ReferenceType> {
+ private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
+ private final Supplier<Map<String, Org>> nameToOrg;
+
+ @Inject
+ public DefaultVDCForOrg(ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull,
+ @VDC Predicate<ReferenceType> defaultSelector, Supplier<Map<String, Org>> nameToOrg) {
+ this.selector = new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(checkNotNull(
+ valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull"), PROPERTY_VCLOUD_DEFAULT_VDC,
+ checkNotNull(defaultSelector, "defaultSelector"));
+ this.nameToOrg = checkNotNull(nameToOrg, "nameToOrg");
+ }
+
+ @Override
+ public ReferenceType apply(ReferenceType defaultOrg) {
+ Org org = nameToOrg.get().get(defaultOrg.getName());
+ checkState(org != null, "could not retrieve Org at %s", defaultOrg);
+ return selector.apply(org.getVDCs().values());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java
new file mode 100755
index 0000000..d60d311
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java
@@ -0,0 +1,538 @@
+/*
+ * 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.vcloud.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Predicates.notNull;
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.getLast;
+import static com.google.common.collect.Iterables.transform;
+import static com.google.common.collect.Maps.transformValues;
+import static com.google.common.collect.Maps.uniqueIndex;
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
+import static org.jclouds.util.Predicates2.retry;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.SortedMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.domain.Location;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.location.suppliers.ImplicitLocationSupplier;
+import org.jclouds.location.suppliers.LocationsSupplier;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.rest.config.HttpApiModule;
+import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudToken;
+import org.jclouds.vcloud.VCloudVersionsApi;
+import org.jclouds.vcloud.compute.functions.FindLocationForResource;
+import org.jclouds.vcloud.compute.functions.ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.endpoints.OrgList;
+import org.jclouds.vcloud.functions.CatalogItemsInCatalog;
+import org.jclouds.vcloud.functions.CatalogItemsInOrg;
+import org.jclouds.vcloud.functions.CatalogsInOrg;
+import org.jclouds.vcloud.functions.DefaultNetworkNameInTemplate;
+import org.jclouds.vcloud.functions.OrgsForLocations;
+import org.jclouds.vcloud.functions.OrgsForNames;
+import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems;
+import org.jclouds.vcloud.functions.VDCsInOrg;
+import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse;
+import org.jclouds.vcloud.internal.VCloudLoginApi;
+import org.jclouds.vcloud.loaders.OVFLoader;
+import org.jclouds.vcloud.loaders.VAppTemplateLoader;
+import org.jclouds.vcloud.location.DefaultVDC;
+import org.jclouds.vcloud.location.OrgAndVDCToLocationSupplier;
+import org.jclouds.vcloud.predicates.TaskSuccess;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.Lists;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Configures the VCloud authentication service connection, including logging and http transport.
+ *
+ * @author Adrian Cole
+ */
+@ConfiguresHttpApi
+public class VCloudHttpApiModule extends HttpApiModule<VCloudApi> {
+
+
+ @Provides
+ @Singleton
+ protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ AtomicReference<AuthorizationException> authException, final VCloudLoginApi login) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
+ new Supplier<VCloudSession>() {
+
+ @Override
+ public VCloudSession get() {
+ return login.login();
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(login).add("method", "login").toString();
+ }
+ }, seconds, TimeUnit.SECONDS);
+ }
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(new TypeLiteral<Function<Iterable<CatalogItem>, Iterable<VAppTemplate>>>() {
+ }).to(new TypeLiteral<VAppTemplatesForCatalogItems>() {
+ });
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ installDefaultVCloudEndpointsModule();
+ bind(new TypeLiteral<Function<ReferenceType, Location>>() {
+ }).to(new TypeLiteral<FindLocationForResource>() {
+ });
+ bind(new TypeLiteral<Function<Org, Iterable<Catalog>>>() {
+ }).to(new TypeLiteral<CatalogsInOrg>() {
+ });
+ bind(new TypeLiteral<Function<Org, Iterable<VDC>>>() {
+ }).to(new TypeLiteral<VDCsInOrg>() {
+ });
+ bind(new TypeLiteral<Function<Iterable<String>, Iterable<Org>>>() {
+ }).to(new TypeLiteral<OrgsForNames>() {
+ });
+ bind(new TypeLiteral<Function<Iterable<Location>, Iterable<Org>>>() {
+ }).to(new TypeLiteral<OrgsForLocations>() {
+ });
+ bind(new TypeLiteral<Function<Catalog, Iterable<CatalogItem>>>() {
+ }).to(new TypeLiteral<CatalogItemsInCatalog>() {
+ });
+ bind(new TypeLiteral<Function<Org, Iterable<CatalogItem>>>() {
+ }).to(new TypeLiteral<CatalogItemsInOrg>() {
+ });
+
+ bindCacheLoaders();
+
+ bind(new TypeLiteral<Function<VAppTemplate, String>>() {
+ }).annotatedWith(Network.class).to(new TypeLiteral<DefaultNetworkNameInTemplate>() {
+ });
+
+ bind(new TypeLiteral<Function<VAppTemplate, Envelope>>() {
+ }).to(new TypeLiteral<ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException>() {
+ });
+ bindHttpApi(binder(), VCloudApi.class);
+ bindHttpApi(binder(), VCloudVersionsApi.class);
+ bindHttpApi(binder(), VCloudLoginApi.class);
+ }
+
+ protected void bindCacheLoaders() {
+ bind(new TypeLiteral<CacheLoader<URI, VAppTemplate>>() {
+ }).to(new TypeLiteral<VAppTemplateLoader>() {
+ });
+
+ bind(new TypeLiteral<CacheLoader<URI, Envelope>>() {
+ }).to(new TypeLiteral<OVFLoader>() {
+ });
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.VDC
+ protected Supplier<Map<String, String>> provideVDCtoORG(Supplier<Map<String, Org>> orgNameToOrgSupplier) {
+ return Suppliers.compose(new Function<Map<String, Org>, Map<String, String>>() {
+
+ @Override
+ public Map<String, String> apply(Map<String, Org> arg0) {
+ Builder<String, String> returnVal = ImmutableMap.builder();
+ for (Entry<String, Org> orgr : arg0.entrySet()) {
+ for (String vdc : orgr.getValue().getVDCs().keySet()) {
+ returnVal.put(vdc, orgr.getKey());
+ }
+ }
+ return returnVal.build();
+ }
+ }, orgNameToOrgSupplier);
+
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Org>> provideOrgMapCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ AtomicReference<AuthorizationException> authException, OrgMapSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Singleton
+ @OrgList
+ protected Supplier<URI> provideOrgListURI(Supplier<VCloudSession> sessionSupplier) {
+ return Suppliers.compose(new Function<VCloudSession, URI>() {
+
+ @Override
+ public URI apply(VCloudSession arg0) {
+ return URI.create(getLast(arg0.getOrgs().values()).getHref().toASCIIString().replaceAll("org/.*", "org"));
+ }
+
+ @Override
+ public String toString() {
+ return "orgListURI()";
+ }
+
+ }, sessionSupplier);
+ }
+
+ @Singleton
+ public static class OrgMapSupplier implements Supplier<Map<String, Org>> {
+ protected final Supplier<VCloudSession> sessionSupplier;
+ protected final Function<Iterable<String>, Iterable<Org>> organizationsForNames;
+
+ @Inject
+ protected OrgMapSupplier(Supplier<VCloudSession> sessionSupplier,
+ Function<Iterable<String>, Iterable<Org>> organizationsForNames) {
+ this.sessionSupplier = sessionSupplier;
+ this.organizationsForNames = organizationsForNames;
+ }
+
+ @Override
+ public Map<String, Org> get() {
+ return uniqueIndex(organizationsForNames.apply(sessionSupplier.get().getOrgs().keySet()), name);
+ }
+ }
+
+ protected void installDefaultVCloudEndpointsModule() {
+ install(new DefaultVCloudReferencesModule());
+ }
+
+ @Singleton
+ public static class OrgCatalogSupplier implements
+ Supplier<Map<String, Map<String, Catalog>>> {
+ protected final Supplier<Map<String, Org>> orgSupplier;
+ protected final Function<Org, Iterable<Catalog>> allCatalogsInOrg;
+
+ @Inject
+ protected OrgCatalogSupplier(Supplier<Map<String, Org>> orgSupplier,
+ Function<Org, Iterable<Catalog>> allCatalogsInOrg) {
+ this.orgSupplier = orgSupplier;
+ this.allCatalogsInOrg = allCatalogsInOrg;
+ }
+
+ @Override
+ public Map<String, Map<String, Catalog>> get() {
+ return transformValues(transformValues(orgSupplier.get(), allCatalogsInOrg),
+ new Function<Iterable<? extends Catalog>, Map<String, Catalog>>() {
+
+ @Override
+ public Map<String, Catalog> apply(Iterable<? extends Catalog> from) {
+ return ImmutableMap.copyOf(uniqueIndex(from, name));
+ }
+
+ });
+ }
+ }
+
+ @VCloudToken
+ @Provides
+ @Singleton
+ Supplier<String> provideVCloudToken(Supplier<VCloudSession> cache) {
+ return Suppliers.compose(new Function<VCloudSession, String>() {
+
+ @Override
+ public String apply(VCloudSession input) {
+ return checkNotNull(input.getVCloudToken(), "No token present in session");
+ }
+ }, cache);
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.Org
+ @Singleton
+ protected Supplier<Map<String, ReferenceType>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ AtomicReference<AuthorizationException> authException, OrgNameToOrgSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<URI, VDC>> provideURIToVDC(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ URItoVDC supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Singleton
+ public static class URItoVDC implements Supplier<Map<URI, VDC>> {
+ private final Supplier<Map<String, Map<String, VDC>>> orgVDCMap;
+
+ @Inject
+ URItoVDC(Supplier<Map<String, Map<String, VDC>>> orgVDCMap) {
+ this.orgVDCMap = orgVDCMap;
+ }
+
+ @Override
+ public Map<URI, VDC> get() {
+ return uniqueIndex(concat(transform(orgVDCMap.get().values(),
+ new Function<Map<String, VDC>, Iterable<VDC>>() {
+
+ @Override
+ public Iterable<VDC> apply(
+ Map<String, VDC> from) {
+ return from.values();
+ }
+
+ })), new Function<VDC, URI>() {
+
+ @Override
+ public URI apply(VDC from) {
+ return from.getHref();
+ }
+
+ });
+ }
+
+ }
+
+ static final Function<ReferenceType, String> name = new Function<ReferenceType, String>() {
+
+ @Override
+ public String apply(ReferenceType from) {
+ return from.getName();
+ }
+
+ };
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.VCloudLogin
+ protected Supplier<URI> provideAuthenticationURI(final VCloudVersionsApi versionService,
+ @ApiVersion final String version) {
+ return new Supplier<URI>() {
+
+ @Override
+ public URI get() {
+ SortedMap<String, URI> versions = versionService.getSupportedVersions();
+ checkState(versions.size() > 0, "No versions present");
+ checkState(versions.containsKey(version), "version " + version + " not present in: " + versions);
+ return versions.get(version);
+ }
+
+ public String toString() {
+ return "login()";
+ }
+ };
+ }
+
+ @Singleton
+ private static class OrgNameToOrgSupplier implements Supplier<Map<String, ReferenceType>> {
+ private final Supplier<VCloudSession> sessionSupplier;
+
+ @Inject
+ OrgNameToOrgSupplier(Supplier<VCloudSession> sessionSupplier) {
+ this.sessionSupplier = sessionSupplier;
+ }
+
+ @Override
+ public Map<String, ReferenceType> get() {
+ return sessionSupplier.get().getOrgs();
+ }
+
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Org> provideOrg(final Supplier<Map<String, Org>> orgSupplier,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.compose(new Function<ReferenceType, Org>() {
+
+ @Override
+ public Org apply(ReferenceType input) {
+ return orgSupplier.get().get(input.getName());
+
+ }
+ }, defaultOrg);
+ }
+
+ @Provides
+ @Singleton
+ protected Predicate<URI> successTester(Injector injector,
+ @Named(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED) long completed) {
+ return retry(injector.getInstance(TaskSuccess.class), completed);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Map<String, Catalog>>> provideOrgCatalogItemMapSupplierCache(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ OrgCatalogSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Map<String, VDC>>> provideOrgVDCSupplierCache(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ OrgVDCSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Singleton
+ public static class OrgVDCSupplier implements Supplier<Map<String, Map<String, VDC>>> {
+ protected final Supplier<Map<String, Org>> orgSupplier;
+ private final Function<Org, Iterable<VDC>> allVDCsInOrg;
+
+ @Inject
+ protected OrgVDCSupplier(Supplier<Map<String, Org>> orgSupplier,
+ Function<Org, Iterable<VDC>> allVDCsInOrg) {
+ this.orgSupplier = orgSupplier;
+ this.allVDCsInOrg = allVDCsInOrg;
+ }
+
+ @Override
+ public Map<String, Map<String, VDC>> get() {
+ return transformValues(transformValues(orgSupplier.get(), allVDCsInOrg),
+ new Function<Iterable<? extends VDC>, Map<String, VDC>>() {
+
+ @Override
+ public Map<String, VDC> apply(
+ Iterable<? extends VDC> from) {
+ return uniqueIndex(Lists.newArrayList(from), name);
+ }
+
+ });
+ }
+ }
+
+ @Singleton
+ public static class OrgCatalogItemSupplier implements
+ Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> {
+ protected final Supplier<Map<String, Map<String, Catalog>>> catalogSupplier;
+ protected final Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog;
+
+ @Inject
+ protected OrgCatalogItemSupplier(
+ Supplier<Map<String, Map<String, Catalog>>> catalogSupplier,
+ Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog) {
+ this.catalogSupplier = catalogSupplier;
+ this.allCatalogItemsInCatalog = allCatalogItemsInCatalog;
+ }
+
+ @Override
+ public Map<String, Map<String, Map<String, CatalogItem>>> get() {
+ return transformValues(
+ catalogSupplier.get(),
+ new Function<Map<String, Catalog>, Map<String, Map<String, CatalogItem>>>() {
+
+ @Override
+ public Map<String, Map<String, CatalogItem>> apply(
+ Map<String, Catalog> from) {
+ return transformValues(
+ from,
+ new Function<Catalog, Map<String, CatalogItem>>() {
+
+ @Override
+ public Map<String, CatalogItem> apply(Catalog from) {
+ return uniqueIndex(filter(allCatalogItemsInCatalog.apply(from), notNull()), name);
+ }
+ });
+
+ }
+ });
+ }
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> provideOrgCatalogItemSupplierCache(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ OrgCatalogItemSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Singleton
+ protected FenceMode defaultFenceMode(@Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
+ return FenceMode.fromValue(fenceMode);
+ }
+
+ @Provides
+ @Singleton
+ protected LoadingCache<URI, VAppTemplate> vAppTemplates(CacheLoader<URI, VAppTemplate> vAppTemplates) {
+ return CacheBuilder.newBuilder().build(vAppTemplates);
+ }
+
+ @Provides
+ @Singleton
+ protected LoadingCache<URI, Envelope> envelopes(CacheLoader<URI, Envelope> envelopes) {
+ return CacheBuilder.newBuilder().build(envelopes);
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseVCloudErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseVCloudErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseVCloudErrorFromHttpResponse.class);
+ }
+
+ @Override
+ protected void installLocations() {
+ super.installLocations();
+ bind(ImplicitLocationSupplier.class).to(DefaultVDC.class).in(Scopes.SINGLETON);
+ bind(LocationsSupplier.class).to(OrgAndVDCToLocationSupplier.class).in(Scopes.SINGLETON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java
new file mode 100755
index 0000000..aadb475
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.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.vcloud.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * The AllocationModel element defines how resources are allocated in a vDC.
+ */
+public enum AllocationModel {
+ /**
+ * Resources are committed to a vDC only when vApps are created in it
+ */
+ ALLOCATION_VAPP,
+ /**
+ * Only a percentage of the resources you allocate are committed to the organization vDC.
+ */
+ ALLOCATION_POOL,
+ /**
+ * All the resources you allocate are committed as a pool to the organization vDC. vApps in vDCs
+ * that support this allocation model can specify values for resource and limit.
+ */
+ RESERVATION_POOL,
+ /**
+ * The VCloud API returned a model unsupported in the version 1.0 spec.
+ */
+ UNRECOGNIZED;
+
+ public String value() {
+ switch (this) {
+ case ALLOCATION_VAPP:
+ return "AllocationVApp";
+ case ALLOCATION_POOL:
+ return "AllocationPool";
+ case RESERVATION_POOL:
+ return "ReservationPool";
+ default:
+ return "UnrecognizedModel";
+ }
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static AllocationModel fromValue(String model) {
+ try {
+ return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(model, "model")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java
new file mode 100755
index 0000000..076b93b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java
@@ -0,0 +1,108 @@
+/*
+ * 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.vcloud.domain;
+
+/**
+ * reports storage resource consumption in a vDC.
+ *
+ * @author Adrian Cole
+ */
+public class Capacity {
+
+ private final String units;
+ private final long allocated;
+ private final long limit;
+ private final int used;
+ private final long overhead;
+
+ public Capacity(String units, long allocated, long limit, int used, long overhead) {
+ this.units = units;
+ this.limit = limit;
+ this.allocated = allocated;
+ this.used = used;
+ this.overhead = overhead;
+ }
+
+ public String getUnits() {
+ return units;
+ }
+
+ public long getAllocated() {
+ return allocated;
+ }
+
+ public long getLimit() {
+ return limit;
+ }
+
+ /**
+ * percentage of the allocation in use.
+ */
+ public int getUsed() {
+ return used;
+ }
+
+ /**
+ * number of Units allocated to vShield Manager virtual machines provisioned from this vDC.
+ */
+ public long getOverhead() {
+ return overhead;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (allocated ^ (allocated >>> 32));
+ result = prime * result + (int) (limit ^ (limit >>> 32));
+ result = prime * result + (int) (overhead ^ (overhead >>> 32));
+ result = prime * result + ((units == null) ? 0 : units.hashCode());
+ result = prime * result + used;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Capacity other = (Capacity) obj;
+ if (allocated != other.allocated)
+ return false;
+ if (limit != other.limit)
+ return false;
+ if (overhead != other.overhead)
+ return false;
+ if (units == null) {
+ if (other.units != null)
+ return false;
+ } else if (!units.equals(other.units))
+ return false;
+ if (used != other.used)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[allocated=" + allocated + ", limit=" + limit + ", overhead=" + overhead + ", units=" + units + ", used="
+ + used + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java
new file mode 100755
index 0000000..a9d98bd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java
@@ -0,0 +1,69 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * @author Adrian Cole
+ */
+@org.jclouds.vcloud.endpoints.Catalog
+@ImplementedBy(CatalogImpl.class)
+public interface Catalog extends ReferenceType, Map<String, ReferenceType> {
+ /**
+ * Reference to the org containing this vDC.
+ *
+ * @since vcloud api 1.0
+ * @return org, or null if this is a version before 1.0 where the org isn't present
+ */
+ ReferenceType getOrg();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only element, true if the catalog is published
+ *
+ * @since vcloud api 1.0
+ */
+ boolean isPublished();
+
+ /**
+ * @return true, if the current user cannot modify the catalog
+ * @since vcloud api 1.0
+ */
+ boolean isReadOnly();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java
new file mode 100755
index 0000000..caad3b3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * @author Adrian Cole
+ */
+@ImplementedBy(CatalogItemImpl.class)
+public interface CatalogItem extends ReferenceType {
+
+ String getDescription();
+
+ ReferenceType getEntity();
+
+ Map<String, String> getProperties();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java
new file mode 100755
index 0000000..b72c8ca
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java
@@ -0,0 +1,440 @@
+/*
+ * 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.vcloud.domain;
+
+import java.net.URI;
+
+import org.jclouds.vcloud.VCloudMediaType;
+
+/**
+ * The GuestCustomization of a Vm contains customization parameters for the guest operating system
+ * of the virtual machine.
+ */
+public class GuestCustomizationSection {
+ protected final String type;
+ protected final URI href;
+ protected String info;
+ protected Boolean enabled;
+ protected Boolean changeSid;
+ protected String virtualMachineId;
+ protected Boolean joinDomainEnabled;
+ protected Boolean useOrgSettings;
+ protected String domainName;
+ protected String domainUserName;
+ protected String domainUserPassword;
+ protected Boolean adminPasswordEnabled;
+ protected Boolean adminPasswordAuto;
+ protected String adminPassword;
+ protected Boolean resetPasswordRequired;
+ protected String customizationScript;
+ protected String computerName;
+ protected final ReferenceType edit;
+
+ public GuestCustomizationSection(URI href) {
+ this.href = href;
+ this.type = VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML;
+ this.info = "Specifies Guest OS Customization Settings";
+ this.edit = null;
+ }
+
+ public GuestCustomizationSection(String type, URI href, String info, Boolean enabled, Boolean changeSid,
+ String virtualMachineId, Boolean joinDomainEnabled, Boolean useOrgSettings, String domainName,
+ String domainUserName, String domainUserPassword, Boolean adminPasswordEnabled, Boolean adminPasswordAuto,
+ String adminPassword, Boolean resetPasswordRequired, String customizationScript, String computerName,
+ ReferenceType edit) {
+ this.type = type;
+ this.href = href;
+ this.info = info;
+ this.enabled = enabled;
+ this.changeSid = changeSid;
+ this.virtualMachineId = virtualMachineId;
+ this.joinDomainEnabled = joinDomainEnabled;
+ this.useOrgSettings = useOrgSettings;
+ this.domainName = domainName;
+ this.domainUserName = domainUserName;
+ this.domainUserPassword = domainUserPassword;
+ this.adminPasswordEnabled = adminPasswordEnabled;
+ this.adminPasswordAuto = adminPasswordAuto;
+ this.adminPassword = adminPassword;
+ this.resetPasswordRequired = resetPasswordRequired;
+ this.customizationScript = customizationScript;
+ this.computerName = computerName;
+ this.edit = edit;
+ }
+
+ /**
+ *
+ * @return media type of this section
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ *
+ * @return URL to access this section
+ */
+ public URI getHref() {
+ return href;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getInfo() {
+ return info;
+ }
+
+ /**
+ *
+ * @return if true, to enable guest customization at power on
+ */
+ public Boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ *
+ * @return if true, customization will run sysprep to change the Windows SID for this virtual
+ * machine
+ */
+ public Boolean shouldChangeSid() {
+ return changeSid;
+ }
+
+ /**
+ *
+ * @return unique identifier for this virtual machine
+ */
+ public String getVirtualMachineId() {
+ return virtualMachineId;
+ }
+
+ /**
+ *
+ * @return if true, this virtual machine can join a Windows domain
+ */
+ public Boolean isJoinDomainEnabled() {
+ return joinDomainEnabled;
+ }
+
+ /**
+ *
+ * @return if true, this virtual machine uses the containing organization’s default values for
+ * Windows domain name, domain user name, and domain user password
+ */
+ public Boolean useOrgSettings() {
+ return useOrgSettings;
+ }
+
+ /**
+ *
+ * @return if UseOrgSettings is false, specifies the Windows domain to join
+ */
+ public String getDomainName() {
+ return domainName;
+ }
+
+ /**
+ *
+ * @return if UseOrgSettings is false, specifies the Windows domain user name
+ */
+ public String getDomainUserName() {
+ return domainUserName;
+ }
+
+ /**
+ *
+ * @return if UseOrgSettings is false, specifies the Windows domain user’s password
+ */
+ public String getDomainUserPassword() {
+ return domainUserPassword;
+ }
+
+ /**
+ *
+ * @return true if the guest OS allows use of a local administrator password
+ */
+ public Boolean isAdminPasswordEnabled() {
+ return adminPasswordEnabled;
+ }
+
+ /**
+ *
+ * @return true if the local administrator password should be automatically generated
+ */
+ public Boolean isAdminPasswordAuto() {
+ return adminPasswordAuto;
+ }
+
+ /**
+ *
+ * @return local administrator password for this virtual machine
+ */
+ public String getAdminPassword() {
+ return adminPassword;
+ }
+
+ /**
+ *
+ * @return if true, the local administrator must reset his password on first use
+ */
+ public Boolean isResetPasswordRequired() {
+ return resetPasswordRequired;
+ }
+
+ /**
+ *
+ * @return the customization script to run
+ */
+ public String getCustomizationScript() {
+ return customizationScript;
+ }
+
+ /**
+ *
+ * @return name of this virtual machine in DNS or Windows domain
+ */
+ public String getComputerName() {
+ return computerName;
+ }
+
+ /**
+ *
+ * @return edit link
+ */
+ public ReferenceType getEdit() {
+ return edit;
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", enabled=" + isEnabled() + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ int prime = 31;
+ int result = 1;
+ result = prime * result + ((adminPassword == null) ? 0 : adminPassword.hashCode());
+ result = prime * result + ((adminPasswordAuto == null) ? 0 : adminPasswordAuto.hashCode());
+ result = prime * result + ((adminPasswordEnabled == null) ? 0 : adminPasswordEnabled.hashCode());
+ result = prime * result + ((changeSid == null) ? 0 : changeSid.hashCode());
+ result = prime * result + ((computerName == null) ? 0 : computerName.hashCode());
+ result = prime * result + ((customizationScript == null) ? 0 : customizationScript.hashCode());
+ result = prime * result + ((domainName == null) ? 0 : domainName.hashCode());
+ result = prime * result + ((domainUserName == null) ? 0 : domainUserName.hashCode());
+ result = prime * result + ((domainUserPassword == null) ? 0 : domainUserPassword.hashCode());
+ result = prime * result + ((edit == null) ? 0 : edit.hashCode());
+ result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((info == null) ? 0 : info.hashCode());
+ result = prime * result + ((joinDomainEnabled == null) ? 0 : joinDomainEnabled.hashCode());
+ result = prime * result + ((resetPasswordRequired == null) ? 0 : resetPasswordRequired.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((useOrgSettings == null) ? 0 : useOrgSettings.hashCode());
+ result = prime * result + ((virtualMachineId == null) ? 0 : virtualMachineId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GuestCustomizationSection other = (GuestCustomizationSection) obj;
+ if (adminPassword == null) {
+ if (other.adminPassword != null)
+ return false;
+ } else if (!adminPassword.equals(other.adminPassword))
+ return false;
+ if (adminPasswordAuto == null) {
+ if (other.adminPasswordAuto != null)
+ return false;
+ } else if (!adminPasswordAuto.equals(other.adminPasswordAuto))
+ return false;
+ if (adminPasswordEnabled == null) {
+ if (other.adminPasswordEnabled != null)
+ return false;
+ } else if (!adminPasswordEnabled.equals(other.adminPasswordEnabled))
+ return false;
+ if (changeSid == null) {
+ if (other.changeSid != null)
+ return false;
+ } else if (!changeSid.equals(other.changeSid))
+ return false;
+ if (computerName == null) {
+ if (other.computerName != null)
+ return false;
+ } else if (!computerName.equals(other.computerName))
+ return false;
+ if (customizationScript == null) {
+ if (other.customizationScript != null)
+ return false;
+ } else if (!customizationScript.equals(other.customizationScript))
+ return false;
+ if (domainName == null) {
+ if (other.domainName != null)
+ return false;
+ } else if (!domainName.equals(other.domainName))
+ return false;
+ if (domainUserName == null) {
+ if (other.domainUserName != null)
+ return false;
+ } else if (!domainUserName.equals(other.domainUserName))
+ return false;
+ if (domainUserPassword == null) {
+ if (other.domainUserPassword != null)
+ return false;
+ } else if (!domainUserPassword.equals(other.domainUserPassword))
+ return false;
+ if (edit == null) {
+ if (other.edit != null)
+ return false;
+ } else if (!edit.equals(other.edit))
+ return false;
+ if (enabled == null) {
+ if (other.enabled != null)
+ return false;
+ } else if (!enabled.equals(other.enabled))
+ return false;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (info == null) {
+ if (other.info != null)
+ return false;
+ } else if (!info.equals(other.info))
+ return false;
+ if (joinDomainEnabled == null) {
+ if (other.joinDomainEnabled != null)
+ return false;
+ } else if (!joinDomainEnabled.equals(other.joinDomainEnabled))
+ return false;
+ if (resetPasswordRequired == null) {
+ if (other.resetPasswordRequired != null)
+ return false;
+ } else if (!resetPasswordRequired.equals(other.resetPasswordRequired))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ if (useOrgSettings == null) {
+ if (other.useOrgSettings != null)
+ return false;
+ } else if (!useOrgSettings.equals(other.useOrgSettings))
+ return false;
+ if (virtualMachineId == null) {
+ if (other.virtualMachineId != null)
+ return false;
+ } else if (!virtualMachineId.equals(other.virtualMachineId))
+ return false;
+ return true;
+ }
+
+ public void setEnabled(Boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public Boolean getChangeSid() {
+ return changeSid;
+ }
+
+ public void setChangeSid(Boolean changeSid) {
+ this.changeSid = changeSid;
+ }
+
+ public Boolean getJoinDomainEnabled() {
+ return joinDomainEnabled;
+ }
+
+ public void setJoinDomainEnabled(Boolean joinDomainEnabled) {
+ this.joinDomainEnabled = joinDomainEnabled;
+ }
+
+ public Boolean shouldUseOrgSettings() {
+ return useOrgSettings;
+ }
+
+ public void setUseOrgSettings(Boolean useOrgSettings) {
+ this.useOrgSettings = useOrgSettings;
+ }
+
+ public Boolean getAdminPasswordEnabled() {
+ return adminPasswordEnabled;
+ }
+
+ public void setAdminPasswordEnabled(Boolean adminPasswordEnabled) {
+ this.adminPasswordEnabled = adminPasswordEnabled;
+ }
+
+ public Boolean getAdminPasswordAuto() {
+ return adminPasswordAuto;
+ }
+
+ public void setAdminPasswordAuto(Boolean adminPasswordAuto) {
+ this.adminPasswordAuto = adminPasswordAuto;
+ }
+
+ public Boolean getResetPasswordRequired() {
+ return resetPasswordRequired;
+ }
+
+ public void setResetPasswordRequired(Boolean resetPasswordRequired) {
+ this.resetPasswordRequired = resetPasswordRequired;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ public void setVirtualMachineId(String virtualMachineId) {
+ this.virtualMachineId = virtualMachineId;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ public void setDomainUserName(String domainUserName) {
+ this.domainUserName = domainUserName;
+ }
+
+ public void setDomainUserPassword(String domainUserPassword) {
+ this.domainUserPassword = domainUserPassword;
+ }
+
+ public void setAdminPassword(String adminPassword) {
+ this.adminPassword = adminPassword;
+ }
+
+ public void setCustomizationScript(String customizationScript) {
+ this.customizationScript = customizationScript;
+ }
+
+ public void setComputerName(String computerName) {
+ this.computerName = computerName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java
new file mode 100755
index 0000000..4b024df
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java
@@ -0,0 +1,96 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.Set;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.VirtualSystemSettingData;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
+/**
+ * The InstantiateVAppTemplateParams element forms the body of an instantiateVappTemplate request.
+ */
+public class InstantiateVAppTemplateParams {
+
+ protected final String info;
+ protected final VirtualSystemSettingData virtualSystem;
+ protected final Set<ResourceAllocationSettingData> resourceAllocations = Sets.newLinkedHashSet();
+
+ public InstantiateVAppTemplateParams(String info, VirtualSystemSettingData virtualSystem, Iterable<ResourceAllocationSettingData> resourceAllocations) {
+ this.info = info;
+ this.virtualSystem = virtualSystem;
+ Iterables.addAll(this.resourceAllocations, resourceAllocations);
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public VirtualSystemSettingData getSystem() {
+ return virtualSystem;
+ }
+
+ public Set<ResourceAllocationSettingData> getResourceAllocationSettingDatas() {
+ return resourceAllocations;
+ }
+
+ @Override
+ public String toString() {
+ return "[info=" + getInfo() + ", virtualSystem=" + getSystem() + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((info == null) ? 0 : info.hashCode());
+ result = prime * result + ((resourceAllocations == null) ? 0 : resourceAllocations.hashCode());
+ result = prime * result + ((virtualSystem == null) ? 0 : virtualSystem.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ InstantiateVAppTemplateParams other = (InstantiateVAppTemplateParams) obj;
+ if (info == null) {
+ if (other.info != null)
+ return false;
+ } else if (!info.equals(other.info))
+ return false;
+ if (resourceAllocations == null) {
+ if (other.resourceAllocations != null)
+ return false;
+ } else if (!resourceAllocations.equals(other.resourceAllocations))
+ return false;
+ if (virtualSystem == null) {
+ if (other.virtualSystem != null)
+ return false;
+ } else if (!virtualSystem.equals(other.virtualSystem))
+ return false;
+ return true;
+ }
+
+}
[23/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java
new file mode 100755
index 0000000..714bb5e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java
@@ -0,0 +1,81 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+import java.util.SortedMap;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ */
+public class CatalogItemHandler extends ParseSax.HandlerWithResult<CatalogItem> {
+ private StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType catalogItem;
+ protected ReferenceType entity;
+
+ protected String description;
+ protected String key;
+ protected SortedMap<String, String> properties = Maps.newTreeMap();
+
+ public CatalogItem getResult() {
+ return new CatalogItemImpl(catalogItem.getName(), catalogItem.getHref(), description, entity, properties);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "CatalogItem")) {
+ catalogItem = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Entity")) {
+ entity = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Property")) {
+ key = attributes.get("key");
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ if (SaxUtils.equalsOrSuffix(qName, "Description")) {
+ description = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Property")) {
+ properties.put(key, currentOrNull());
+ key = null;
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ErrorHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ErrorHandler.java
new file mode 100755
index 0000000..44e88a9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/ErrorHandler.java
@@ -0,0 +1,45 @@
+/*
+ * 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.vcloud.xml;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Adrian Cole
+ */
+public class ErrorHandler extends ParseSax.HandlerWithResult<VCloudError> {
+ private VCloudError error;
+
+ public VCloudError getResult() {
+ return error;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "Error")) {
+ error = Utils.newError(attributes);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandler.java
new file mode 100755
index 0000000..487bf7a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandler.java
@@ -0,0 +1,137 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.xml.sax.Attributes;
+
+/**
+ * @author Adrian Cole
+ */
+public class GuestCustomizationSectionHandler extends ParseSax.HandlerWithResult<GuestCustomizationSection> {
+ protected StringBuilder currentText = new StringBuilder();
+ private ReferenceType guest;
+ private ReferenceType edit;
+
+ protected String info;
+ protected String name;
+ protected Boolean enabled;
+ protected Boolean changeSid;
+ protected String virtualMachineId;
+ protected Boolean joinDomainEnabled;
+ protected Boolean useOrgSettings;
+ protected String domainName;
+ protected String domainUserName;
+ protected String domainUserPassword;
+ protected Boolean adminPasswordEnabled;
+ protected Boolean adminPasswordAuto;
+ protected String adminPassword;
+ protected Boolean resetPasswordRequired;
+ protected String customizationScript;
+ protected String computerName;
+
+ public GuestCustomizationSection getResult() {
+ GuestCustomizationSection system = new GuestCustomizationSection(guest.getType(), guest.getHref(), info, enabled,
+ changeSid, virtualMachineId, joinDomainEnabled, useOrgSettings, domainName, domainUserName,
+ domainUserPassword, adminPasswordEnabled, adminPasswordAuto, adminPassword, resetPasswordRequired,
+ customizationScript, computerName, edit);
+ this.guest = null;
+ this.info = null;
+ this.edit = null;
+ this.enabled = null;
+ this.changeSid = null;
+ this.virtualMachineId = null;
+ this.joinDomainEnabled = null;
+ this.useOrgSettings = null;
+ this.domainName = null;
+ this.domainUserName = null;
+ this.domainUserPassword = null;
+ this.adminPasswordEnabled = null;
+ this.adminPasswordAuto = null;
+ this.adminPassword = null;
+ this.resetPasswordRequired = null;
+ this.customizationScript = null;
+ this.computerName = null;
+ return system;
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ this.currentText = new StringBuilder();
+ if (qName.endsWith("GuestCustomizationSection")) {
+ guest = newReferenceType(attributes);
+ } else if (qName.endsWith("Link") && "edit".equals(attributes.get("rel"))) {
+ edit = newReferenceType(attributes);
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (qName.endsWith("Info")) {
+ this.info = currentOrNull();
+ } else if (qName.endsWith("AdminPasswordEnabled")) {
+ this.adminPasswordEnabled = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("JoinDomainEnabled")) {
+ this.joinDomainEnabled = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("Enabled")) {
+ this.enabled = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("ChangeSid")) {
+ this.changeSid = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("VirtualMachineId")) {
+ this.virtualMachineId = currentOrNull();
+ } else if (qName.endsWith("UseOrgSettings")) {
+ this.useOrgSettings = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("DomainName")) {
+ this.domainName = currentOrNull();
+ } else if (qName.endsWith("DomainUserName")) {
+ this.domainUserName = currentOrNull();
+ } else if (qName.endsWith("DomainUserPassword")) {
+ this.domainUserPassword = currentOrNull();
+ } else if (qName.endsWith("AdminPasswordAuto")) {
+ this.adminPasswordAuto = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("AdminPassword")) {
+ this.adminPassword = currentOrNull();
+ } else if (qName.endsWith("ResetPasswordRequired")) {
+ this.resetPasswordRequired = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("CustomizationScript")) {
+ this.customizationScript = currentOrNull();
+ if (this.customizationScript != null)
+ customizationScript = customizationScript.replace(">", ">");
+ } else if (qName.endsWith("ComputerName")) {
+ this.computerName = currentOrNull();
+ } else if (qName.endsWith("Name")) {
+ this.name = currentOrNull();
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionHandler.java
new file mode 100755
index 0000000..647f120
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionHandler.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.vcloud.xml;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.xml.sax.Attributes;
+
+/**
+ * @author Adrian Cole
+ */
+public class NetworkConnectionHandler extends ParseSax.HandlerWithResult<NetworkConnection> {
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected String network;
+ protected int networkConnectionIndex;
+ protected String ipAddress;
+ protected String externalIpAddress;
+ protected boolean connected;
+ protected String MACAddress;
+ protected IpAddressAllocationMode ipAddressAllocationMode;
+
+ public NetworkConnection getResult() {
+ NetworkConnection connection = new NetworkConnection(network, networkConnectionIndex, ipAddress,
+ externalIpAddress, connected, MACAddress, ipAddressAllocationMode);
+ this.network = null;
+ this.networkConnectionIndex = -1;
+ this.ipAddress = null;
+ this.externalIpAddress = null;
+ this.connected = false;
+ this.MACAddress = null;
+ this.ipAddressAllocationMode = null;
+ return connection;
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("NetworkConnection")) {
+ network = attributes.get("network");
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (qName.endsWith("NetworkConnectionIndex")) {
+ this.networkConnectionIndex = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("IpAddress")) {
+ this.ipAddress = currentOrNull();
+ } else if (qName.endsWith("ExternalIpAddress")) {
+ this.externalIpAddress = currentOrNull();
+ } else if (qName.endsWith("IsConnected")) {
+ this.connected = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("MACAddress")) {
+ this.MACAddress = currentOrNull();
+ } else if (qName.endsWith("IpAddressAllocationMode")) {
+ this.ipAddressAllocationMode = IpAddressAllocationMode.valueOf(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandler.java
new file mode 100755
index 0000000..3c80bc6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandler.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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.xml.sax.Attributes;
+
+import com.google.common.collect.Sets;
+
+/**
+ * @author Adrian Cole
+ */
+public class NetworkConnectionSectionHandler extends ParseSax.HandlerWithResult<NetworkConnectionSection> {
+ protected StringBuilder currentText = new StringBuilder();
+
+ private final NetworkConnectionHandler networkConnectionHandler;
+
+ @Inject
+ public NetworkConnectionSectionHandler(NetworkConnectionHandler networkConnectionHandler) {
+ this.networkConnectionHandler = networkConnectionHandler;
+ }
+
+ protected String info;
+ protected Set<NetworkConnection> connections = Sets.newLinkedHashSet();
+ protected ReferenceType section;
+ protected ReferenceType edit;
+ protected Integer primaryNetworkConnectionIndex;
+ protected boolean inConnections;
+
+ public NetworkConnectionSection getResult() {
+ return new NetworkConnectionSection(section.getType(), section.getHref(), info, primaryNetworkConnectionIndex,
+ connections, edit);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("NetworkConnection")) {
+ inConnections = true;
+ }
+ if (inConnections) {
+ networkConnectionHandler.startElement(uri, localName, qName, attrs);
+ } else if (qName.endsWith("NetworkConnectionSection")) {
+ section = newReferenceType(attributes);
+ } else if (qName.endsWith("Link") && "edit".equals(attributes.get("rel"))) {
+ edit = newReferenceType(attributes);
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (qName.endsWith("NetworkConnection")) {
+ inConnections = false;
+ connections.add(networkConnectionHandler.getResult());
+ }
+ if (inConnections) {
+ networkConnectionHandler.endElement(uri, localName, qName);
+ } else if (qName.endsWith("Info")) {
+ this.info = currentOrNull();
+ } else if (qName.endsWith("PrimaryNetworkConnectionIndex")) {
+ this.primaryNetworkConnectionIndex = Integer.valueOf(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ @Override
+ public void characters(char ch[], int start, int length) {
+ if (inConnections)
+ networkConnectionHandler.characters(ch, start, length);
+ else
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
new file mode 100755
index 0000000..ebd6d20
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
@@ -0,0 +1,112 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+import static org.jclouds.vcloud.util.Utils.putReferenceType;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ */
+public class OrgHandler extends ParseSax.HandlerWithResult<Org> {
+
+ protected final TaskHandler taskHandler;
+
+ @Inject
+ public OrgHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ private StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType org;
+ protected Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
+ protected ReferenceType tasksList;
+ protected Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
+ protected Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
+ protected List<Task> tasks = Lists.newArrayList();
+
+ protected String description;
+ protected String fullName;
+
+ public Org getResult() {
+ return new OrgImpl(org.getName(), org.getType(), org.getHref(), fullName != null ? fullName : org.getName(),
+ description, catalogs, vdcs, networks, tasksList, tasks);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Org")) {
+ org = newReferenceType(attributes);
+ } else if (qName.endsWith("Link")) {
+ String type = attributes.get("type");
+ if (type != null) {
+ if (type.indexOf("vdc+xml") != -1) {
+ putReferenceType(vdcs, attributes);
+ } else if (type.indexOf("catalog+xml") != -1) {
+ putReferenceType(catalogs, attributes);
+ } else if (type.indexOf("tasksList+xml") != -1) {
+ tasksList = newReferenceType(attributes);
+ } else if (type.indexOf("network+xml") != -1) {
+ putReferenceType(networks, attributes);
+ }
+ }
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ taskHandler.endElement(uri, name, qName);
+ if (qName.endsWith("Task")) {
+ this.tasks.add(taskHandler.getResult());
+ } else if (qName.endsWith("Description")) {
+ description = currentOrNull();
+ } else if (qName.endsWith("FullName")) {
+ fullName = currentOrNull();
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
new file mode 100755
index 0000000..ad5b40a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
@@ -0,0 +1,54 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.putReferenceType;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ */
+public class OrgListHandler extends ParseSax.HandlerWithResult<Map<String, ReferenceType>> {
+
+ private Map<String, ReferenceType> org = Maps.newHashMap();
+
+ public Map<String, ReferenceType> getResult() {
+ return org;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Link") || qName.endsWith("Org")) {
+ String type = attributes.get("type");
+ if (type != null) {
+ if (type.indexOf("org+xml") != -1) {
+ putReferenceType(org, attributes);
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java
new file mode 100755
index 0000000..175cdde
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java
@@ -0,0 +1,325 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.network.DhcpService;
+import org.jclouds.vcloud.domain.network.Features;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.FirewallService;
+import org.jclouds.vcloud.domain.network.IpRange;
+import org.jclouds.vcloud.domain.network.IpScope;
+import org.jclouds.vcloud.domain.network.NatService;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+import org.jclouds.vcloud.domain.network.firewall.FirewallPolicy;
+import org.jclouds.vcloud.domain.network.firewall.FirewallProtocols;
+import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
+import org.jclouds.vcloud.domain.network.internal.OrgNetworkImpl;
+import org.jclouds.vcloud.domain.network.nat.NatPolicy;
+import org.jclouds.vcloud.domain.network.nat.NatProtocol;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+import org.jclouds.vcloud.domain.network.nat.NatType;
+import org.jclouds.vcloud.domain.network.nat.rules.MappingMode;
+import org.jclouds.vcloud.domain.network.nat.rules.OneToOneVmRule;
+import org.jclouds.vcloud.domain.network.nat.rules.PortForwardingRule;
+import org.jclouds.vcloud.domain.network.nat.rules.VmRule;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * @author Adrian Cole
+ */
+public class OrgNetworkHandler extends ParseSax.HandlerWithResult<OrgNetwork> {
+
+ protected final TaskHandler taskHandler;
+
+ @Inject
+ public OrgNetworkHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType network;
+ protected ReferenceType org;
+ protected String orgDescription;
+ protected List<Task> tasks = Lists.newArrayList();
+
+ protected String startAddress;
+ protected String endAddress;
+
+ protected boolean inherited;
+ protected String gateway;
+ protected String netmask;
+ protected String dns1;
+ protected String dns2;
+ protected String dnsSuffix;
+ protected Set<IpRange> ipRanges = Sets.newLinkedHashSet();
+ protected Set<String> allocatedIpAddresses = Sets.newLinkedHashSet();
+
+ protected IpScope ipScope;
+ protected ReferenceType parentNetwork;
+ protected FenceMode fenceMode;
+
+ protected boolean serviceEnabled;
+ protected Integer defaultLeaseTime;
+ protected Integer maxLeaseTime;
+
+ protected DhcpService dhcpService;
+
+ protected boolean inFirewallRule;
+ protected boolean firewallRuleEnabled;
+ protected String firewallRuleDescription;
+ protected FirewallPolicy firewallPolicy;
+
+ protected boolean tcp;
+ protected boolean udp;
+ protected FirewallProtocols protocols;
+ protected int port;
+ protected String destinationIp;
+
+ protected List<FirewallRule> firewallRules = Lists.newArrayList();
+ protected FirewallService firewallService;
+
+ protected NatType natType;
+ protected NatPolicy natPolicy;
+
+ protected MappingMode mappingMode;
+ protected String externalIP;
+ protected String vAppScopedVmId;
+ protected int vmNicId;
+
+ protected int externalPort;
+ protected String internalIP;
+ protected int internalPort;
+ protected NatProtocol natProtocol;
+
+ protected String vAppScopedLocalId;
+
+ protected List<NatRule> natRules = Lists.newArrayList();
+ protected NatService natService;
+
+ protected Features features;
+ protected OrgNetwork.Configuration configuration;
+
+ protected ReferenceType networkPool;
+ protected Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet();
+
+ public OrgNetwork getResult() {
+ return new OrgNetworkImpl(network.getName(), network.getType(), network.getHref(), org, orgDescription, tasks,
+ configuration, networkPool, allowedExternalIpAddresses);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "OrgNetwork")) {
+ network = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "FirewallRule")) {
+ this.inFirewallRule = true;
+ } else if (SaxUtils.equalsOrSuffix(qName, "ParentNetwork")) {
+ parentNetwork = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ org = newReferenceType(attributes);
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+ String type = attributes.get("type");
+ if (type != null) {
+ if (type.indexOf("networkPool+xml") != -1) {
+ networkPool = newReferenceType(attributes);
+ }
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ taskHandler.endElement(uri, name, qName);
+ if (SaxUtils.equalsOrSuffix(qName, "Task")) {
+ this.tasks.add(taskHandler.getResult());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Description")) {
+ if (inFirewallRule)
+ firewallRuleDescription = currentOrNull();
+ else
+ orgDescription = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "FenceMode")) {
+ fenceMode = FenceMode.fromValue(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "StartAddress")) {
+ startAddress = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "EndAddress")) {
+ endAddress = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "AllocatedIpAddress")) {
+ allocatedIpAddresses.add(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "IpRange")) {
+ ipRanges.add(new IpRange(startAddress, endAddress));
+ this.startAddress = null;
+ this.endAddress = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "IsInherited")) {
+ inherited = Boolean.parseBoolean(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Gateway")) {
+ gateway = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Netmask")) {
+ netmask = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Dns1")) {
+ dns1 = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Dns2")) {
+ dns2 = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "DnsSuffix")) {
+ dnsSuffix = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "IpScope")) {
+ ipScope = new IpScope(inherited, gateway, netmask, dns1, dns2, dnsSuffix, ipRanges, allocatedIpAddresses);
+ this.inherited = false;
+ this.gateway = null;
+ this.netmask = null;
+ this.dns1 = null;
+ this.dns2 = null;
+ this.dnsSuffix = null;
+ this.ipRanges = Sets.newLinkedHashSet();
+ this.allocatedIpAddresses = Sets.newLinkedHashSet();
+ } else if (SaxUtils.equalsOrSuffix(qName, "IsEnabled")) {
+ if (inFirewallRule)
+ firewallRuleEnabled = Boolean.parseBoolean(currentOrNull());
+ else
+ serviceEnabled = Boolean.parseBoolean(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "DefaultLeaseTime")) {
+ defaultLeaseTime = Integer.parseInt(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "MaxLeaseTime")) {
+ maxLeaseTime = Integer.parseInt(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "DhcpService")) {
+ this.dhcpService = new DhcpService(serviceEnabled, defaultLeaseTime, maxLeaseTime, Iterables
+ .getOnlyElement(ipRanges));
+ this.serviceEnabled = false;
+ this.defaultLeaseTime = null;
+ this.maxLeaseTime = null;
+ this.ipRanges = Sets.newLinkedHashSet();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Policy")) {
+ if (inFirewallRule)
+ firewallPolicy = FirewallPolicy.fromValue(currentOrNull());
+ else
+ natPolicy = NatPolicy.fromValue(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Tcp")) {
+ tcp = Boolean.parseBoolean(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Udp")) {
+ udp = Boolean.parseBoolean(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Protocols")) {
+ this.protocols = new FirewallProtocols(tcp, udp);
+ this.tcp = false;
+ this.udp = false;
+ } else if (SaxUtils.equalsOrSuffix(qName, "DestinationIp")) {
+ this.destinationIp = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "FirewallRule")) {
+ this.inFirewallRule = false;
+ this.firewallRules.add(new FirewallRule(firewallRuleEnabled, firewallRuleDescription, firewallPolicy,
+ protocols, port, destinationIp));
+ this.firewallRuleEnabled = false;
+ this.firewallRuleDescription = null;
+ this.firewallPolicy = null;
+ this.protocols = null;
+ this.port = -1;
+ this.destinationIp = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "FirewallService")) {
+ firewallService = new FirewallService(serviceEnabled, firewallRules);
+ this.serviceEnabled = false;
+ this.firewallRules = Lists.newArrayList();
+ } else if (SaxUtils.equalsOrSuffix(qName, "NatType")) {
+ natType = NatType.fromValue(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "MappingMode")) {
+ mappingMode = MappingMode.fromValue(currentOrNull());
+ } else if (qName.equalsIgnoreCase("ExternalIP")) {
+ externalIP = currentOrNull();
+ } else if (qName.equalsIgnoreCase("VAppScopedVmId")) {
+ vAppScopedVmId = currentOrNull();
+ } else if (qName.equalsIgnoreCase("VAppScopedLocalId")) {
+ vAppScopedLocalId = currentOrNull();
+ } else if (qName.equalsIgnoreCase("vmNicId")) {
+ vmNicId = Integer.parseInt(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "OneToOneVmRule")) {
+ natRules.add(new OneToOneVmRule(mappingMode, externalIP, vAppScopedVmId, vmNicId));
+ this.mappingMode = null;
+ this.externalIP = null;
+ this.vAppScopedVmId = null;
+ this.vmNicId = -1;
+ } else if (qName.equalsIgnoreCase("ExternalPort")) {
+ externalPort = Integer.parseInt(currentOrNull());
+ } else if (qName.equalsIgnoreCase("InternalIP")) {
+ internalIP = currentOrNull();
+ } else if (qName.equalsIgnoreCase("InternalPort")) {
+ internalPort = Integer.parseInt(currentOrNull());
+ } else if (equalsOrSuffix(qName, "Protocol")) {
+ natProtocol = NatProtocol.valueOf(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "PortForwardingRule")) {
+ natRules.add(new PortForwardingRule(externalIP, externalPort, internalIP, internalPort, natProtocol));
+ this.externalIP = null;
+ this.externalPort = -1;
+ this.internalIP = null;
+ this.internalPort = -1;
+ this.natProtocol = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "VmRule")) {
+ natRules.add(new VmRule(externalIP, externalPort, vAppScopedLocalId, vmNicId, internalPort, natProtocol));
+ this.externalIP = null;
+ this.externalPort = -1;
+ this.vAppScopedLocalId = null;
+ this.vmNicId = -1;
+ this.internalPort = -1;
+ this.natProtocol = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "NatService")) {
+ this.natService = new NatService(serviceEnabled, natType, natPolicy, natRules);
+ this.serviceEnabled = false;
+ this.natType = null;
+ this.natPolicy = null;
+ this.natRules = Lists.newArrayList();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Features")) {
+ this.features = new Features(dhcpService, firewallService, natService);
+ this.dhcpService = null;
+ this.firewallService = null;
+ this.natService = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "Configuration")) {
+ configuration = new OrgNetworkImpl.ConfigurationImpl(ipScope, parentNetwork, fenceMode, features);
+ this.ipScope = null;
+ this.parentNetwork = null;
+ this.fenceMode = null;
+ this.features = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "AllowedExternalIpAddress")) {
+ allowedExternalIpAddresses.add(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/SupportedVersionsHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/SupportedVersionsHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/SupportedVersionsHandler.java
new file mode 100755
index 0000000..a4c29ca
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/SupportedVersionsHandler.java
@@ -0,0 +1,60 @@
+/*
+ * 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.vcloud.xml;
+
+import java.net.URI;
+import java.util.SortedMap;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ */
+public class SupportedVersionsHandler extends ParseSax.HandlerWithResult<SortedMap<String, URI>> {
+ private StringBuilder currentText = new StringBuilder();
+
+ private SortedMap<String, URI> contents = Maps.newTreeMap();
+ private String version;
+ private URI location;
+
+ public SortedMap<String, URI> getResult() {
+ return contents;
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ if (SaxUtils.equalsOrSuffix(qName, "Version")) {
+ version = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "LoginUrl")) {
+ location = URI.create(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "VersionInfo")) {
+ contents.put(version, location);
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java
new file mode 100755
index 0000000..8afdec0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java
@@ -0,0 +1,128 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+
+import org.jclouds.date.DateService;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.logging.Logger;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Adrian Cole
+ */
+public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
+ protected final DateService dateService;
+ private String operation;
+ private ReferenceType taskLink;
+ private ReferenceType owner;
+ private TaskStatus status;
+ private Date startTime;
+ private Date endTime;
+ private Date expiryTime;
+ private Task task;
+ private VCloudError error;
+ private boolean inOwner;
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Inject
+ public TaskHandler(DateService dateService) {
+ this.dateService = dateService;
+ }
+
+ public Task getResult() {
+ return task;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (equalsOrSuffix(qName, "Task")) {
+ if (attributes.get("href") != null && !inOwner)// queued tasks may not have an
+ // href yet
+ taskLink = Utils.newReferenceType(attributes);
+ status = TaskStatus.fromValue(attributes.get("status"));
+ operation = attributes.get("operation");
+ if (attributes.containsKey("startTime"))
+ startTime = parseDate(attributes.get("startTime"));
+ if (attributes.containsKey("endTime"))
+ endTime = parseDate(attributes.get("endTime"));
+ if (attributes.containsKey("expiryTime"))
+ expiryTime = parseDate(attributes.get("expiryTime"));
+ // TODO technically the old Result object should only be owner for copy and delete tasks
+ } else if (equalsOrSuffix(qName, "Owner") || equalsOrSuffix(qName, "Result")) {
+ owner = Utils.newReferenceType(attributes);
+ } else if (equalsOrSuffix(qName, "Link") && "self".equals(attributes.get("rel"))) {
+ taskLink = Utils.newReferenceType(attributes);
+ } else if (equalsOrSuffix(qName, "Error")) {
+ error = Utils.newError(attributes);
+ }
+ }
+
+ private Date parseDate(String toParse) {
+ try {
+ return dateService.iso8601DateParse(toParse);
+ } catch (RuntimeException e) {
+ if (e.getCause() instanceof ParseException) {
+ if (!toParse.endsWith("Z"))
+ toParse += "Z";
+ return dateService.iso8601SecondsDateParse(toParse);
+ } else {
+ logger.error(e, "error parsing date");
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (equalsOrSuffix(qName, "Task")) {
+ this.task = new TaskImpl(taskLink.getHref(), operation, status, startTime, endTime, expiryTime, owner, error);
+ operation = null;
+ taskLink = null;
+ status = null;
+ startTime = null;
+ endTime = null;
+ owner = null;
+ error = null;
+ } else if (equalsOrSuffix(qName, "Owner")) {
+ inOwner = false;
+ }
+ }
+
+ public void characters(char ch[], int start, int length) {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java
new file mode 100755
index 0000000..9af449b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java
@@ -0,0 +1,74 @@
+/*
+ * 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.vcloud.xml;
+
+import java.util.Map;
+import java.util.SortedSet;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TasksList;
+import org.jclouds.vcloud.domain.internal.TasksListImpl;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Sets;
+
+/**
+ * @author Adrian Cole
+ */
+public class TasksListHandler extends ParseSax.HandlerWithResult<TasksList> {
+
+ private SortedSet<Task> tasks = Sets.newTreeSet();
+ private final TaskHandler taskHandler;
+ private ReferenceType resource;
+
+ @Inject
+ public TasksListHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ public TasksList getResult() {
+ return new TasksListImpl(resource.getHref(), tasks);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "TasksList")) {
+ resource = Utils.newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "self".equals(attributes.get("rel"))) {
+ resource = Utils.newReferenceType(attributes);
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ taskHandler.endElement(uri, localName, qName);
+ if (SaxUtils.equalsOrSuffix(qName, "Task")) {
+ this.tasks.add(taskHandler.getResult());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java
new file mode 100755
index 0000000..3288be9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java
@@ -0,0 +1,151 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.VAppImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+import org.jclouds.vcloud.xml.ovf.VCloudNetworkSectionHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * @author Adrian Cole
+ */
+public class VAppHandler extends ParseSax.HandlerWithResult<VApp> {
+
+ protected final TaskHandler taskHandler;
+ protected final VmHandler vmHandler;
+ protected final VCloudNetworkSectionHandler networkSectionHandler;
+
+ @Inject
+ public VAppHandler(TaskHandler taskHandler, VmHandler vmHandler,
+ VCloudNetworkSectionHandler networkSectionHandler) {
+ this.taskHandler = taskHandler;
+ this.vmHandler = vmHandler;
+ this.networkSectionHandler = networkSectionHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType template;
+ protected Status status;
+ protected ReferenceType vdc;
+ protected String description;
+ protected List<Task> tasks = Lists.newArrayList();
+ protected boolean ovfDescriptorUploaded = true;
+
+ private boolean inChildren;
+ private boolean inTasks;
+ private boolean inNetworkSection;
+ protected Set<Vm> children = Sets.newLinkedHashSet();
+ private VCloudNetworkSection networkSection;
+
+ public VApp getResult() {
+ return new VAppImpl(template.getName(), template.getType(), template.getHref(), status, vdc, description, tasks,
+ ovfDescriptorUploaded, children, networkSection);
+ }
+
+ protected int depth = 0;
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ depth++;
+ if (depth == 2) {
+ if (equalsOrSuffix(qName, "Children")) {
+ inChildren = true;
+ } else if (equalsOrSuffix(qName, "Tasks")) {
+ inTasks = true;
+ } else if (equalsOrSuffix(qName, "NetworkSection")) {
+ inNetworkSection = true;
+ }
+ }
+ if (inChildren) {
+ vmHandler.startElement(uri, localName, qName, attrs);
+ } else if (inTasks) {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ } else if (inNetworkSection) {
+ networkSectionHandler.startElement(uri, localName, qName, attrs);
+ } else if (equalsOrSuffix(qName, "VApp")) {
+ template = newReferenceType(attributes);
+ if (attributes.containsKey("status"))
+ this.status = Status.fromValue(Integer.parseInt(attributes.get("status")));
+ } else if (equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ vdc = newReferenceType(attributes);
+ }
+
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ depth--;
+ if (depth == 1) {
+ if (equalsOrSuffix(qName, "Children")) {
+ inChildren = false;
+ this.children.add(vmHandler.getResult());
+ } else if (equalsOrSuffix(qName, "Tasks")) {
+ inTasks = false;
+ this.tasks.add(taskHandler.getResult());
+ } else if (equalsOrSuffix(qName, "Description")) {
+ description = SaxUtils.currentOrNull(currentText);
+ } else if (equalsOrSuffix(qName, "NetworkSection")) {
+ inNetworkSection = false;
+ this.networkSection = networkSectionHandler.getResult();
+ }
+ }
+ if (inChildren) {
+ vmHandler.endElement(uri, name, qName);
+ } else if (inTasks) {
+ taskHandler.endElement(uri, name, qName);
+ } else if (inNetworkSection) {
+ networkSectionHandler.endElement(uri, name, qName);
+ } else if (equalsOrSuffix(qName, "ovfDescriptorUploaded")) {
+ ovfDescriptorUploaded = Boolean.parseBoolean(SaxUtils.currentOrNull(currentText));
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ if (inTasks)
+ taskHandler.characters(ch, start, length);
+ else if (inChildren)
+ vmHandler.characters(ch, start, length);
+ else if (inNetworkSection)
+ networkSectionHandler.characters(ch, start, length);
+ else
+ currentText.append(ch, start, length);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
new file mode 100755
index 0000000..b9c6807
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
@@ -0,0 +1,152 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.VAppTemplateImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+import org.jclouds.vcloud.xml.ovf.VCloudNetworkSectionHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * @author Adrian Cole
+ */
+public class VAppTemplateHandler extends ParseSax.HandlerWithResult<VAppTemplate> {
+
+ protected final TaskHandler taskHandler;
+ protected final VmHandler vmHandler;
+ protected final VCloudNetworkSectionHandler networkSectionHandler;
+
+ @Inject
+ public VAppTemplateHandler(TaskHandler taskHandler, VmHandler vmHandler,
+ VCloudNetworkSectionHandler networkSectionHandler) {
+ this.taskHandler = taskHandler;
+ this.vmHandler = vmHandler;
+ this.networkSectionHandler = networkSectionHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType template;
+ protected Status status;
+ protected ReferenceType vdc;
+ protected String description;
+ protected List<Task> tasks = Lists.newArrayList();
+ protected boolean ovfDescriptorUploaded = true;
+ protected String vAppScopedLocalId;
+
+ private boolean inChildren;
+ private boolean inTasks;
+ private boolean inNetworkSection;
+ protected Set<Vm> children = Sets.newLinkedHashSet();
+ private VCloudNetworkSection networkSection;
+
+ public VAppTemplate getResult() {
+ return new VAppTemplateImpl(template.getName(), template.getType(), template.getHref(), status, vdc, description,
+ tasks, ovfDescriptorUploaded, vAppScopedLocalId, children, networkSection);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (equalsOrSuffix(qName, "Children")) {
+ inChildren = true;
+ } else if (equalsOrSuffix(qName, "Tasks")) {
+ inTasks = true;
+ } else if (equalsOrSuffix(qName, "NetworkSection")) {
+ inNetworkSection = true;
+ }
+ if (inChildren) {
+ vmHandler.startElement(uri, localName, qName, attrs);
+ } else if (inTasks) {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ } else if (inNetworkSection) {
+ networkSectionHandler.startElement(uri, localName, qName, attrs);
+ } else if (equalsOrSuffix(qName, "VAppTemplate")) {
+ template = newReferenceType(attributes);
+ if (attributes.containsKey("status"))
+ this.status = Status.fromValue(Integer.parseInt(attributes.get("status")));
+ } else if (equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ vdc = newReferenceType(attributes);
+ }
+
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ if (equalsOrSuffix(qName, "Children")) {
+ inChildren = false;
+ Vm vm = vmHandler.getResult();
+ if (vm != null)
+ this.children.add(vmHandler.getResult());
+ } else if (equalsOrSuffix(qName, "Tasks")) {
+ inTasks = false;
+ this.tasks.add(taskHandler.getResult());
+ } else if (equalsOrSuffix(qName, "NetworkSection")) {
+ inNetworkSection = false;
+ this.networkSection = networkSectionHandler.getResult();
+ }
+ if (inChildren) {
+ vmHandler.endElement(uri, name, qName);
+ } else if (inTasks) {
+ taskHandler.endElement(uri, name, qName);
+ } else if (inNetworkSection) {
+ networkSectionHandler.endElement(uri, name, qName);
+ } else if (equalsOrSuffix(qName, "Description")) {
+ description = currentOrNull();
+ } else if (equalsOrSuffix(qName, "VAppScopedLocalId")) {
+ vAppScopedLocalId = currentOrNull();
+ } else if (equalsOrSuffix(qName, "ovfDescriptorUploaded")) {
+ ovfDescriptorUploaded = Boolean.parseBoolean(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ if (inTasks)
+ taskHandler.characters(ch, start, length);
+ else if (inChildren)
+ vmHandler.characters(ch, start, length);
+ else if (inNetworkSection)
+ networkSectionHandler.characters(ch, start, length);
+ else
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
new file mode 100755
index 0000000..d8893d3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
@@ -0,0 +1,72 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.ovf.VirtualHardwareSection;
+import org.jclouds.ovf.xml.VirtualHardwareSectionHandler;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+import org.xml.sax.Attributes;
+
+/**
+ * @author Adrian Cole
+ */
+public class VCloudVirtualHardwareHandler extends ParseSax.HandlerWithResult<VCloudVirtualHardwareSection> {
+
+ private final VirtualHardwareSectionHandler hardwareHandler;
+
+ private ReferenceType hardware;
+
+ @Inject
+ public VCloudVirtualHardwareHandler(VirtualHardwareSectionHandler hardwareHandler) {
+ this.hardwareHandler = hardwareHandler;
+ }
+
+ public VCloudVirtualHardwareSection getResult() {
+ VirtualHardwareSection hardware = hardwareHandler.getResult();
+ return new VCloudVirtualHardwareSection(this.hardware.getType(), this.hardware.getHref(), hardware.getInfo(), hardware
+ .getTransports(), hardware.getSystem(), hardware.getItems());
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("VirtualHardwareSection")) {
+ hardware = newReferenceType(attributes);
+ }
+ hardwareHandler.startElement(uri, localName, qName, attrs);
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ hardwareHandler.endElement(uri, localName, qName);
+
+ }
+
+ @Override
+ public void characters(char ch[], int start, int length) {
+ hardwareHandler.characters(ch, start, length);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
new file mode 100755
index 0000000..ba67c93
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
@@ -0,0 +1,167 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+import static org.jclouds.vcloud.util.Utils.putReferenceType;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.Capacity;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+import org.jclouds.vcloud.domain.internal.VDCImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ */
+public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
+
+ protected final TaskHandler taskHandler;
+
+ @Inject
+ public VDCHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType vDC;
+ protected VDCStatus status = VDCStatus.READY;
+ protected ReferenceType org;
+ protected String description;
+ protected List<Task> tasks = Lists.newArrayList();
+ protected AllocationModel allocationModel = AllocationModel.UNRECOGNIZED;
+
+ protected Capacity storageCapacity;
+ protected Capacity cpuCapacity;
+ protected Capacity memoryCapacity;
+
+ protected String units;
+ protected long allocated = 0;
+ protected long limit = 0;
+ protected int used = 0;
+ protected long overhead = 0;
+
+ protected Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
+ protected Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap();
+
+ protected int nicQuota;
+ protected int networkQuota;
+ protected int vmQuota;
+ protected boolean isEnabled = true;
+
+ public VDC getResult() {
+ return new VDCImpl(vDC.getName(), vDC.getType(), vDC.getHref(), status, org, description, tasks, allocationModel,
+ storageCapacity, cpuCapacity, memoryCapacity, resourceEntities, availableNetworks, nicQuota,
+ networkQuota, vmQuota, isEnabled);
+ }
+
+ void resetCapacity() {
+ units = null;
+ allocated = 0;
+ limit = 0;
+ used = 0;
+ overhead = 0;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Vdc")) {
+ vDC = newReferenceType(attributes);
+ String status = attributes.get("status");
+ if (status != null)
+ this.status = VDCStatus.fromValue(Integer.parseInt(status));
+ } else if (qName.endsWith("Network")) {
+ putReferenceType(availableNetworks, attributes);
+ } else if (qName.endsWith("ResourceEntity")) {
+ putReferenceType(resourceEntities, attributes);
+ } else if (qName.endsWith("Link") && "up".equals(attributes.get("rel"))) {
+ org = newReferenceType(attributes);
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ taskHandler.endElement(uri, name, qName);
+ if (qName.endsWith("Task")) {
+ this.tasks.add(taskHandler.getResult());
+ } else if (qName.endsWith("Description")) {
+ description = currentOrNull();
+ } else if (qName.endsWith("AllocationModel")) {
+ allocationModel = AllocationModel.fromValue(currentOrNull());
+ } else if (qName.endsWith("Units")) {
+ units = currentOrNull();
+ } else if (qName.endsWith("Allocated")) {
+ allocated = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("Used")) {
+ used = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("Limit")) {
+ limit = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("Overhead")) {
+ overhead = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("StorageCapacity")) {
+ storageCapacity = new Capacity(units, allocated, limit, used, overhead);
+ resetCapacity();
+ } else if (qName.endsWith("Cpu")) {
+ cpuCapacity = new Capacity(units, allocated, limit, used, overhead);
+ resetCapacity();
+ } else if (qName.endsWith("Memory")) {
+ memoryCapacity = new Capacity(units, allocated, limit, used, overhead);
+ resetCapacity();
+ } else if (qName.endsWith("DeployedVmsQuota")) {
+ vmQuota = (int) limit;
+ // vcloud express doesn't have the zero is unlimited rule
+ if (vmQuota == -1)
+ vmQuota = 0;
+ } else if (qName.endsWith("VmQuota")) {
+ vmQuota = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("NicQuota")) {
+ nicQuota = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("NetworkQuota")) {
+ networkQuota = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("IsEnabled")) {
+ isEnabled = Boolean.parseBoolean(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VmHandler.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
new file mode 100755
index 0000000..1cad0ad
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
@@ -0,0 +1,178 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.VmImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+import org.jclouds.vcloud.xml.ovf.VCloudOperatingSystemHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+
+/**
+ * @author Adrian Cole
+ */
+public class VmHandler extends ParseSax.HandlerWithResult<Vm> {
+
+ protected final TaskHandler taskHandler;
+ protected final VCloudVirtualHardwareHandler virtualHardwareHandler;
+ protected final VCloudOperatingSystemHandler operatingSystemHandler;
+ protected final GuestCustomizationSectionHandler guestCustomizationHandler;
+ protected final NetworkConnectionSectionHandler networkConnectionSectionHandler;
+
+ @Inject
+ public VmHandler(TaskHandler taskHandler, VCloudVirtualHardwareHandler virtualHardwareHandler,
+ VCloudOperatingSystemHandler operatingSystemHandler,
+ NetworkConnectionSectionHandler networkConnectionSectionHandler,
+ GuestCustomizationSectionHandler guestCustomizationHandler) {
+ this.taskHandler = taskHandler;
+ this.virtualHardwareHandler = virtualHardwareHandler;
+ this.operatingSystemHandler = operatingSystemHandler;
+ this.networkConnectionSectionHandler = networkConnectionSectionHandler;
+ this.guestCustomizationHandler = guestCustomizationHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType vm;
+ protected Status status;
+ protected ReferenceType vdc;
+ protected String description;
+ protected List<Task> tasks = Lists.newArrayList();
+ protected VCloudVirtualHardwareSection hardware;
+ protected VCloudOperatingSystemSection os;
+ protected NetworkConnectionSection networkConnectionSection;
+ protected GuestCustomizationSection guestCustomization;
+ protected String vAppScopedLocalId;
+
+ private boolean inTasks;
+ private boolean inHardware;
+ private boolean inOs;
+ private boolean inNetworkConnectionSection;
+ private boolean inGuestCustomization;
+
+ public Vm getResult() {
+ return vm == null ? null : new VmImpl(vm.getName(), vm.getType(), vm.getHref(), status, vdc, description, tasks,
+ hardware, os, networkConnectionSection, guestCustomization, vAppScopedLocalId);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("VirtualHardwareSection")) {
+ inHardware = true;
+ } else if (qName.endsWith("OperatingSystemSection")) {
+ inOs = true;
+ } else if (qName.endsWith("GuestCustomizationSection")) {
+ inGuestCustomization = true;
+ } else if (qName.endsWith("NetworkConnectionSection")) {
+ inNetworkConnectionSection = true;
+ } else if (qName.endsWith("Tasks")) {
+ inTasks = true;
+ }
+ if (inHardware) {
+ virtualHardwareHandler.startElement(uri, localName, qName, attrs);
+ } else if (inOs) {
+ operatingSystemHandler.startElement(uri, localName, qName, attrs);
+ } else if (inNetworkConnectionSection) {
+ networkConnectionSectionHandler.startElement(uri, localName, qName, attrs);
+ } else if (inGuestCustomization) {
+ guestCustomizationHandler.startElement(uri, localName, qName, attrs);
+ } else if (inTasks) {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Vm")) {
+ vm = newReferenceType(attributes);
+ String status = attributes.get("status");
+ if (status != null)
+ this.status = Status.fromValue(Integer.parseInt(status));
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ vdc = newReferenceType(attributes);
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ if (qName.endsWith("VirtualHardwareSection")) {
+ inHardware = false;
+ this.hardware = virtualHardwareHandler.getResult();
+ } else if (qName.endsWith("OperatingSystemSection")) {
+ inOs = false;
+ os = operatingSystemHandler.getResult();
+ } else if (qName.endsWith("NetworkConnectionSection")) {
+ inNetworkConnectionSection = false;
+ networkConnectionSection = networkConnectionSectionHandler.getResult();
+ } else if (qName.endsWith("GuestCustomizationSection")) {
+ inGuestCustomization = false;
+ guestCustomization = guestCustomizationHandler.getResult();
+ } else if (qName.endsWith("Tasks")) {
+ inTasks = false;
+ this.tasks.add(taskHandler.getResult());
+ }
+ if (inHardware) {
+ virtualHardwareHandler.endElement(uri, name, qName);
+ } else if (inOs) {
+ operatingSystemHandler.endElement(uri, name, qName);
+ } else if (inGuestCustomization) {
+ guestCustomizationHandler.endElement(uri, name, qName);
+ } else if (inNetworkConnectionSection) {
+ networkConnectionSectionHandler.endElement(uri, name, qName);
+ } else if (inTasks) {
+ taskHandler.endElement(uri, name, qName);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Description")) {
+ description = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "VAppScopedLocalId")) {
+ vAppScopedLocalId = currentOrNull();
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ if (inHardware)
+ virtualHardwareHandler.characters(ch, start, length);
+ else if (inOs)
+ operatingSystemHandler.characters(ch, start, length);
+ else if (inGuestCustomization)
+ guestCustomizationHandler.characters(ch, start, length);
+ else if (inNetworkConnectionSection)
+ networkConnectionSectionHandler.characters(ch, start, length);
+ else if (inTasks)
+ taskHandler.characters(ch, start, length);
+ else
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
[28/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java
new file mode 100755
index 0000000..fed82dc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java
@@ -0,0 +1,233 @@
+/*
+ * 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.vcloud.domain;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+
+/**
+ * describes a single network connection.
+ *
+ * @author Adrian Cole
+ */
+public class NetworkConnection {
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+
+ private String network;
+ private int networkConnectionIndex;
+ private String ipAddress;
+ private String externalIpAddress;
+ private boolean connected;
+ private String MACAddress;
+ private IpAddressAllocationMode ipAddressAllocationMode;
+
+ public Builder network(String network) {
+ this.network = network;
+ return this;
+ }
+
+ public Builder networkConnectionIndex(int networkConnectionIndex) {
+ this.networkConnectionIndex = networkConnectionIndex;
+ return this;
+ }
+
+ public Builder ipAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ public Builder externalIpAddress(String externalIpAddress) {
+ this.externalIpAddress = externalIpAddress;
+ return this;
+ }
+
+ public Builder connected(boolean connected) {
+ this.connected = connected;
+ return this;
+ }
+
+ public Builder MACAddress(String MACAddress) {
+ this.MACAddress = MACAddress;
+ return this;
+ }
+
+ public Builder ipAddressAllocationMode(IpAddressAllocationMode ipAddressAllocationMode) {
+ this.ipAddressAllocationMode = ipAddressAllocationMode;
+ return this;
+ }
+
+ public NetworkConnection build() {
+ return new NetworkConnection(network, networkConnectionIndex, ipAddress, externalIpAddress, connected,
+ MACAddress, ipAddressAllocationMode);
+ }
+
+ public static Builder fromNetworkConnection(NetworkConnection in) {
+ return new Builder().network(in.getNetwork()).networkConnectionIndex(in.getNetworkConnectionIndex())
+ .ipAddress(in.getIpAddress()).externalIpAddress(in.getExternalIpAddress()).connected(in.isConnected())
+ .MACAddress(in.getMACAddress()).ipAddressAllocationMode(in.getIpAddressAllocationMode());
+ }
+ }
+
+ private final String network;
+ private final int networkConnectionIndex;
+ @Nullable
+ private final String ipAddress;
+ @Nullable
+ private final String externalIpAddress;
+ private final boolean connected;
+ @Nullable
+ private final String MACAddress;
+ private final IpAddressAllocationMode ipAddressAllocationMode;
+
+ public NetworkConnection(String network, int networkConnectionIndex, @Nullable String ipAddress,
+ @Nullable String externalIpAddress, boolean connected, @Nullable String MACAddress,
+ IpAddressAllocationMode ipAddressAllocationMode) {
+ this.network = network;
+ this.networkConnectionIndex = networkConnectionIndex;
+ this.ipAddress = ipAddress;
+ this.externalIpAddress = externalIpAddress;
+ this.connected = connected;
+ this.MACAddress = MACAddress;
+ this.ipAddressAllocationMode = ipAddressAllocationMode;
+ }
+
+ /**
+ * @return The name of the network to which this connection connects.
+ */
+ public String getNetwork() {
+ return network;
+ }
+
+ /**
+ * @return The value in the rasd:AddressOnParent element of the device supporting this
+ * connection.
+ */
+ public int getNetworkConnectionIndex() {
+ return networkConnectionIndex;
+ }
+
+ /**
+ * @return IP address of this connection
+ */
+ @Nullable
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ /**
+ * @return If the network that the NIC is connected to has NAT or port mapping, the external
+ * address is populated in this element.
+ */
+ @Nullable
+ public String getExternalIpAddress() {
+ return externalIpAddress;
+ }
+
+ /**
+ * @return If the vApp is deployed, specifies the current state of its connection. If the vApp is
+ * undeployed, specifies whether this connection should be connected at deployment time.
+ */
+ public boolean isConnected() {
+ return connected;
+ }
+
+ /**
+ * @return MAC address of this connection
+ */
+ @Nullable
+ public String getMACAddress() {
+ return MACAddress;
+ }
+
+ /**
+ * @return specifies how an IP address is allocated to this connection
+ */
+ public IpAddressAllocationMode getIpAddressAllocationMode() {
+ return ipAddressAllocationMode;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((MACAddress == null) ? 0 : MACAddress.hashCode());
+ result = prime * result + (connected ? 1231 : 1237);
+ result = prime * result + ((externalIpAddress == null) ? 0 : externalIpAddress.hashCode());
+ result = prime * result + ((ipAddress == null) ? 0 : ipAddress.hashCode());
+ result = prime * result + ((ipAddressAllocationMode == null) ? 0 : ipAddressAllocationMode.hashCode());
+ result = prime * result + ((network == null) ? 0 : network.hashCode());
+ result = prime * result + networkConnectionIndex;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NetworkConnection other = (NetworkConnection) obj;
+ if (MACAddress == null) {
+ if (other.MACAddress != null)
+ return false;
+ } else if (!MACAddress.equals(other.MACAddress))
+ return false;
+ if (connected != other.connected)
+ return false;
+ if (externalIpAddress == null) {
+ if (other.externalIpAddress != null)
+ return false;
+ } else if (!externalIpAddress.equals(other.externalIpAddress))
+ return false;
+ if (ipAddress == null) {
+ if (other.ipAddress != null)
+ return false;
+ } else if (!ipAddress.equals(other.ipAddress))
+ return false;
+ if (ipAddressAllocationMode == null) {
+ if (other.ipAddressAllocationMode != null)
+ return false;
+ } else if (!ipAddressAllocationMode.equals(other.ipAddressAllocationMode))
+ return false;
+ if (network == null) {
+ if (other.network != null)
+ return false;
+ } else if (!network.equals(other.network))
+ return false;
+ if (networkConnectionIndex != other.networkConnectionIndex)
+ return false;
+ return true;
+ }
+
+ public Builder toBuilder() {
+ return Builder.fromNetworkConnection(this);
+ }
+
+ @Override
+ public String toString() {
+ return "[network=" + network + ", connected=" + connected + ", ipAddress=" + ipAddress + ", externalIpAddress="
+ + externalIpAddress + ", networkConnectionIndex=" + networkConnectionIndex + ", ipAddressAllocationMode="
+ + ipAddressAllocationMode + ", MACAddress=" + MACAddress + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java
new file mode 100755
index 0000000..c6f5f37
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java
@@ -0,0 +1,218 @@
+/*
+ * 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.vcloud.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Set;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * The NetworkConnectionSection element specifies how a Vm is connected to a vApp network. It
+ * extends the ovf:NetworkConnection element.
+ * <p/>
+ * NOTE The OVF NetworkSection element and the vCloud API NetworkConnectionSection element specify
+ * many of the same parameters for a network connection. If both are present in a Vm body, the
+ * values specified in the NetworkConnectionSection override those specified in the NetworkSection.
+ */
+public class NetworkConnectionSection {
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ protected String type;
+ protected URI href;
+ protected String info;
+ protected Integer primaryNetworkConnectionIndex;
+ protected Set<NetworkConnection> connections = ImmutableSet.of();
+ protected ReferenceType edit;
+
+ public Builder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public Builder href(URI href) {
+ this.href = href;
+ return this;
+ }
+
+ public Builder info(String info) {
+ this.info = info;
+ return this;
+ }
+
+ public Builder primaryNetworkConnectionIndex(Integer primaryNetworkConnectionIndex) {
+ this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
+ return this;
+ }
+
+ public Builder connections(Iterable<NetworkConnection> connections) {
+ this.connections = ImmutableSet.copyOf(checkNotNull(connections, "connections"));
+ return this;
+ }
+
+ public Builder edit(ReferenceType edit) {
+ this.edit = edit;
+ return this;
+ }
+
+ public NetworkConnectionSection build() {
+ return new NetworkConnectionSection(type, href, info, primaryNetworkConnectionIndex, connections, edit);
+ }
+
+ public static Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
+ return new Builder().type(in.getType()).href(in.getHref()).info(in.getInfo())
+ .primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex()).connections(in.getConnections())
+ .edit(in.getEdit());
+ }
+ }
+
+ protected final String type;
+ protected final URI href;
+ protected final String info;
+ protected final Integer primaryNetworkConnectionIndex;
+ protected final Set<NetworkConnection> connections;
+ protected final ReferenceType edit;
+
+ public NetworkConnectionSection(String type, URI href, String info, Integer primaryNetworkConnectionIndex,
+ Iterable<NetworkConnection> connections, ReferenceType edit) {
+ this.type = type;
+ this.href = href;
+ this.info = info;
+ this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
+ this.connections = ImmutableSet.copyOf(checkNotNull(connections, "connections"));
+ this.edit = edit;
+ }
+
+ /**
+ *
+ * @return media type of this section
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ *
+ * @return URL to access this section
+ */
+ public URI getHref() {
+ return href;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getInfo() {
+ return info;
+ }
+
+ /**
+ *
+ * @return The value of the rasd:AddressOnParent element of the device (NIC) supporting the
+ * primary network connection to the containing virtual machine.
+ */
+ public Integer getPrimaryNetworkConnectionIndex() {
+ return primaryNetworkConnectionIndex;
+ }
+
+ /**
+ *
+ */
+ public Set<NetworkConnection> getConnections() {
+ return connections;
+ }
+
+ /**
+ *
+ */
+ public ReferenceType getEdit() {
+ return edit;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((connections == null) ? 0 : connections.hashCode());
+ result = prime * result + ((edit == null) ? 0 : edit.hashCode());
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((info == null) ? 0 : info.hashCode());
+ result = prime * result
+ + ((primaryNetworkConnectionIndex == null) ? 0 : primaryNetworkConnectionIndex.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NetworkConnectionSection other = (NetworkConnectionSection) obj;
+ if (connections == null) {
+ if (other.connections != null)
+ return false;
+ } else if (!connections.equals(other.connections))
+ return false;
+ if (edit == null) {
+ if (other.edit != null)
+ return false;
+ } else if (!edit.equals(other.edit))
+ return false;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (info == null) {
+ if (other.info != null)
+ return false;
+ } else if (!info.equals(other.info))
+ return false;
+ if (primaryNetworkConnectionIndex == null) {
+ if (other.primaryNetworkConnectionIndex != null)
+ return false;
+ } else if (!primaryNetworkConnectionIndex.equals(other.primaryNetworkConnectionIndex))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ return true;
+ }
+
+ public Builder toBuilder() {
+ return Builder.fromNetworkConnectionSection(this);
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + href + ", connections=" + connections + ", primaryNetworkConnectionIndex="
+ + primaryNetworkConnectionIndex + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java
new file mode 100755
index 0000000..a71ad2f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java
@@ -0,0 +1,86 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A vCloud organization is a high-level abstraction that provides a unit of administration for
+ * objects and resources. As viewed by a user, an organization (represented by an Org element) can
+ * contain Catalog, Network, and vDC elements. If there are any queued, running, or recently
+ * completed tasks owned by a member of the organization, it also contains a TasksList element. As
+ * viewed by an administrator, an organization also contains users, groups, and other information
+ *
+ * @author Adrian Cole
+ */
+@ImplementedBy(OrgImpl.class)
+public interface Org extends ReferenceType {
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * full name of the organization
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ String getFullName();
+
+ /**
+ * @since vcloud api 0.8
+ */
+ Map<String, ReferenceType> getCatalogs();
+
+ /**
+ * @since vcloud api 0.8
+ */
+ Map<String, ReferenceType> getVDCs();
+
+ /**
+ * If there are any queued, running, or recently completed tasks owned by a member of the
+ * organization, it also contains a TasksList.
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ ReferenceType getTasksList();
+
+ /**
+ * @since vcloud api 1.0
+ */
+ Map<String, ReferenceType> getNetworks();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java
new file mode 100755
index 0000000..98712f9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java
@@ -0,0 +1,55 @@
+/*
+ * 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.vcloud.domain;
+
+import java.net.URI;
+
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * Many container elements are populated with references to contained objects. Each reference
+ * consists of a hyperlink, an optional media type, and a name.
+ *
+ * @author Adrian Cole
+ *
+ */
+@ImplementedBy(ReferenceTypeImpl.class)
+public interface ReferenceType extends Comparable<ReferenceType> {
+ /**
+ * @return hyperlink to the referenced object
+ */
+ URI getHref();
+
+ /**
+ * @return name of the referenced object.
+ *
+ */
+ String getName();
+
+ /**
+ * @return object type, expressed as the media type of the XML representing of the object
+ * @see VCloudMediaType
+ */
+ String getType();
+
+ /**
+ * @return relationship to the referenced object.
+ */
+ String getRelationship();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java
new file mode 100755
index 0000000..d215126
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java
@@ -0,0 +1,246 @@
+/*
+ * 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.vcloud.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Objects such as vAppTemplate, vApp, and Vm have a status attribute whose value indicates the
+ * state of the object. Status for an object, such as a vAppTemplate or vApp, whose Children (Vm
+ * objects) each have a status of their own, is computed from the status of the Children.
+ *
+ * <h2>NOTE</h2>
+ * <p/>
+ * The deployment status of an object is indicated by the value of its deployed attribute.
+ *
+ * @since vcloud api 0.8
+ *
+ * @author Adrian Cole
+ */
+public enum Status {
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} could not be created.
+ *
+ * @since vcloud api 1.0
+ */
+ ERROR,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is unresolved.
+ *
+ * @since vcloud api 0.8
+ */
+ UNRESOLVED,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is resolved.
+ *
+ * @since vcloud api 0.8
+ */
+ RESOLVED,
+ /**
+ * The object is deployed.
+ * <p/>
+ * note that the documentation does not reference use of this.
+ *
+ * @since vcloud api 1.0
+ */
+ DEPLOYED,
+ /**
+ * The {@link VApp} or {@link Vm} is suspended.
+ *
+ * @since vcloud api 0.8
+ */
+ SUSPENDED,
+ /**
+ * The {@link VApp} or {@link Vm} is powered on
+ *
+ * @since vcloud api 0.8
+ */
+ ON,
+ /**
+ * The {@link VApp} or {@link Vm} waiting for user input.
+ *
+ * @since vcloud api 1.0
+ */
+ WAITING_FOR_INPUT,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is in an unknown state.
+ *
+ * @since vcloud api 1.0
+ */
+ UNKNOWN,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is in an unrecognized state.
+ *
+ * @since vcloud api 1.0
+ */
+ UNRECOGNIZED,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is off.
+ *
+ * @since vcloud api 0.8
+ */
+ OFF,
+ /**
+ * The {@link VApp} or {@link Vm} is in an inconsistent state.
+ *
+ * @since vcloud api 1.0
+ */
+ INCONSISTENT,
+ /**
+ * The {@link VAppTemplate} or {@link VApp} have children do not all have the same status.
+ *
+ * @since vcloud api 1.0
+ */
+ MIXED,
+ /**
+ * The {@link VAppTemplate} Upload initiated, OVF descriptor pending
+ *
+ * @since vcloud api 1.0
+ */
+ PENDING_DESCRIPTOR,
+ /**
+ * The {@link VAppTemplate} Upload initiated, copying contents
+ *
+ * @since vcloud api 1.0
+ */
+ COPYING,
+ /**
+ * The {@link VAppTemplate} Upload initiated, disk contents pending
+ *
+ * @since vcloud api 1.0
+ */
+ PENDING_CONTENTS,
+ /**
+ * The {@link VAppTemplate} Upload has been quarantined
+ *
+ * @since vcloud api 1.0
+ */
+ QUARANTINED,
+ /**
+ * The {@link VAppTemplate} Upload quarantine period has expired
+ *
+ * @since vcloud api 1.0
+ */
+ QUARANTINE_EXPIRED,
+ /**
+ * The {@link VAppTemplate} rejected
+ *
+ * @since vcloud api 1.0
+ */
+ REJECTED,
+ /**
+ * The {@link VAppTemplate} transfer timeout
+ *
+ * @since vcloud api 1.0
+ */
+ TRANSFER_TIMEOUT;
+
+ public String value() {
+ switch (this) {
+ case UNRESOLVED:
+ return "0";
+ case RESOLVED:
+ return "1";
+ case DEPLOYED:
+ return "2";
+ case SUSPENDED:
+ return "3";
+ case ON:
+ return "4";
+ case WAITING_FOR_INPUT:
+ return "5";
+ case UNKNOWN:
+ return "6";
+ case UNRECOGNIZED:
+ return "7";
+ case OFF:
+ return "8";
+ case INCONSISTENT:
+ return "9";
+ case MIXED:
+ return "10";
+ case PENDING_DESCRIPTOR:
+ return "11";
+ case COPYING:
+ return "12";
+ case PENDING_CONTENTS:
+ return "13";
+ case QUARANTINED:
+ return "14";
+ case QUARANTINE_EXPIRED:
+ return "15";
+ case REJECTED:
+ return "16";
+ case TRANSFER_TIMEOUT:
+ return "17";
+ default:
+ return "7";
+ }
+ }
+
+ public static Status fromValue(String status) {
+ try {
+ return fromValue(Integer.parseInt(checkNotNull(status, "status")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+ public static Status fromValue(int v) {
+ switch (v) {
+ case 0:
+ return UNRESOLVED;
+ case 1:
+ return RESOLVED;
+ case 2:
+ return DEPLOYED;
+ case 3:
+ return SUSPENDED;
+ case 4:
+ return ON;
+ case 5:
+ return WAITING_FOR_INPUT;
+ case 6:
+ return UNKNOWN;
+ case 7:
+ return UNRECOGNIZED;
+ case 8:
+ return OFF;
+ case 9:
+ return INCONSISTENT;
+ case 10:
+ return MIXED;
+ case 11:
+ return PENDING_DESCRIPTOR;
+ case 12:
+ return COPYING;
+ case 13:
+ return PENDING_CONTENTS;
+ case 14:
+ return QUARANTINED;
+ case 15:
+ return QUARANTINE_EXPIRED;
+ case 16:
+ return REJECTED;
+ case 17:
+ return TRANSFER_TIMEOUT;
+ default:
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java
new file mode 100755
index 0000000..82585d6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java
@@ -0,0 +1,72 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.Date;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * Whenever the result of a request cannot be returned immediately, the server creates a Task
+ * object. Tasks owned by an object such as a vApp or vDC are contained in the Tasks element of the
+ * object’s XML representation. This element is read‐only.
+ */
+@ImplementedBy(TaskImpl.class)
+public interface Task extends ReferenceType {
+ /**
+ * The current status of the task.
+ */
+ String getOperation();
+
+ /**
+ * The current status of the task.
+ */
+ TaskStatus getStatus();
+
+ /**
+ * date and time when the task was started.
+ */
+ Date getStartTime();
+
+ /**
+ * date and time when the task completed. Does not appear for running tasks.
+ */
+ Date getEndTime();
+
+ /**
+ * date and time at which the task expires. By default, tasks expire 24 hours after their start
+ * time. Expired tasks cannot be queried.
+ */
+ Date getExpiryTime();
+
+ /**
+ * A link to the object that owns the task. For copy operations, the owner is the copy that is
+ * being created. For delete operations, the owner is the deleted object, so this element is not
+ * included. For all other operations, the owner is the object to which the request was made.
+ */
+ ReferenceType getOwner();
+
+ /**
+ * error message or related information returned by the task
+ */
+ @Nullable
+ VCloudError getError();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java
new file mode 100755
index 0000000..f2ab975
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java
@@ -0,0 +1,71 @@
+/*
+ * 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.vcloud.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * @author Adrian Cole
+ */
+public enum TaskStatus {
+ /**
+ * The task has completed and returned a value indicating success.
+ */
+ SUCCESS,
+ /**
+ * The task is running.
+ */
+ RUNNING,
+
+ /**
+ * The task has been queued for execution.
+ */
+ QUEUED,
+ /**
+ * The task has completed and returned a value indicating an error.
+ */
+ ERROR,
+ /**
+ * not an official status, temporarily in.
+ */
+ CANCELLED, UNRECOGNIZED;
+ public String value() {
+ return name().toLowerCase();
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static TaskStatus fromValue(String status) {
+ if ("CANCELED".equals(status.toUpperCase())) {
+ // TODO: ecloud hack
+ status = "CANCELLED";
+ } else if ("FAILED".equals(status.toUpperCase())) {
+ status = "ERROR";
+ } else if ("COMPLETED".equals(status.toUpperCase())) {
+ status = "SUCCESS";
+ }
+ try {
+ return valueOf(checkNotNull(status, "status").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java
new file mode 100755
index 0000000..9d41fbc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud.domain;
+
+import java.net.URI;
+import java.util.SortedSet;
+
+import org.jclouds.vcloud.domain.internal.TasksListImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * @author Adrian Cole
+ */
+@org.jclouds.vcloud.endpoints.TasksList
+@ImplementedBy(TasksListImpl.class)
+public interface TasksList {
+
+ URI getLocation();
+
+ SortedSet<Task> getTasks();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java
new file mode 100755
index 0000000..957bfd8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.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.vcloud.domain;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+
+/**
+ * A VApp is the result of instantiation of a {@link VAppTemplate}. <h2>note</h2>
+ * <p/>
+ * When the {@link #getStatus} is {@link Status#UNRESOLVED}, there will be a task present for the
+ * instantiation of the VApp.
+ *
+ * @author Adrian Cole
+ */
+public interface VApp extends ReferenceType {
+ /**
+ * Reference to the vdc containing this vApp.
+ *
+ * @since vcloud api 1.0
+ * @return vdc, or null if this is a version before 1.0 where the org isn't present
+ */
+ ReferenceType getVDC();
+
+ /**
+ * The creation status of the vDC
+ *
+ * @since vcloud api 1.0
+ */
+ Status getStatus();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ *
+ * @return true if the OVF descriptor for the template has been uploaded to the containing vDC.
+ * @since vcloud api 1.0
+ */
+ boolean isOvfDescriptorUploaded();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+ /**
+ * container for Vm elements representing virtual machines
+ *
+ * @since vcloud api 1.0
+ */
+ Set<Vm> getChildren();
+
+ /**
+ * description of the predefined vApp internal networks in this template
+ *
+ * @return null if the vApp is not yet instantiated
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ VCloudNetworkSection getNetworkSection();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java
new file mode 100755
index 0000000..b290f2c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java
@@ -0,0 +1,97 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.VAppTemplateImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A VAppTemplate is an abstract description of a vApp. It is created when you upload an OVF package
+ * to a vDC.
+ *
+ * @author Adrian Cole
+ */
+@ImplementedBy(VAppTemplateImpl.class)
+public interface VAppTemplate extends ReferenceType {
+ /**
+ * Reference to the VDC containing this template.
+ *
+ * @since vcloud api 1.0
+ * @return org, or null if this is a version before 1.0 where the vdc isn't present
+ */
+ ReferenceType getVDC();
+
+ /**
+ * @return creation status of the VAppTemplate.
+ *
+ * @since vcloud api 1.0
+ */
+ Status getStatus();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read-only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+ /**
+ *
+ * @return true if the OVF descriptor for the template has been uploaded to the containing vDC.
+ * @since vcloud api 1.0
+ */
+ boolean isOvfDescriptorUploaded();
+
+ /**
+ * read-only identifier created on import
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ String getVAppScopedLocalId();
+
+ /**
+ * container for Vm elements representing virtual machines
+ *
+ * @since vcloud api 1.0
+ */
+ Set<Vm> getChildren();
+
+ /**
+ * description of the predefined vApp internal networks in this template
+ *
+ * @return null if the vAppTemplate is still copying
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ VCloudNetworkSection getNetworkSection();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java
new file mode 100755
index 0000000..1c8f26d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java
@@ -0,0 +1,123 @@
+/*
+ * 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.vcloud.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.ErrorImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ *
+ *
+ * @author Adrian Cole
+ */
+@ImplementedBy(ErrorImpl.class)
+public interface VCloudError {
+ public static enum MinorCode {
+ /**
+ * The request was made by a user who had insufficient rights to the object or operation.
+ */
+ ACCESS_TO_RESOURCE_IS_FORBIDDEN,
+ /**
+ * The request could not be validated or contained invalid XML.
+ */
+ BAD_REQUEST,
+ /**
+ * A conflict was detected between sections of an OVF descriptor.
+ */
+ CONFLICT,
+ /**
+ * The entity is busy
+ */
+ BUSY_ENTITY,
+ /**
+ * An attempt to instantiate a vAppTemplate or use a vAppTemplate or a Vm in a composition did
+ * not include an AllEULAsAccepted element with a value of true.
+ */
+ EULA_NOT_ACCEPTED,
+ /**
+ * Returned for any failure that cannot be matched to another minor error code.
+ */
+ INTERNAL_SERVER_ERROR,
+ /**
+ * One or more references (href attribute values) supplied in the request could not be
+ * resolved to an object.
+ */
+ INVALID_REFERENCE,
+ /**
+ * The HTTP method (GET, PUT, POST, DELETE) is not allowed for the request.
+ */
+ METHOD_NOT_ALLOWED,
+ /**
+ * One or more references (href attribute values) supplied in the request could not be
+ * resolved to an object, or the Content‐type of the request was incorrect.
+ */
+ RESOURCE_NOT_FOUND,
+ /**
+ * The request raised an exception that did not match any HTTP status code.
+ */
+ UNKNOWN,
+ /**
+ * The wrong content type was specified for the request.
+ */
+ UNSUPPORTED_MEDIA_TYPE, UNRECOGNIZED;
+
+ public static MinorCode fromValue(String minorCode) {
+ try {
+ return valueOf(checkNotNull(minorCode, "minorCode"));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+ }
+
+ /**
+ *
+ * @return message describing the error
+ */
+ String getMessage();
+
+ /**
+ *
+ * @return matches the HTTP status code
+ */
+ int getMajorErrorCode();
+
+ /**
+ *
+ * @return error code specific to the failed operation or null if vcloud <0.9
+ */
+ @Nullable
+ MinorCode getMinorErrorCode();
+
+ /**
+ *
+ * @return optional additional information about the source of the error
+ */
+ @Nullable
+ String getVendorSpecificErrorCode();
+
+ /**
+ *
+ * @return stack trace of the error, if available. This attribute is returned only when a request
+ * is made by the system administrator.
+ */
+ String getStackTrace();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java
new file mode 100755
index 0000000..1ba5699
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java
@@ -0,0 +1,29 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.Map;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public interface VCloudSession {
+ String getVCloudToken();
+
+ Map<String, ReferenceType> getOrgs();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java
new file mode 100755
index 0000000..205a38a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java
@@ -0,0 +1,146 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.VDCImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A vDC is a deployment environment for vApps. A Vdc element provides a user view of a vDC.
+ *
+ * @author Adrian Cole
+ */
+@org.jclouds.vcloud.endpoints.VDC
+@ImplementedBy(VDCImpl.class)
+public interface VDC extends ReferenceType {
+ /**
+ * Reference to the org containing this vDC.
+ *
+ * @since vcloud api 1.0
+ * @return org, or null if this is a version before 1.0 where the org isn't present
+ */
+ ReferenceType getOrg();
+
+ /**
+ * The creation status of the vDC
+ *
+ * @since vcloud api 1.0
+ */
+ VDCStatus getStatus();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+ /**
+ * defines how resources are allocated by the vDC. The value of this element is set by the
+ * administrator who created the vDC. It is read‐only to users.
+ *
+ * @since vcloud api 1.0
+ */
+ AllocationModel getAllocationModel();
+
+ /**
+ * defines the storage capacity available in the vDC
+ *
+ * @since vcloud api 0.8
+ * @return null if the provider doesn't support storage capacity
+ */
+ @Nullable
+ Capacity getStorageCapacity();
+
+ /**
+ * reports CPU resource consumption in a vDC
+ *
+ * @since vcloud api 0.8
+ * @return null if the provider doesn't support cpu capacity
+ */
+ @Nullable
+ Capacity getCpuCapacity();
+
+ /**
+ * reports memory resource consumption in a vDC
+ *
+ * @since vcloud api 0.8
+ * @return null if the provider doesn't support memory capacity
+ */
+ @Nullable
+ Capacity getMemoryCapacity();
+
+ /**
+ * container for ResourceEntity elements
+ *
+ * @since vcloud api 0.8
+ */
+ Map<String, ReferenceType> getResourceEntities();
+
+ /**
+ * container for OrgNetwork elements that represent organization networks contained by the vDC
+ *
+ * @since vcloud api 0.8
+ */
+ Map<String, ReferenceType> getAvailableNetworks();
+
+ /**
+ * maximum number of virtual NICs allowed in this vDC. Defaults to 0, which specifies an
+ * unlimited number.
+ *
+ * @since vcloud api 1.0
+ */
+ int getNicQuota();
+
+ /**
+ * maximum number of OrgNetwork objects that can be deployed in this vDC. Defaults to 0, which
+ * specifies an unlimited number.
+ *
+ * @since vcloud api 1.0
+ */
+ int getNetworkQuota();
+
+ /**
+ * maximum number of virtual machines that can be deployed in this vDC. Defaults to 0, which
+ * specifies an unlimited number.
+ *
+ * @since vcloud api 0.8
+ */
+ int getVmQuota();
+
+ /**
+ * true if this vDC is enabled
+ *
+ * @since vcloud api 1.0
+ */
+ boolean isEnabled();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java
new file mode 100755
index 0000000..81b25d9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java
@@ -0,0 +1,57 @@
+/*
+ * 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.vcloud.domain;
+
+/**
+ * The creation status of the vDC
+ *
+ * @see VDC#getStatus
+ */
+public enum VDCStatus {
+
+ CREATION_FAILED, NOT_READY, READY, UNKNOWN, UNRECOGNIZED;
+
+ public int value() {
+ switch (this) {
+ case CREATION_FAILED:
+ return -1;
+ case NOT_READY:
+ return 0;
+ case READY:
+ return 1;
+ case UNKNOWN:
+ return 2;
+ default:
+ return 3;
+ }
+ }
+
+ public static VDCStatus fromValue(int status) {
+ switch (status) {
+ case -1:
+ return CREATION_FAILED;
+ case 0:
+ return NOT_READY;
+ case 1:
+ return READY;
+ case 2:
+ return UNKNOWN;
+ default:
+ return UNRECOGNIZED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java
new file mode 100755
index 0000000..0fd8f34
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java
@@ -0,0 +1,108 @@
+/*
+ * 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.vcloud.domain;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.VmImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A Vm represents a virtual machine, a member of a vApp’s Children container. <h2>note</h2>
+ * <p/>
+ * When the {@link #getStatus} is {@link Status#UNRESOLVED}, there will be a task present for the
+ * instantiation of the VApp.
+ *
+ * @author Adrian Cole
+ */
+@ImplementedBy(VmImpl.class)
+public interface Vm extends ReferenceType {
+ /**
+ * Reference to the {@link VApp} or {@link VAppTemplate} containing this vm.
+ *
+ * @since vcloud api 1.0
+ */
+ ReferenceType getParent();
+
+ /**
+ * @return creation status of the Vm or null, if a part of a VAppTemplate
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ Status getStatus();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+ /**
+ * @return virtual hardware that comprises this VM, or null, if part of a vApp template
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ VCloudVirtualHardwareSection getVirtualHardwareSection();
+
+ /**
+ * @return operating system on this VM, or null, if part of a vApp template
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ VCloudOperatingSystemSection getOperatingSystemSection();
+
+ /**
+ * @return network connections for this VM, or null if it doesn't exist
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ NetworkConnectionSection getNetworkConnectionSection();
+
+ /**
+ * @return guest customization section for this VM, or null if it doesn't exist
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ GuestCustomizationSection getGuestCustomizationSection();
+
+ /**
+ * read-only identifier created on import
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ String getVAppScopedLocalId();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java
new file mode 100755
index 0000000..983600e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java
@@ -0,0 +1,193 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class CatalogImpl extends LinkedHashMap<String, ReferenceType> implements Catalog {
+
+ private final String name;
+ private final String type;
+ private final URI href;
+ private final ReferenceType org;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final boolean published;
+ private final boolean readOnly;
+
+ public CatalogImpl(String name, String type, URI href, ReferenceType org, @Nullable String description,
+ Map<String, ReferenceType> contents, Iterable<Task> tasks, boolean published, boolean readOnly) {
+ this.name = checkNotNull(name, "name");
+ this.type = checkNotNull(type, "type");
+ this.org = org;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ this.href = checkNotNull(href, "href");
+ putAll(checkNotNull(contents, "contents"));
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.published = published;
+ this.readOnly = readOnly;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URI getHref() {
+ return href;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getOrg() {
+ return org;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isPublished() {
+ return published;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((org == null) ? 0 : org.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CatalogImpl other = (CatalogImpl) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (org == null) {
+ if (other.org != null)
+ return false;
+ } else if (!org.equals(other.org))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ReferenceType o) {
+ return (this == o) ? 0 : getHref().compareTo(o.getHref());
+ }
+
+ @Override
+ public String getRelationship() {
+ throw new UnsupportedOperationException();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java
new file mode 100755
index 0000000..5a972e5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java
@@ -0,0 +1,111 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.collect.Maps;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class CatalogItemImpl extends ReferenceTypeImpl implements CatalogItem {
+
+ private final String description;
+ private final ReferenceType entity;
+ private final Map<String, String> properties = Maps.newLinkedHashMap();
+
+ public CatalogItemImpl(String name, URI id, @Nullable String description, ReferenceType entity,
+ Map<String, String> properties) {
+ super(name, VCloudMediaType.CATALOGITEM_XML, id);
+ this.description = description;
+ this.entity = checkNotNull(entity, "entity");
+ this.properties.putAll(checkNotNull(properties, "properties"));
+ }
+
+ @Override
+ public String getType() {
+ return VCloudMediaType.CATALOGITEM_XML;
+ }
+
+ public ReferenceType getEntity() {
+ return entity;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public String toString() {
+ return "CatalogItemImpl [id=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description="
+ + getDescription() + ", entity=" + entity + ", properties=" + properties + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((entity == null) ? 0 : entity.hashCode());
+ result = prime * result + ((properties == null) ? 0 : properties.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CatalogItemImpl other = (CatalogItemImpl) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (entity == null) {
+ if (other.entity != null)
+ return false;
+ } else if (!entity.equals(other.entity))
+ return false;
+ if (properties == null) {
+ if (other.properties != null)
+ return false;
+ } else if (!properties.equals(other.properties))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java
new file mode 100755
index 0000000..5eb7ea1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java
@@ -0,0 +1,119 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.VCloudError;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class ErrorImpl implements VCloudError {
+ private final String message;
+ private final int majorErrorCode;
+ private final MinorCode minorErrorCode;
+ @Nullable
+ private final String vendorSpecificErrorCode;
+ @Nullable
+ private final String stackTrace;
+
+ public ErrorImpl(String message, int majorErrorCode, @Nullable MinorCode minorErrorCode,
+ @Nullable String vendorSpecificErrorCode, @Nullable String stackTrace) {
+ this.message = checkNotNull(message, "message");
+ this.majorErrorCode = majorErrorCode;
+ this.minorErrorCode = minorErrorCode; // check null after 0.8 is gone
+ this.vendorSpecificErrorCode = vendorSpecificErrorCode;
+ this.stackTrace = stackTrace;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public int getMajorErrorCode() {
+ return majorErrorCode;
+ }
+
+ public MinorCode getMinorErrorCode() {
+ return minorErrorCode;
+ }
+
+ public String getVendorSpecificErrorCode() {
+ return vendorSpecificErrorCode;
+ }
+
+ public String getStackTrace() {
+ return stackTrace;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + majorErrorCode;
+ result = prime * result + ((message == null) ? 0 : message.hashCode());
+ result = prime * result + ((minorErrorCode == null) ? 0 : minorErrorCode.hashCode());
+ result = prime * result + ((stackTrace == null) ? 0 : stackTrace.hashCode());
+ result = prime * result + ((vendorSpecificErrorCode == null) ? 0 : vendorSpecificErrorCode.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ErrorImpl other = (ErrorImpl) obj;
+ if (majorErrorCode != other.majorErrorCode)
+ return false;
+ if (message == null) {
+ if (other.message != null)
+ return false;
+ } else if (!message.equals(other.message))
+ return false;
+ if (minorErrorCode == null) {
+ if (other.minorErrorCode != null)
+ return false;
+ } else if (!minorErrorCode.equals(other.minorErrorCode))
+ return false;
+ if (stackTrace == null) {
+ if (other.stackTrace != null)
+ return false;
+ } else if (!stackTrace.equals(other.stackTrace))
+ return false;
+ if (vendorSpecificErrorCode == null) {
+ if (other.vendorSpecificErrorCode != null)
+ return false;
+ } else if (!vendorSpecificErrorCode.equals(other.vendorSpecificErrorCode))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[majorErrorCode=" + majorErrorCode + ", message=" + message + ", minorErrorCode=" + minorErrorCode
+ + ", stackTrace=" + stackTrace + ", vendorSpecificErrorCode=" + vendorSpecificErrorCode + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java
new file mode 100755
index 0000000..a085076
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java
@@ -0,0 +1,171 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class OrgImpl extends ReferenceTypeImpl implements Org {
+ private final String fullName;
+ @Nullable
+ private final String description;
+ private final Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
+ private final Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
+ private final Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
+ private final ReferenceType tasksList;
+ private final List<Task> tasks = Lists.newArrayList();
+
+ public OrgImpl(String name, String type, URI id, String fullName, String description,
+ Map<String, ReferenceType> catalogs, Map<String, ReferenceType> vdcs, Map<String, ReferenceType> networks,
+ @Nullable ReferenceType tasksList, Iterable<Task> tasks) {
+ super(name, type, id);
+ this.fullName = checkNotNull(fullName, "fullName");
+ this.description = description;
+ this.catalogs.putAll(checkNotNull(catalogs, "catalogs"));
+ this.vdcs.putAll(checkNotNull(vdcs, "vdcs"));
+ this.networks.putAll(checkNotNull(networks, "networks"));
+ this.tasksList = tasksList;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ }
+
+ @Override
+ public String getFullName() {
+ return fullName;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public Map<String, ReferenceType> getCatalogs() {
+ return catalogs;
+ }
+
+ @Override
+ public Map<String, ReferenceType> getVDCs() {
+ return vdcs;
+ }
+
+ @Override
+ public Map<String, ReferenceType> getNetworks() {
+ return networks;
+ }
+
+ @Override
+ public ReferenceType getTasksList() {
+ return tasksList;
+ }
+
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((catalogs == null) ? 0 : catalogs.hashCode());
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
+ result = prime * result + ((networks == null) ? 0 : networks.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + ((tasksList == null) ? 0 : tasksList.hashCode());
+ result = prime * result + ((vdcs == null) ? 0 : vdcs.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ OrgImpl other = (OrgImpl) obj;
+ if (catalogs == null) {
+ if (other.catalogs != null)
+ return false;
+ } else if (!catalogs.equals(other.catalogs))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (fullName == null) {
+ if (other.fullName != null)
+ return false;
+ } else if (!fullName.equals(other.fullName))
+ return false;
+ if (networks == null) {
+ if (other.networks != null)
+ return false;
+ } else if (!networks.equals(other.networks))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ if (tasksList == null) {
+ if (other.tasksList != null)
+ return false;
+ } else if (!tasksList.equals(other.tasksList))
+ return false;
+ if (vdcs == null) {
+ if (other.vdcs != null)
+ return false;
+ } else if (!vdcs.equals(other.vdcs))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ReferenceType o) {
+ return (this == o) ? 0 : getHref().compareTo(o.getHref());
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", fullName=" + fullName
+ + ", description=" + description + ", catalogs=" + catalogs + ", networks=" + networks + ", tasksList="
+ + tasksList + ", vdcs=" + vdcs + ", tasks=" + tasks + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java
new file mode 100755
index 0000000..b0ed12f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.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.vcloud.domain.internal;
+
+import static com.google.common.base.Objects.equal;
+
+import java.net.URI;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Location of a Rest resource
+ *
+ * @author Adrian Cole
+ *
+ */
+public class ReferenceTypeImpl implements ReferenceType {
+ private final String name;
+ private final String type;
+ private final URI href;
+ private final String relationship;
+
+ public ReferenceTypeImpl(String name, String type, URI href) {
+ this.name = name;
+ this.type = type;
+ this.href = href;
+ this.relationship = null;
+ }
+
+ public ReferenceTypeImpl(String name, String type, URI href, String relationship) {
+ this.name = name;
+ this.type = type;
+ this.href = href;
+ this.relationship = relationship;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public URI getHref() {
+ return href;
+ }
+
+ @Override
+ public int compareTo(ReferenceType that) {
+ return (this == that) ? 0 : getHref().compareTo(that.getHref());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ReferenceTypeImpl that = ReferenceTypeImpl.class.cast(o);
+ return equal(this.href, that.href);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(href);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper("").omitNullValues().add("href", href).add("name", name).add("type", type).add("relationship", relationship);
+ }
+
+ @Override
+ public String getRelationship() {
+ return relationship;
+ }
+
+}
[27/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java
new file mode 100755
index 0000000..8e44c4b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java
@@ -0,0 +1,165 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Date;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.VCloudError;
+
+import com.google.common.base.Objects;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class TaskImpl extends ReferenceTypeImpl implements Task {
+
+ private final String operation;
+ private final TaskStatus status;
+ private final Date startTime;
+ @Nullable
+ private final Date endTime;
+ @Nullable
+ private final Date expiryTime;
+ private final ReferenceType owner;
+ @Nullable
+ private final VCloudError error;
+
+ public TaskImpl(URI id, String operation, TaskStatus status, Date startTime, @Nullable Date endTime,
+ @Nullable Date expiryTime, ReferenceType owner, VCloudError error) {
+ super(null, VCloudMediaType.TASK_XML, id);
+ this.operation = operation;
+ this.status = checkNotNull(status, "status");
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.expiryTime = expiryTime;
+ this.owner = owner;
+ this.error = error;
+ }
+
+ @Override
+ public TaskStatus getStatus() {
+ return status;
+ }
+
+ @Override
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ @Override
+ public ReferenceType getOwner() {
+ return owner;
+ }
+
+ @Override
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ @Override
+ public VCloudError getError() {
+ return error;
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("href", getHref()).add("name", getName())
+ .add("owner", owner).add("operation", operation).add("startTime", startTime).add("endTime", endTime)
+ .add("expiryTime", expiryTime).add("error", error).toString();
+ }
+
+ public Date getExpiryTime() {
+ return expiryTime;
+ }
+
+ @Override
+ public String getOperation() {
+ return operation;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
+ result = prime * result + ((error == null) ? 0 : error.hashCode());
+ result = prime * result + ((expiryTime == null) ? 0 : expiryTime.hashCode());
+ result = prime * result + ((operation == null) ? 0 : operation.hashCode());
+ result = prime * result + ((owner == null) ? 0 : owner.hashCode());
+ result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TaskImpl other = (TaskImpl) obj;
+ if (endTime == null) {
+ if (other.endTime != null)
+ return false;
+ } else if (!endTime.equals(other.endTime))
+ return false;
+ if (error == null) {
+ if (other.error != null)
+ return false;
+ } else if (!error.equals(other.error))
+ return false;
+ if (expiryTime == null) {
+ if (other.expiryTime != null)
+ return false;
+ } else if (!expiryTime.equals(other.expiryTime))
+ return false;
+ if (operation == null) {
+ if (other.operation != null)
+ return false;
+ } else if (!operation.equals(other.operation))
+ return false;
+ if (owner == null) {
+ if (other.owner != null)
+ return false;
+ } else if (!owner.equals(other.owner))
+ return false;
+ if (startTime == null) {
+ if (other.startTime != null)
+ return false;
+ } else if (!startTime.equals(other.startTime))
+ return false;
+ if (status == null) {
+ if (other.status != null)
+ return false;
+ } else if (!status.equals(other.status))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java
new file mode 100755
index 0000000..0e9c7cf
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java
@@ -0,0 +1,81 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import java.net.URI;
+import java.util.SortedSet;
+
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TasksList;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class TasksListImpl implements TasksList {
+ private final SortedSet<Task> tasks;
+ private final URI id;
+
+ public TasksListImpl(URI id, SortedSet<Task> tasks) {
+ this.id = id;
+ this.tasks = tasks;
+ }
+
+ @Override
+ public SortedSet<Task> getTasks() {
+ return tasks;
+ }
+
+ @Override
+ public URI getLocation() {
+ return id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TasksListImpl other = (TasksListImpl) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java
new file mode 100755
index 0000000..10ca596
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java
@@ -0,0 +1,166 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class VAppImpl extends ReferenceTypeImpl implements VApp {
+
+ private final Status status;
+ private final ReferenceType vdc;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final boolean ovfDescriptorUploaded;
+ private final Set<Vm> children = Sets.newLinkedHashSet();
+ @Nullable
+ private final VCloudNetworkSection networkSection;
+
+ public VAppImpl(String name, String type, URI id, Status status, ReferenceType vdc, @Nullable String description,
+ Iterable<Task> tasks, boolean ovfDescriptorUploaded, Iterable<Vm> children,
+ @Nullable VCloudNetworkSection networkSection) {
+ super(name, type, id);
+ this.status = checkNotNull(status, "status");
+ this.vdc = vdc;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.ovfDescriptorUploaded = ovfDescriptorUploaded;
+ Iterables.addAll(this.children, checkNotNull(children, "children"));
+ this.networkSection = networkSection; // can be null when copying
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getVDC() {
+ return vdc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOvfDescriptorUploaded() {
+ return ovfDescriptorUploaded;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Vm> getChildren() {
+ return children;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudNetworkSection getNetworkSection() {
+ return networkSection;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + (ovfDescriptorUploaded ? 1231 : 1237);
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + ((vdc == null) ? 0 : vdc.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VAppImpl other = (VAppImpl) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (ovfDescriptorUploaded != other.ovfDescriptorUploaded)
+ return false;
+ if (vdc == null) {
+ if (other.vdc != null)
+ return false;
+ } else if (!vdc.equals(other.vdc))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status="
+ + status + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java
new file mode 100755
index 0000000..ffa034e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java
@@ -0,0 +1,205 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class VAppTemplateImpl extends ReferenceTypeImpl implements VAppTemplate {
+
+ private final Status status;
+ private final ReferenceType vdc;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final boolean ovfDescriptorUploaded;
+ private final String vAppScopedLocalId;
+ private final Set<Vm> children = Sets.newLinkedHashSet();
+ @Nullable
+ private final VCloudNetworkSection networkSection;
+
+ public VAppTemplateImpl(String name, String type, URI id, Status status, ReferenceType vdc,
+ @Nullable String description, Iterable<Task> tasks, boolean ovfDescriptorUploaded,
+ @Nullable String vAppScopedLocalId, Iterable<Vm> children,
+ @Nullable VCloudNetworkSection networkSection) {
+ super(name, type, id);
+ this.status = checkNotNull(status, "status");
+ this.vdc = vdc;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.vAppScopedLocalId = vAppScopedLocalId;
+ this.ovfDescriptorUploaded = ovfDescriptorUploaded;
+ Iterables.addAll(this.children, checkNotNull(children, "children"));
+ this.networkSection = networkSection; // can be null when copying
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getVDC() {
+ return vdc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getVAppScopedLocalId() {
+ return vAppScopedLocalId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOvfDescriptorUploaded() {
+ return ovfDescriptorUploaded;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Vm> getChildren() {
+ return children;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudNetworkSection getNetworkSection() {
+ return networkSection;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((children == null) ? 0 : children.hashCode());
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((networkSection == null) ? 0 : networkSection.hashCode());
+ result = prime * result + (ovfDescriptorUploaded ? 1231 : 1237);
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + ((vAppScopedLocalId == null) ? 0 : vAppScopedLocalId.hashCode());
+ result = prime * result + ((vdc == null) ? 0 : vdc.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VAppTemplateImpl other = (VAppTemplateImpl) obj;
+ if (children == null) {
+ if (other.children != null)
+ return false;
+ } else if (!children.equals(other.children))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (networkSection == null) {
+ if (other.networkSection != null)
+ return false;
+ } else if (!networkSection.equals(other.networkSection))
+ return false;
+ if (ovfDescriptorUploaded != other.ovfDescriptorUploaded)
+ return false;
+ if (status == null) {
+ if (other.status != null)
+ return false;
+ } else if (!status.equals(other.status))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ if (vAppScopedLocalId == null) {
+ if (other.vAppScopedLocalId != null)
+ return false;
+ } else if (!vAppScopedLocalId.equals(other.vAppScopedLocalId))
+ return false;
+ if (vdc == null) {
+ if (other.vdc != null)
+ return false;
+ } else if (!vdc.equals(other.vdc))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status="
+ + status + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java
new file mode 100755
index 0000000..8afa6d9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java
@@ -0,0 +1,292 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.Capacity;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class VDCImpl extends ReferenceTypeImpl implements VDC {
+
+ private final VDCStatus status;
+ private final ReferenceType org;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final AllocationModel allocationModel;
+ private final Capacity storageCapacity;
+ private final Capacity cpuCapacity;
+ private final Capacity memoryCapacity;
+ private final Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
+ private final Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap();
+ private final int nicQuota;
+ private final int networkQuota;
+ private final int vmQuota;
+ private final boolean isEnabled;
+
+ public VDCImpl(String name, String type, URI id, VDCStatus status, ReferenceType org, @Nullable String description,
+ Iterable<Task> tasks, AllocationModel allocationModel, @Nullable Capacity storageCapacity,
+ @Nullable Capacity cpuCapacity, @Nullable Capacity memoryCapacity,
+ Map<String, ReferenceType> resourceEntities, Map<String, ReferenceType> availableNetworks, int nicQuota,
+ int networkQuota, int vmQuota, boolean isEnabled) {
+ super(name, type, id);
+ this.status = checkNotNull(status, "status");
+ this.org = org;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.allocationModel = checkNotNull(allocationModel, "allocationModel");
+ this.storageCapacity = storageCapacity;// TODO: once <1.0 is killed check not null
+ this.cpuCapacity = cpuCapacity;// TODO: once <1.0 is killed check not null
+ this.memoryCapacity = memoryCapacity;// TODO: once <1.0 is killed check not null
+ this.resourceEntities.putAll(checkNotNull(resourceEntities, "resourceEntities"));
+ this.availableNetworks.putAll(checkNotNull(availableNetworks, "availableNetworks"));
+ this.nicQuota = nicQuota;
+ this.networkQuota = networkQuota;
+ this.vmQuota = vmQuota;
+ this.isEnabled = isEnabled;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VDCStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getOrg() {
+ return org;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AllocationModel getAllocationModel() {
+ return allocationModel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Capacity getStorageCapacity() {
+ return storageCapacity;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Capacity getCpuCapacity() {
+ return cpuCapacity;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Capacity getMemoryCapacity() {
+ return memoryCapacity;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<String, ReferenceType> getResourceEntities() {
+ return resourceEntities;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<String, ReferenceType> getAvailableNetworks() {
+ return availableNetworks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getNicQuota() {
+ return nicQuota;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getNetworkQuota() {
+ return networkQuota;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getVmQuota() {
+ return vmQuota;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEnabled() {
+ return isEnabled;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((allocationModel == null) ? 0 : allocationModel.hashCode());
+ result = prime * result + ((availableNetworks == null) ? 0 : availableNetworks.hashCode());
+ result = prime * result + ((cpuCapacity == null) ? 0 : cpuCapacity.hashCode());
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + (isEnabled ? 1231 : 1237);
+ result = prime * result + ((memoryCapacity == null) ? 0 : memoryCapacity.hashCode());
+ result = prime * result + networkQuota;
+ result = prime * result + nicQuota;
+ result = prime * result + ((org == null) ? 0 : org.hashCode());
+ result = prime * result + ((resourceEntities == null) ? 0 : resourceEntities.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ result = prime * result + ((storageCapacity == null) ? 0 : storageCapacity.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + vmQuota;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VDCImpl other = (VDCImpl) obj;
+ if (allocationModel == null) {
+ if (other.allocationModel != null)
+ return false;
+ } else if (!allocationModel.equals(other.allocationModel))
+ return false;
+ if (availableNetworks == null) {
+ if (other.availableNetworks != null)
+ return false;
+ } else if (!availableNetworks.equals(other.availableNetworks))
+ return false;
+ if (cpuCapacity == null) {
+ if (other.cpuCapacity != null)
+ return false;
+ } else if (!cpuCapacity.equals(other.cpuCapacity))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (isEnabled != other.isEnabled)
+ return false;
+ if (memoryCapacity == null) {
+ if (other.memoryCapacity != null)
+ return false;
+ } else if (!memoryCapacity.equals(other.memoryCapacity))
+ return false;
+ if (networkQuota != other.networkQuota)
+ return false;
+ if (nicQuota != other.nicQuota)
+ return false;
+ if (org == null) {
+ if (other.org != null)
+ return false;
+ } else if (!org.equals(other.org))
+ return false;
+ if (resourceEntities == null) {
+ if (other.resourceEntities != null)
+ return false;
+ } else if (!resourceEntities.equals(other.resourceEntities))
+ return false;
+ if (status == null) {
+ if (other.status != null)
+ return false;
+ } else if (!status.equals(other.status))
+ return false;
+ if (storageCapacity == null) {
+ if (other.storageCapacity != null)
+ return false;
+ } else if (!storageCapacity.equals(other.storageCapacity))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ if (vmQuota != other.vmQuota)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[id=" + getHref() + ", name=" + getName() + ", org=" + org + ", description=" + description + ", status="
+ + status + ", isEnabled=" + isEnabled + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java
new file mode 100755
index 0000000..f23c388
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java
@@ -0,0 +1,217 @@
+/*
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class VmImpl extends ReferenceTypeImpl implements Vm {
+
+ @Nullable
+ private final Status status;
+ private final ReferenceType vApp;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ @Nullable
+ private final VCloudVirtualHardwareSection hardware;
+ private final String vAppScopedLocalId;
+ private final VCloudOperatingSystemSection os;
+ @Nullable
+ private final GuestCustomizationSection guestCustomization;
+ @Nullable
+ private final NetworkConnectionSection networkConnectionSection;
+
+ public VmImpl(String name, String type, URI id, @Nullable Status status, ReferenceType vApp,
+ @Nullable String description, Iterable<Task> tasks, @Nullable VCloudVirtualHardwareSection hardware,
+ @Nullable VCloudOperatingSystemSection os, @Nullable NetworkConnectionSection networkConnectionSection,
+ @Nullable GuestCustomizationSection guestCustomization, @Nullable String vAppScopedLocalId) {
+ super(name, type, id);
+ this.status = status;
+ this.vApp = vApp;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.hardware = hardware;
+ this.os = os;
+ this.networkConnectionSection = networkConnectionSection;
+ this.guestCustomization = guestCustomization;
+ this.vAppScopedLocalId = vAppScopedLocalId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Nullable
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getParent() {
+ return vApp;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudVirtualHardwareSection getVirtualHardwareSection() {
+ return hardware;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudOperatingSystemSection getOperatingSystemSection() {
+ return os;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NetworkConnectionSection getNetworkConnectionSection() {
+ return networkConnectionSection;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public GuestCustomizationSection getGuestCustomizationSection() {
+ return guestCustomization;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getVAppScopedLocalId() {
+ return vAppScopedLocalId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((guestCustomization == null) ? 0 : guestCustomization.hashCode());
+ result = prime * result + ((hardware == null) ? 0 : hardware.hashCode());
+ result = prime * result + ((networkConnectionSection == null) ? 0 : networkConnectionSection.hashCode());
+ result = prime * result + ((os == null) ? 0 : os.hashCode());
+ result = prime * result + ((vApp == null) ? 0 : vApp.hashCode());
+ result = prime * result + ((vAppScopedLocalId == null) ? 0 : vAppScopedLocalId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VmImpl other = (VmImpl) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (guestCustomization == null) {
+ if (other.guestCustomization != null)
+ return false;
+ } else if (!guestCustomization.equals(other.guestCustomization))
+ return false;
+ if (hardware == null) {
+ if (other.hardware != null)
+ return false;
+ } else if (!hardware.equals(other.hardware))
+ return false;
+ if (networkConnectionSection == null) {
+ if (other.networkConnectionSection != null)
+ return false;
+ } else if (!networkConnectionSection.equals(other.networkConnectionSection))
+ return false;
+ if (os == null) {
+ if (other.os != null)
+ return false;
+ } else if (!os.equals(other.os))
+ return false;
+ if (vApp == null) {
+ if (other.vApp != null)
+ return false;
+ } else if (!vApp.equals(other.vApp))
+ return false;
+ if (vAppScopedLocalId == null) {
+ if (other.vAppScopedLocalId != null)
+ return false;
+ } else if (!vAppScopedLocalId.equals(other.vAppScopedLocalId))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description=" + description
+ + ", status=" + status + ", tasks=" + tasks + ", vApp=" + vApp + ", hardware=" + hardware + ", os=" + os
+ + ", network=" + networkConnectionSection + ", vAppScopedLocalId=" + vAppScopedLocalId + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
new file mode 100755
index 0000000..628a7d1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
@@ -0,0 +1,106 @@
+/*
+ * 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.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * specifies the properties of the network’s DHCP service
+ */
+public class DhcpService {
+ private final boolean enabled;
+ @Nullable
+ private final Integer defaultLeaseTime;
+ @Nullable
+ private final Integer maxLeaseTime;
+ @Nullable
+ private final IpRange ipRange;
+
+ public DhcpService(boolean enabled, @Nullable Integer defaultLeaseTime, @Nullable Integer maxLeaseTime,
+ @Nullable IpRange ipRange) {
+ this.enabled = enabled;
+ this.defaultLeaseTime = defaultLeaseTime;
+ this.maxLeaseTime = maxLeaseTime;
+ this.ipRange = ipRange;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.8
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * default duration of a DHCP address lease
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public Integer getDefaultLeaseTime() {
+ return defaultLeaseTime;
+ }
+
+ /**
+ * maximum duration of a DHCP address lease.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public Integer getMaxLeaseTime() {
+ return maxLeaseTime;
+ }
+
+ /**
+ * @return range of IP addresses available to DHCP clients
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public IpRange getIpRange() {
+ return ipRange;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ DhcpService that = DhcpService.class.cast(o);
+ return equal(this.enabled, that.enabled) && equal(this.defaultLeaseTime, that.defaultLeaseTime)
+ && equal(this.maxLeaseTime, that.maxLeaseTime) && equal(this.ipRange, that.ipRange);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, defaultLeaseTime, maxLeaseTime, ipRange);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("enabled", enabled)
+ .add("defaultLeaseTime", defaultLeaseTime).add("maxLeaseTime", maxLeaseTime).add("ipRange", ipRange)
+ .toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
new file mode 100755
index 0000000..24eb38e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
@@ -0,0 +1,95 @@
+/*
+ * 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.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * The Features element defines the DHCP and firewall features of a network.
+ */
+public class Features {
+ @Nullable
+ private final DhcpService dhcpService;
+ @Nullable
+ private final FirewallService firewallService;
+ @Nullable
+ private final NatService natService;
+
+ public Features(@Nullable DhcpService dhcpService, @Nullable FirewallService firewallService,
+ @Nullable NatService natService) {
+ this.dhcpService = dhcpService;
+ this.firewallService = firewallService;
+ this.natService = natService;
+ }
+
+ /**
+ * specifies the properties of the network’s DHCP service
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable
+ public DhcpService getDhcpService() {
+ return dhcpService;
+ }
+
+ /**
+ * defines the firewall service capabilities of the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public FirewallService getFirewallService() {
+ return firewallService;
+ }
+
+ /**
+ * defines the NAT service capabilities of the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public NatService getNatService() {
+ return natService;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ Features that = Features.class.cast(o);
+ return equal(this.dhcpService, that.dhcpService) && equal(this.firewallService, that.firewallService)
+ && equal(this.natService, that.natService);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(dhcpService, firewallService, natService);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("dhcpService", dhcpService)
+ .add("firewallService", firewallService).add("natService", natService).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java
new file mode 100755
index 0000000..97db30a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.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.vcloud.domain.network;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ *
+ * The FenceMode element contains one of the following strings that specify how a network is
+ * connected to its parent network.
+ *
+ * @author Adrian Cole
+ */
+public enum FenceMode {
+ /**
+ * The two networks are bridged.
+ * <p/>
+ * Note that in vcloud 0.8 this was called ALLOW_IN_OUT, and so our implementation automatically
+ * converts this for you. Use bridged instead of allowInOut.
+ *
+ * @since vcloud api 0.9
+ */
+ BRIDGED,
+ /**
+ * The two networks are not connected.
+ *
+ * @since vcloud api 0.8
+ */
+ ISOLATED,
+ /**
+ * The two networks are connected as specified in their NatService elements.
+ *
+ * @since vcloud api 0.8
+ */
+ NAT_ROUTED, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static FenceMode fromValue(String fenceMode) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(fenceMode, "fenceMode")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
new file mode 100755
index 0000000..63212b2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
@@ -0,0 +1,86 @@
+/*
+ * 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.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * The FirewallService element defines the firewall service capabilities of a network.
+ */
+public class FirewallService {
+ private final boolean enabled;
+
+ List<FirewallRule> firewallRules = Lists.newArrayList();
+
+ public FirewallService(boolean enabled, Iterable<FirewallRule> firewallRules) {
+ this.enabled = enabled;
+ Iterables.addAll(this.firewallRules, checkNotNull(firewallRules, "firewallRules"));
+ }
+
+ /**
+ * @return Firewall rules for the network
+ *
+ * @since vcloud api 0.8
+ */
+ public List<FirewallRule> getFirewallRules() {
+ return firewallRules;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ FirewallService that = FirewallService.class.cast(o);
+ return equal(this.enabled, that.enabled) && equal(this.firewallRules, that.firewallRules);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, firewallRules);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("enabled", enabled);
+ if (firewallRules.size() > 0)
+ helper.add("firewallRules", firewallRules);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
new file mode 100755
index 0000000..acb35bc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
@@ -0,0 +1,52 @@
+/*
+ * 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.vcloud.domain.network;
+
+
+/**
+ *
+ * The IpAddressAllocationMode element specifies how an IP address is allocated to this connection.
+ *
+ * @author Adrian Cole
+ */
+public enum IpAddressAllocationMode {
+ /**
+ * no IP addressing mode specified
+ *
+ * @since vcloud api 1.0
+ */
+ NONE,
+ /**
+ * static IP address assigned manually
+ *
+ * @since vcloud api 1.0
+ */
+ MANUAL,
+ /**
+ * static IP address allocated from a pool
+ *
+ * @since vcloud api 1.0
+ */
+ POOL,
+ /**
+ * IP address assigned by DHCP
+ *
+ * @since vcloud api 1.0
+ */
+ DHCP;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
new file mode 100755
index 0000000..29a24d1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
@@ -0,0 +1,76 @@
+/*
+ * 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.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.Objects;
+
+/**
+ * The IpRange element defines a range of IP addresses available on a network.
+ *
+ */
+public class IpRange {
+ private final String startAddress;
+ private final String endAddress;
+
+ public IpRange(String startAddress, String endAddress) {
+ this.startAddress = checkNotNull(startAddress, "startAddress");
+ this.endAddress = checkNotNull(endAddress, "endAddress");
+ }
+
+ /**
+ * @return lowest IP address in the range
+ *
+ * @since vcloud api 0.9
+ */
+ public String getStartAddress() {
+ return startAddress;
+ }
+
+ /**
+ * @return highest IP address in the range
+ *
+ * @since vcloud api 0.9
+ */
+ public String getEndAddress() {
+ return endAddress;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ IpRange that = IpRange.class.cast(o);
+ return equal(this.startAddress, that.startAddress) && equal(this.endAddress, that.endAddress);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(startAddress, endAddress);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("startAddress", startAddress)
+ .add("endAddress", endAddress).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
new file mode 100755
index 0000000..bdd9671
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
@@ -0,0 +1,170 @@
+/*
+ * 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.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
+/**
+ * The IpScope element defines the address range, gateway, netmask, and other properties of the
+ * network.
+ *
+ */
+public class IpScope {
+ private final boolean inherited;
+ @Nullable
+ private final String gateway;
+ @Nullable
+ private final String netmask;
+ @Nullable
+ private final String dns1;
+ @Nullable
+ private final String dns2;
+ @Nullable
+ private final String dnsSuffix;
+ private final Set<IpRange> ipRanges = Sets.newLinkedHashSet();
+ private final Set<String> allocatedIpAddresses = Sets.newLinkedHashSet();
+
+ public IpScope(boolean inherited, @Nullable String gateway, @Nullable String netmask, @Nullable String dns1,
+ @Nullable String dns2, @Nullable String dnsSuffix, Iterable<IpRange> ipRanges,
+ Iterable<String> allocatedIpAddresses) {
+ this.inherited = inherited;
+ this.gateway = gateway;
+ this.netmask = netmask;
+ this.dns1 = dns1;
+ this.dns2 = dns2;
+ this.dnsSuffix = dnsSuffix;
+ Iterables.addAll(this.ipRanges, checkNotNull(ipRanges, "ipRanges"));
+ Iterables.addAll(this.allocatedIpAddresses, checkNotNull(allocatedIpAddresses, "allocatedIpAddresses"));
+ }
+
+ /**
+ * @return true of the values in this IpScope element are inherited from the ParentNetwork of the
+ * containing Configuration
+ * @since vcloud api 0.9
+ */
+ public boolean isInherited() {
+ return inherited;
+ }
+
+ /**
+ * @return IP address of the network gateway
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public String getGateway() {
+ return gateway;
+ }
+
+ /**
+ * @return netmask to apply to addresses on the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public String getNetmask() {
+ return netmask;
+ }
+
+ /**
+ * @return IP address of the primary DNS server for this network
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDns1() {
+ return dns1;
+ }
+
+ /**
+ * @return IP address of the secondary DNS server for this network
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDns2() {
+ return dns2;
+ }
+
+ /**
+ * @return suffix to be applied when resolving hostnames that are not fully‐qualified.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDnsSuffix() {
+ return dnsSuffix;
+ }
+
+ /**
+ * @return A container for IpRange elements.
+ *
+ * @since vcloud api 0.9
+ */
+ public Set<IpRange> getIpRanges() {
+ return ipRanges;
+ }
+
+ /**
+ * @return A list of addresses allocated from any of the specified IpRanges
+ *
+ * @since vcloud api 0.9
+ */
+ public Set<String> getAllocatedIpAddresses() {
+ return allocatedIpAddresses;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ IpScope that = IpScope.class.cast(o);
+ return equal(this.inherited, that.inherited) && equal(this.gateway, that.gateway)
+ && equal(this.netmask, that.netmask) && equal(this.dns1, that.dns1) && equal(this.dns2, that.dns2)
+ && equal(this.dnsSuffix, that.dnsSuffix)
+ && equal(this.ipRanges, that.ipRanges)
+ && equal(this.allocatedIpAddresses, that.allocatedIpAddresses);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(inherited, gateway, netmask, dns1, dns2, dnsSuffix, ipRanges, allocatedIpAddresses);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("inherited", inherited).add("gateway", gateway)
+ .add("netmask", netmask).add("dns1", dns1).add("dns2", dns2).add("dnsSuffix", dnsSuffix);
+ if (ipRanges.size() > 0)
+ helper.add("ipRanges", ipRanges);
+ if (allocatedIpAddresses.size() > 0)
+ helper.add("allocatedIpAddresses", allocatedIpAddresses);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
new file mode 100755
index 0000000..ea4c388
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
@@ -0,0 +1,115 @@
+/*
+ * 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.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatPolicy;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+import org.jclouds.vcloud.domain.network.nat.NatType;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * The NatService element defines the network address translation capabilities of a network.
+ */
+public class NatService {
+ private final boolean enabled;
+ @Nullable
+ private final NatType type;
+ @Nullable
+ private final NatPolicy policy;
+ private final List<NatRule> natRules = Lists.newArrayList();
+
+ public NatService(boolean enabled, @Nullable NatType type, @Nullable NatPolicy policy,
+ Iterable<NatRule> natRules) {
+ this.enabled = enabled;
+ this.type = type;
+ this.policy = policy;
+ Iterables.addAll(this.natRules, checkNotNull(natRules, "natRules"));
+ }
+
+ /**
+ * @return Nat rules for the network
+ *
+ * @since vcloud api 0.8
+ */
+ public List<NatRule> getNatRules() {
+ return natRules;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.9
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @return specifies how Network Address Translation is implemented by the NAT service
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public NatType getType() {
+ return type;
+ }
+
+ /**
+ * @return specifies how packets are handled by the NAT service.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public NatPolicy getPolicy() {
+ return policy;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ NatService that = NatService.class.cast(o);
+ return equal(this.enabled, that.enabled) && equal(this.type, that.type)
+ && equal(this.policy, that.policy) && equal(this.natRules, that.natRules);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, type, policy, natRules);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("enabled", enabled)
+ .add("type", type).add("policy", policy);
+ if (natRules.size() > 0)
+ helper.add("natRules", natRules);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
new file mode 100755
index 0000000..1e50e3e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
@@ -0,0 +1,167 @@
+/*
+ * 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.vcloud.domain.network;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class NetworkConfig {
+
+ public Builder toBuilder() {
+ return builder().fromNetworkConfig(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private String networkName;
+ private URI parentNetwork;
+ private FenceMode fenceMode;
+
+ public Builder networkName(String networkName) {
+ this.networkName = networkName;
+ return this;
+ }
+
+ public Builder parentNetwork(URI parentNetwork) {
+ this.parentNetwork = parentNetwork;
+ return this;
+ }
+
+ public Builder fenceMode(FenceMode fenceMode) {
+ this.fenceMode = fenceMode;
+ return this;
+ }
+
+ public Builder fromNetworkConfig(NetworkConfig in) {
+ return networkName(in.getNetworkName()).parentNetwork(in.getParentNetwork()).fenceMode(in.getFenceMode());
+ }
+
+ public NetworkConfig build() {
+ return new NetworkConfig(networkName, parentNetwork, fenceMode);
+ }
+ }
+
+ @Nullable
+ private final String networkName;
+ private final URI parentNetwork;
+ @Nullable
+ private final FenceMode fenceMode;
+
+ /**
+ *
+ * Create a new NetworkConfig.
+ *
+ * @param networkName
+ * a valid {@networkConfig
+ * org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection network in the vapp
+ * template}, or null to have us choose default
+ * @param parentNetwork
+ * a valid {@networkConfig org.jclouds.vcloud.domain.Org#getNetworks in
+ * the Org}
+ * @param fenceMode
+ * how to manage the relationship between the two networks
+ */
+ public NetworkConfig(String networkName, URI parentNetwork, FenceMode fenceMode) {
+ this.networkName = networkName;
+ this.parentNetwork = checkNotNull(parentNetwork, "parentNetwork");
+ this.fenceMode = fenceMode;
+ }
+
+ public NetworkConfig(URI parentNetwork) {
+ this(null, parentNetwork, null);
+ }
+
+ /**
+ * A name for the network. If the
+ * {@link org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection} includes a
+ * {@link NetworkSection.Network} network element, the name you specify for the vApp network must
+ * match the name specified in that element’s name attribute.
+ *
+ * @return
+ */
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ /**
+ *
+ * @return A reference to the organization network to which this network connects.
+ */
+ public URI getParentNetwork() {
+ return parentNetwork;
+ }
+
+ /**
+ * A value of bridged indicates that this vApp network is connected directly to the organization
+ * network.
+ */
+ public FenceMode getFenceMode() {
+ return fenceMode;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fenceMode == null) ? 0 : fenceMode.hashCode());
+ result = prime * result + ((parentNetwork == null) ? 0 : parentNetwork.hashCode());
+ result = prime * result + ((networkName == null) ? 0 : networkName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NetworkConfig other = (NetworkConfig) obj;
+ if (fenceMode == null) {
+ if (other.fenceMode != null)
+ return false;
+ } else if (!fenceMode.equals(other.fenceMode))
+ return false;
+ if (parentNetwork == null) {
+ if (other.parentNetwork != null)
+ return false;
+ } else if (!parentNetwork.equals(other.parentNetwork))
+ return false;
+ if (networkName == null) {
+ if (other.networkName != null)
+ return false;
+ } else if (!networkName.equals(other.networkName))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[networkName=" + networkName + ", parentNetwork=" + parentNetwork + ", fenceMode=" + fenceMode + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
new file mode 100755
index 0000000..a104984
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
@@ -0,0 +1,121 @@
+/*
+ * 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.vcloud.domain.network;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.network.internal.OrgNetworkImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A vDC is a deployment environment for vApps. A Vdc element provides a user view of a vDC.
+ *
+ * @author Adrian Cole
+ */
+@org.jclouds.vcloud.endpoints.Network
+@ImplementedBy(OrgNetworkImpl.class)
+public interface OrgNetwork extends ReferenceType {
+ /**
+ * The org this network belongs to.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getOrg();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 0.9
+ */
+ List<Task> getTasks();
+
+ /**
+ *
+ * @return properties of the network
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ Configuration getConfiguration();
+
+ /**
+ * A reference the network pool from which this network is provisioned. This element, which is
+ * required when creating a NatRouted or Isolated network, is returned in response to a creation
+ * request but not shown in subsequent GET requests.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getNetworkPool();
+
+ /**
+ * list of external IP addresses that this network can use for NAT.
+ *
+ * @since vcloud api 0.9
+ */
+ Set<String> getAllowedExternalIpAddresses();
+
+ /**
+ * The Configuration element specifies properties of a network.
+ */
+ interface Configuration {
+ /**
+ * defines the address range, gateway, netmask, and other properties of the network.
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable
+ IpScope getIpScope();
+
+ /**
+ * reference to a network to which this network connects
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getParentNetwork();
+
+ /**
+ * defines how this network is connected to its ParentNetwork
+ *
+ * @since vcloud api 0.8
+ */
+ FenceMode getFenceMode();
+
+ /**
+ * defines a set of network features.
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable Features getFeatures();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
new file mode 100755
index 0000000..9e85db7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
@@ -0,0 +1,54 @@
+/*
+ * 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.vcloud.domain.network.firewall;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * specifies how packets are handled by the firewall
+ *
+ */
+public enum FirewallPolicy {
+ /**
+ * drop packets of this type
+ */
+ DROP,
+ /**
+ * allow packets of this type to pass through the firewall
+ */
+ ALLOW, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static FirewallPolicy fromValue(String policy) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(policy, "policy")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
new file mode 100755
index 0000000..7b11fee
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
@@ -0,0 +1,73 @@
+/*
+ * 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.vcloud.domain.network.firewall;
+
+import static com.google.common.base.Objects.equal;
+
+import com.google.common.base.Objects;
+
+/**
+ * The Protocols element specifies the protocols to which firewall rules apply.
+ *
+ * @since vcloud api 0.9 emulated for 0.8
+ *
+ *
+ */
+public class FirewallProtocols {
+ private final boolean tcp;
+ private final boolean udp;
+
+ public FirewallProtocols(boolean tcp, boolean udp) {
+ this.tcp = tcp;
+ this.udp = udp;
+ }
+
+ /**
+ * @return true if the firewall rules apply to the TCP protocol
+ */
+ public boolean isTcp() {
+ return tcp;
+ }
+
+ /**
+ * @return true if the firewall rules apply to the UDP protocol
+ */
+ public boolean isUdp() {
+ return udp;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ FirewallProtocols that = FirewallProtocols.class.cast(o);
+ return equal(this.tcp, that.tcp) && equal(this.udp, that.udp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(tcp, udp);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("tcp", tcp).add("udp", udp).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
new file mode 100755
index 0000000..6536fb9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
@@ -0,0 +1,125 @@
+/*
+ * 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.vcloud.domain.network.firewall;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * The FirewallRule element defines a single firewall rule.
+ *
+ * @author Adrian Cole
+ * @since vcloud api 0.8
+ */
+public class FirewallRule {
+
+ private final boolean enabled;
+ @Nullable
+ private final String description;
+ @Nullable
+ private final FirewallPolicy policy;
+ @Nullable
+ private final FirewallProtocols protocols;
+ private final int port;
+ private final String destinationIp;
+
+ public FirewallRule(boolean enabled, @Nullable String description, @Nullable FirewallPolicy policy,
+ @Nullable FirewallProtocols protocols, int port, String destinationIp) {
+ this.enabled = enabled;
+ this.description = description;
+ this.policy = policy;
+ this.protocols = protocols;
+ this.port = port;
+ this.destinationIp = checkNotNull(destinationIp, "destinationIp");
+ }
+
+ /**
+ * @return true if the rule is enabled
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @return description of the rule
+ */
+ @Nullable
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return specifies how packets are handled by the firewall
+ */
+ @Nullable
+ public FirewallPolicy getPolicy() {
+ return policy;
+ }
+
+ /**
+ * @return specifies the protocols to which this firewall rule applies
+ */
+ @Nullable
+ public FirewallProtocols getProtocols() {
+ return protocols;
+ }
+
+ /**
+ * @return specifies the network port to which this firewall rule applies. A value of ‐1 matches
+ * any port.
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * @return specifies the destination IP address, inside the firewall, to which this firewall rule
+ * applies
+ */
+ public String getDestinationIp() {
+ return destinationIp;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ FirewallRule that = FirewallRule.class.cast(o);
+ return equal(this.enabled, that.enabled) && equal(this.description, that.description)
+ && equal(this.policy, that.policy) && equal(this.protocols, that.protocols) && equal(this.port, that.port)
+ && equal(this.destinationIp, that.destinationIp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, description, policy, protocols, port, destinationIp);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("enabled", enabled).add("description", description)
+ .add("policy", policy).add("protocols", protocols).add("port", port).add("destinationIp", destinationIp)
+ .toString();
+ }
+
+}
[35/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java
new file mode 100644
index 0000000..3553d18
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java
@@ -0,0 +1,206 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.openstack.nova.v2_0.domain.Network;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
+import org.jclouds.openstack.nova.v2_0.options.RebuildServerOptions;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.openstack.v2_0.predicates.LinkPredicates;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of {@link ServerApi}
+ *
+ * @author Adrian Cole
+ * @author Inbar Stolberg
+ */
+@Test(groups = "live", testName = "ServerApiLiveTest")
+public class ServerApiLiveTest extends BaseNovaApiLiveTest {
+
+ @Test(description = "GET /v${apiVersion}/{tenantId}/servers")
+ public void testListServers() throws Exception {
+ for (String zoneId : zones) {
+ ServerApi serverApi = api.getServerApiForZone(zoneId);
+ for (Resource server : serverApi.list().concat()) {
+ checkResource(server);
+ }
+ }
+ }
+
+ @Test(description = "GET /v${apiVersion}/{tenantId}/servers/detail")
+ public void testListServersInDetail() throws Exception {
+ for (String zoneId : zones) {
+ ServerApi serverApi = api.getServerApiForZone(zoneId);
+ for (Server server : serverApi.listInDetail().concat()) {
+ checkServer(server);
+ }
+ }
+ }
+
+ @Test(description = "GET /v${apiVersion}/{tenantId}/servers/{id}", dependsOnMethods = { "testListServersInDetail" })
+ public void testGetServerById() throws Exception {
+ for (String zoneId : zones) {
+ ServerApi serverApi = api.getServerApiForZone(zoneId);
+ for (Resource server : serverApi.list().concat()) {
+ Server details = serverApi.get(server.getId());
+ assertEquals(details.getId(), server.getId());
+ assertEquals(details.getName(), server.getName());
+ assertEquals(details.getLinks(), server.getLinks());
+ checkServer(details);
+ }
+ }
+ }
+
+ @Test
+ public void testCreateInAvailabilityZone() {
+ String serverId = null;
+ for (String zoneId : zones) {
+ ServerApi serverApi = api.getServerApiForZone(zoneId);
+ try {
+ serverId = createServer(zoneId, "nova", Server.Status.ACTIVE).getId();
+ Server server = serverApi.get(serverId);
+ assertEquals(server.getStatus(), Server.Status.ACTIVE);
+ } finally {
+ serverApi.delete(serverId);
+ }
+ }
+ }
+
+ /**
+ * This needs to be supported by the provider, and is usually not supported.
+ * However this can be tested on devstack:
+ * In apis/openstack-nova:
+ * mvn -Plive clean install "-Dtest.openstack-nova.endpoint=http://localhost:5000/v2.0" "-Dtest.openstack-nova.identity=demo:demo" "-Dtest.openstack-nova.credential=devstack" "-Dtest=org.jclouds.openstack.nova.v2_0.features.ServerApiLiveTest#testCreateWithNetworkOptions"
+ */
+ @Test(enabled = false)
+ public void testCreateWithNetworkOptions() {
+ String serverId = null;
+ for (String zoneId : zones) {
+ ServerApi serverApi = api.getServerApiForZone(zoneId);
+ try {
+ CreateServerOptions options = CreateServerOptions.Builder.novaNetworks(
+ // This network UUID must match an existing network.
+ ImmutableSet.of(Network.builder().networkUuid("bc4cfa2b-2b27-4671-8e8f-73009623def0").fixedIp("192.168.55.56").build())
+ );
+ ServerCreated server = serverApi.create(hostName, imageIdForZone(zoneId), "1", options);
+ serverId = server.getId();
+
+ blockUntilServerInState(server.getId(), serverApi, Server.Status.ACTIVE);
+ Server serverCheck = serverApi.get(serverId);
+ assertEquals(serverCheck.getStatus(), Server.Status.ACTIVE);
+ } finally {
+ if (serverId != null) {
+ serverApi.delete(serverId);
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testCreateInWrongAvailabilityZone() {
+ String serverId = null;
+ for (String zoneId : zones) {
+ ServerApi serverApi = api.getServerApiForZone(zoneId);
+ try {
+ serverId = createServer(zoneId, "err", Server.Status.ERROR).getId();
+ Server server = serverApi.get(serverId);
+ assertEquals(server.getStatus(), Server.Status.ERROR);
+ } finally {
+ serverApi.delete(serverId);
+ }
+ }
+ }
+
+ @Test
+ public void testRebuildServer() {
+
+ String serverId = null;
+
+ for (String zoneId : zones) {
+ ServerApi serverApi = api.getServerApiForZone(zoneId);
+ try {
+ serverId = createServer(zoneId, Server.Status.ACTIVE).getId();
+
+ Server server = serverApi.get(serverId);
+
+ assertEquals(server.getStatus(), Server.Status.ACTIVE);
+
+ RebuildServerOptions options = new RebuildServerOptions().
+ withImage(server.getImage().getId()).
+ name("newName").
+ adminPass("password").
+ ipv4Address("1.1.1.1").
+ ipv6Address("fe80::100");
+
+ serverApi.rebuild(serverId, options);
+
+ Server rebuiltServer = serverApi.get(serverId);
+
+ assertEquals("newName", rebuiltServer.getName());
+ assertEquals("1.1.1.1", rebuiltServer.getAccessIPv4());
+ assertEquals("fe80::100", rebuiltServer.getAccessIPv6());
+
+ } finally {
+ serverApi.delete(serverId);
+ }
+ }
+ }
+
+ private Server createServer(String regionId, Server.Status serverStatus) {
+ ServerApi serverApi = api.getServerApiForZone(regionId);
+ CreateServerOptions options = new CreateServerOptions();
+ ServerCreated server = serverApi.create(hostName, imageIdForZone(regionId), flavorRefForZone(regionId), options);
+
+ blockUntilServerInState(server.getId(), serverApi, serverStatus);
+
+ return serverApi.get(server.getId());
+ }
+
+ private Server createServer(String regionId, String availabilityZoneId, Server.Status serverStatus) {
+ ServerApi serverApi = api.getServerApiForZone(regionId);
+ CreateServerOptions options = new CreateServerOptions();
+ options = options.availabilityZone(availabilityZoneId);
+ ServerCreated server = serverApi.create(hostName, imageIdForZone(regionId), flavorRefForZone(regionId), options);
+ blockUntilServerInState(server.getId(), serverApi, serverStatus);
+ return serverApi.get(server.getId());
+ }
+
+ private void checkResource(Resource resource) {
+ assertNotNull(resource.getId());
+ assertNotNull(resource.getName());
+ assertNotNull(resource.getLinks());
+ assertTrue(Iterables.any(resource.getLinks(), LinkPredicates.relationEquals(Relation.SELF)));
+ }
+
+ private void checkServer(Server server) {
+ checkResource(server);
+ assertFalse(server.getAddresses().isEmpty());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/CreateSecurityGroupIfNeededTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/CreateSecurityGroupIfNeededTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/CreateSecurityGroupIfNeededTest.java
new file mode 100644
index 0000000..ba4be4d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/CreateSecurityGroupIfNeededTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.openstack.nova.v2_0.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.compute.functions.CreateSecurityGroupIfNeeded;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseComputeServiceTypicalSecurityGroupTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "CreateSecurityGroupIfNeededTest")
+public class CreateSecurityGroupIfNeededTest extends BaseNovaApiExpectTest {
+ HttpRequest create = HttpRequest.builder().method("POST").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build())
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group\":{\"name\":\"jclouds_mygroup\",\"description\":\"jclouds_mygroup\"}}",
+ "application/json")).build();
+
+ public void testCreateNewGroup() throws Exception {
+
+ Builder<HttpRequest, HttpResponse> builder = ImmutableMap.builder();
+
+ builder.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ builder.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
+ int groupId = 2769;
+
+ HttpResponse createResponse = HttpResponse.builder().statusCode(200)
+ .payload(
+ payloadFromStringWithContentType(
+ String.format("{\"security_group\": {\"rules\": [], \"tenant_id\": \"37936628937291\", \"id\": %s, \"name\": \"jclouds_mygroup\", \"description\": \"jclouds_mygroup\"}}", groupId),
+ "application/json; charset=UTF-8")).build();
+
+ builder.put(create, createResponse);
+
+ int ruleId = 10331;
+
+ for (int port : ImmutableList.of(22,8080)) {
+
+ HttpRequest createCidrRule = HttpRequest.builder().method("POST").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build())
+ .payload(
+ payloadFromStringWithContentType(
+ String.format("{\"security_group_rule\":{\"parent_group_id\":\"%s\",\"cidr\":\"0.0.0.0/0\",\"ip_protocol\":\"tcp\",\"from_port\":\"%d\",\"to_port\":\"%d\"}}",
+ groupId, port, port), "application/json")).build();
+
+ HttpResponse createCidrRuleResponse = HttpResponse.builder().statusCode(200)
+ .payload(
+ payloadFromStringWithContentType(
+ String.format("{\"security_group_rule\": {\"from_port\": %d, \"group\": {}, \"ip_protocol\": \"tcp\", \"to_port\": %d, \"parent_group_id\": %d, \"ip_range\": {\"cidr\": \"0.0.0.0/0\"}, \"id\": %d}}",
+ port, port, groupId, ruleId++), "application/json; charset=UTF-8")).build();
+
+ builder.put(createCidrRule, createCidrRuleResponse);
+
+ HttpRequest createSelfRule = HttpRequest.builder().method("POST").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build())
+ .payload(
+ payloadFromStringWithContentType(
+ String.format("{\"security_group_rule\":{\"group_id\":\"%d\",\"parent_group_id\":\"%d\",\"ip_protocol\":\"tcp\",\"from_port\":\"%d\",\"to_port\":\"%d\"}}",
+ groupId, groupId, port, port), "application/json")).build();
+
+ // note server responds with group name in the rule!!
+ HttpResponse createSelfRuleResponse = HttpResponse.builder().statusCode(200)
+ .payload(
+ payloadFromStringWithContentType(
+ String.format("{\"security_group_rule\": {\"from_port\": %d, \"group\": {\"tenant_id\": \"37936628937291\", \"name\": \"jclouds_mygroup\"}, \"ip_protocol\": \"tcp\", \"to_port\": %d, \"parent_group_id\": %d, \"ip_range\": {}, \"id\": %d}}",
+ port, port, groupId, ruleId++), "application/json; charset=UTF-8")).build();
+
+ builder.put(createSelfRule, createSelfRuleResponse);
+ }
+
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/" + groupId)).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_computeservice_typical.json")).build();
+
+ builder.put(getSecurityGroup, getSecurityGroupResponse);
+
+ NovaApi apiCanCreateSecurityGroup = requestsSendResponses(builder.build());
+
+ CreateSecurityGroupIfNeeded fn = new CreateSecurityGroupIfNeeded(apiCanCreateSecurityGroup);
+
+ // we can find it
+ assertEquals(fn.apply(
+ new ZoneSecurityGroupNameAndPorts("az-1.region-a.geo-1", "jclouds_mygroup", ImmutableSet.of(22, 8080)))
+ .toString(), new SecurityGroupInZone(new ParseComputeServiceTypicalSecurityGroupTest().expected(),
+ "az-1.region-a.geo-1").toString());
+
+ }
+
+ public void testReturnExistingGroupOnAlreadyExists() throws Exception {
+
+ Builder<HttpRequest, HttpResponse> builder = ImmutableMap.builder();
+
+ builder.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ builder.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
+
+ HttpResponse createResponse = HttpResponse.builder().statusCode(400)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"badRequest\": {\"message\": \"Security group test already exists\", \"code\": 400}}",
+ "application/json; charset=UTF-8")).build();
+
+ builder.put(create, createResponse);
+
+ HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_list_details_computeservice_typical.json")).build();
+
+ builder.put(list, listResponse);
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(builder.build());
+
+ CreateSecurityGroupIfNeeded fn = new CreateSecurityGroupIfNeeded(apiWhenSecurityGroupsExist);
+
+ // we can find it
+ assertEquals(fn.apply(
+ new ZoneSecurityGroupNameAndPorts("az-1.region-a.geo-1", "jclouds_mygroup", ImmutableSet.of(22, 8080)))
+ .toString(), new SecurityGroupInZone(new ParseComputeServiceTypicalSecurityGroupTest().expected(),
+ "az-1.region-a.geo-1").toString());
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/FindSecurityGroupWithNameAndReturnTrueExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/FindSecurityGroupWithNameAndReturnTrueExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/FindSecurityGroupWithNameAndReturnTrueExpectTest.java
new file mode 100644
index 0000000..c8e2639
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/FindSecurityGroupWithNameAndReturnTrueExpectTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.openstack.nova.v2_0.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseSecurityGroupListTest;
+import org.jclouds.openstack.nova.v2_0.predicates.FindSecurityGroupWithNameAndReturnTrue;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Iterables;
+import com.google.common.util.concurrent.Atomics;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "FindSecurityGroupWithNameAndReturnTrueExpectTest")
+public class FindSecurityGroupWithNameAndReturnTrueExpectTest extends BaseNovaApiExpectTest {
+
+ public void testUpdateReferenceWhenSecurityGroupListContainsGroupName() throws Exception {
+ HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_list.json")).build();
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list,
+ listResponse);
+
+ FindSecurityGroupWithNameAndReturnTrue predicate = new FindSecurityGroupWithNameAndReturnTrue(
+ apiWhenSecurityGroupsExist);
+
+ AtomicReference<ZoneAndName> securityGroupInZoneRef = Atomics.newReference(ZoneAndName
+ .fromZoneAndName("az-1.region-a.geo-1", "name1"));
+
+ // we can find it
+ assertTrue(predicate.apply(securityGroupInZoneRef));
+
+ // the reference is now up to date, and includes the actual group found.
+ assertEquals(securityGroupInZoneRef.get().toString(), new SecurityGroupInZone(Iterables
+ .getOnlyElement(new ParseSecurityGroupListTest().expected()), "az-1.region-a.geo-1").toString());
+
+ }
+
+ public void testDoesNotUpdateReferenceWhenSecurityGroupListMissingGroupName() throws Exception {
+ HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_list.json")).build();
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list,
+ listResponse);
+
+ FindSecurityGroupWithNameAndReturnTrue predicate = new FindSecurityGroupWithNameAndReturnTrue(
+ apiWhenSecurityGroupsExist);
+
+ ZoneAndName zoneAndGroup = ZoneAndName.fromZoneAndName("az-1.region-a.geo-1", "name2");
+
+ AtomicReference<ZoneAndName> securityGroupInZoneRef = Atomics.newReference(zoneAndGroup);
+
+ // we cannot find it
+ assertFalse(predicate.apply(securityGroupInZoneRef));
+
+ // the reference is the same
+ assertEquals(securityGroupInZoneRef.get(), zoneAndGroup);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/InternalURLLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/InternalURLLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/InternalURLLiveTest.java
new file mode 100644
index 0000000..d1656d7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/functions/InternalURLLiveTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.openstack.nova.v2_0.functions;
+
+import static org.jclouds.Constants.PROPERTY_CONNECTION_TIMEOUT;
+
+import java.util.Properties;
+
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.v2_0.config.InternalUrlModule;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+
+/**
+ * Simple live test to check the correct loading of the internal endpoint
+ * services.
+ *
+ * @author Ignacio Mulas
+ *
+ */
+@Test(groups = "live", testName = "InternalURLLiveTest")
+public class InternalURLLiveTest extends BaseNovaApiLiveTest {
+
+ @Test(description = "InternalUrl service endpoints loader")
+ public void testGetInternalUrlServiceEndpoint() throws Exception {
+ String zone = api.getConfiguredZones().iterator().next();
+ // List current servers to ensure that can reach nova with internalUrl ip
+ try {
+ api.getServerApiForZone(zone).list().concat().toList();
+ } catch (Exception e) {
+ Assert.fail("Could not retrieve servers list using the internalUrl", e);
+ }
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties properties = super.setupProperties();
+ properties.setProperty(PROPERTY_CONNECTION_TIMEOUT, "5000");
+ return properties;
+ }
+
+ @Override
+ protected Iterable<Module> setupModules() {
+ return ImmutableSet.<Module> of(getLoggingModule(), new InternalUrlModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandlerTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandlerTest.java
new file mode 100644
index 0000000..fe302a7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandlerTest.java
@@ -0,0 +1,225 @@
+/*
+ * 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.openstack.nova.v2_0.handlers;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.concurrent.TimeUnit;
+
+import org.jclouds.date.DateCodec;
+import org.jclouds.date.internal.DateServiceDateCodecFactory.DateServiceIso8601SecondsCodec;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.fallbacks.HeaderToRetryAfterException;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.json.internal.GsonWrapper;
+import org.jclouds.openstack.nova.v2_0.functions.OverLimitParser;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.InsufficientResourcesException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.rest.RetryAfterException;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Ticker;
+import com.google.gson.Gson;
+
+/**
+ *
+ * @author Adrian Cole, Steve Loughran
+ */
+@Test(groups = "unit", testName = "NovaErrorHandlerTest", singleThreaded = true)
+public class NovaErrorHandlerTest {
+
+ private HttpCommand command;
+
+ @BeforeTest
+ void setupCommand() {
+ command = command();
+ }
+
+ @Test
+ public void test401MakesAuthorizationException() {
+ fn.handleError(command, HttpResponse.builder().statusCode(401).message("Unauthorized").build());
+
+ assertEquals(command.getException().getClass(), AuthorizationException.class);
+ assertEquals(command.getException().getMessage(),
+ "POST https://nova/v1.1/servers HTTP/1.1 -> HTTP/1.1 401 Unauthorized");
+ }
+
+ @Test
+ public void test404MakesResourceNotFoundException() {
+ fn.handleError(command, HttpResponse.builder().statusCode(404).message("Not Found").build());
+
+ assertEquals(command.getException().getClass(), ResourceNotFoundException.class);
+ assertEquals(command.getException().getMessage(),
+ "POST https://nova/v1.1/servers HTTP/1.1 -> HTTP/1.1 404 Not Found");
+ }
+
+ // should wait until ips are associated w/the server
+ HttpResponse noFixedIps = HttpResponse.builder().statusCode(400)
+ .message("HTTP/1.1 400 Bad Request")
+ .payload("{\"badRequest\": {\"message\": "+
+ "\"instance |71554| has no fixed_ips. unable to associate floating ip\", \"code\": 400}}")
+ .build();
+
+ @Test
+ public void test400MakesIllegalStateExceptionOnQuotaExceededOnNoFixedIps() {
+ fn.handleError(command, noFixedIps);
+
+ assertEquals(command.getException().getClass(), IllegalStateException.class);
+ assertEquals(command.getException().getMessage(), noFixedIps.getPayload().getRawContent());
+ }
+
+ HttpResponse alreadyExists = HttpResponse.builder().statusCode(400)
+ .message("HTTP/1.1 400 Bad Request")
+ .payload("{\"badRequest\": {\"message\": \"Server with the name 'test' already exists\", \"code\": 400}}")
+ .build();
+
+ @Test
+ public void test400MakesIllegalStateExceptionOnAlreadyExists() {
+ fn.handleError(command, alreadyExists);
+
+ assertEquals(command.getException().getClass(), IllegalStateException.class);
+ assertEquals(command.getException().getMessage(), alreadyExists.getPayload().getRawContent());
+ }
+
+ HttpResponse quotaExceeded = HttpResponse.builder().statusCode(400)
+ .message("HTTP/1.1 400 Bad Request")
+ .payload("{\"badRequest\": {\"message\": \"AddressLimitExceeded: Address quota exceeded. " +
+ "You cannot create any more addresses\", \"code\": 400}}")
+ .build();
+
+ @Test
+ public void test400MakesInsufficientResourcesExceptionOnQuotaExceeded() {
+ fn.handleError(command, quotaExceeded);
+
+ assertEquals(command.getException().getClass(), InsufficientResourcesException.class);
+ assertEquals(command.getException().getMessage(), quotaExceeded.getPayload().getRawContent());
+ }
+
+ HttpResponse tooLarge = HttpResponse.builder().statusCode(413)
+ .message("HTTP/1.1 413 Request Entity Too Large")
+ .payload("{\"badRequest\": {\"message\": \"Volume quota exceeded. You cannot create a volume of size 1G\", " +
+ "\"code\": 413, \"retryAfter\": 0}}")
+ .build();
+
+ @Test
+ public void test413MakesInsufficientResourcesException() {
+ fn.handleError(command, tooLarge);
+
+ assertEquals(command.getException().getClass(), InsufficientResourcesException.class);
+ assertEquals(command.getException().getMessage(), tooLarge.getPayload().getRawContent());
+ }
+
+ /**
+ * Reponse received from Rackspace UK on November 14, 2012.
+ */
+ HttpResponse retryAt = HttpResponse.builder().statusCode(413)
+ .message("HTTP/1.1 413 Request Entity Too Large")
+ .payload("{ 'overLimit' : { 'code' : 413,"
+ + " 'message' : 'OverLimit Retry...', "
+ + " 'details' : 'Error Details...',"
+ + " 'retryAt' : '2012-11-14T21:51:28UTC' }}")
+ .build();
+
+ @Test
+ public void test413WithRetryAtExceptionParsesDelta() {
+ fn.handleError(command, retryAt);
+
+ assertEquals(command.getException().getClass(), RetryAfterException.class);
+ assertEquals(command.getException().getMessage(), "retry in 3600 seconds");
+ }
+
+ /**
+ * Folsom response. This contains a delta in seconds to retry after, not a
+ * fixed time.
+ *
+ */
+ HttpResponse retryAfter = HttpResponse.builder().statusCode(413)
+ .message("HTTP/1.1 413 Request Entity Too Large")
+ .payload("{ 'overLimit': { 'message': 'This request was rate-limited.', "
+ + " 'retryAfter': '54', "
+ + " 'details': 'Only 1 POST request(s) can be made to \\'*\\' every minute.'" + " }}")
+ .build();
+
+ @Test
+ public void test413WithRetryAfterExceptionFolsom() {
+ fn.handleError(command, retryAfter);
+
+ assertEquals(command.getException().getClass(), RetryAfterException.class);
+ assertEquals(command.getException().getMessage(), "retry in 54 seconds");
+ }
+
+ /**
+ * Folsom response with a retryAt field inserted -at a different date. This
+ * can be used to verify that the retryAfter field is picked up first
+ */
+ HttpResponse retryAfterTrumps = HttpResponse.builder().statusCode(413)
+ .message("HTTP/1.1 413 Request Entity Too Large")
+ .payload("{ 'overLimit': {"
+ + " 'message': 'This request was rate-limited.', "
+ + " 'retryAfter': '54', "
+ + " 'retryAt' : '2012-11-14T21:51:28UTC',"
+ + " 'details': 'Only 1 POST request(s) can be made to \\'*\\' every minute.' }}")
+ .build();
+
+ @Test
+ public void test413WithRetryAfterTrumpsRetryAt() {
+ fn.handleError(command, retryAfterTrumps);
+
+ assertEquals(command.getException().getClass(), RetryAfterException.class);
+ assertEquals(command.getException().getMessage(), "retry in 54 seconds");
+ }
+
+ HttpResponse badRetryAt = HttpResponse.builder().statusCode(413)
+ .message("HTTP/1.1 413 Request Entity Too Large")
+ .payload("{ 'overLimit' : { 'code' : 413,"
+ + " 'message' : 'OverLimit Retry...', "
+ + " 'details' : 'Error Details...',"
+ + " 'retryAt' : '2012-11-~~~:51:28UTC' }}")
+ .build();
+
+ @Test
+ public void test413WithBadRetryAtFormatFallsBack() {
+ fn.handleError(command, badRetryAt);
+
+ assertEquals(command.getException().getClass(), InsufficientResourcesException.class);
+ assertEquals(command.getException().getMessage(), badRetryAt.getPayload().getRawContent());
+ }
+
+
+ DateCodec iso8601Seconds = new DateServiceIso8601SecondsCodec(new SimpleDateFormatDateService());
+
+ Ticker y2k = new Ticker() {
+
+ @Override
+ public long read() {
+ return TimeUnit.MILLISECONDS.toNanos(iso8601Seconds.toDate("2012-11-14T20:51:28UTC").getTime());
+ }
+
+ };
+
+ NovaErrorHandler fn = new NovaErrorHandler(HeaderToRetryAfterException.create(y2k, iso8601Seconds),
+ new OverLimitParser(new GsonWrapper(new Gson())));
+
+ private HttpCommand command() {
+ return new HttpCommand(HttpRequest.builder().method("POST").endpoint("https://nova/v1.1/servers").build());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiExpectTest.java
new file mode 100644
index 0000000..6c63da5
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiExpectTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.openstack.nova.v2_0.internal;
+
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+
+/**
+ * Base class for writing KeyStone Rest Api Expect tests
+ *
+ * @author Adrian Cole
+ */
+public class BaseNovaApiExpectTest extends BaseNovaExpectTest<NovaApi> {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java
new file mode 100644
index 0000000..da1847b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java
@@ -0,0 +1,120 @@
+/*
+ * 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.openstack.nova.v2_0.internal;
+
+import java.util.Properties;
+import java.util.Set;
+
+import org.jclouds.apis.BaseApiLiveTest;
+import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.config.NovaProperties;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
+import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
+import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
+import org.jclouds.openstack.nova.v2_0.features.ImageApi;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ComparisonChain;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Ordering;
+
+/**
+ * Tests behavior of {@code NovaApi}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live")
+public class BaseNovaApiLiveTest extends BaseApiLiveTest<NovaApi> {
+ protected String hostName = System.getProperty("user.name").replace('.','-').toLowerCase();
+
+ public BaseNovaApiLiveTest() {
+ provider = "openstack-nova";
+ }
+
+ protected Set<String> zones;
+
+ @BeforeClass(groups = { "integration", "live" })
+ @Override
+ public void setup() {
+ super.setup();
+ zones = api.getConfiguredZones();
+ for (String zone : zones) {
+ ServerApi serverApi = api.getServerApiForZone(zone);
+ for (Resource server : serverApi.list().concat()) {
+ if (server.getName().equals(hostName))
+ serverApi.delete(server.getId());
+ }
+ }
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties props = super.setupProperties();
+ setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
+ setIfTestSystemPropertyPresent(props, NovaProperties.AUTO_ALLOCATE_FLOATING_IPS);
+ return props;
+ }
+
+ protected Server createServerInZone(String zoneId) {
+ ServerApi serverApi = api.getServerApiForZone(zoneId);
+ ServerCreated server = serverApi.create(hostName, imageIdForZone(zoneId), flavorRefForZone(zoneId));
+ blockUntilServerInState(server.getId(), serverApi, Status.ACTIVE);
+ return serverApi.get(server.getId());
+ }
+
+ /**
+ * Will block until the requested server is in the correct state, if Extended Server Status extension is loaded
+ * this will continue to block while any task is in progress.
+ */
+ protected void blockUntilServerInState(String serverId, ServerApi api, Status status) {
+ Server currentDetails = null;
+ for (currentDetails = api.get(serverId); currentDetails.getStatus() != status
+ || ((currentDetails.getExtendedStatus().isPresent() && currentDetails.getExtendedStatus().get()
+ .getTaskState() != null)); currentDetails = api.get(serverId)) {
+ System.out.printf("blocking on status %s%n%s%n", status, currentDetails);
+ try {
+ Thread.sleep(5 * 1000);
+ } catch (InterruptedException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+ }
+
+ protected String imageIdForZone(String zoneId) {
+ ImageApi imageApi = api.getImageApiForZone(zoneId);
+ return Iterables.getLast(imageApi.list().concat()).getId();
+ }
+
+ protected String flavorRefForZone(String zoneId) {
+ FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
+ return DEFAULT_FLAVOR_ORDERING.min(flavorApi.listInDetail().concat()).getId();
+ }
+
+ static final Ordering<Flavor> DEFAULT_FLAVOR_ORDERING = new Ordering<Flavor>() {
+ public int compare(Flavor left, Flavor right) {
+ return ComparisonChain.start().compare(left.getVcpus(), right.getVcpus()).compare(left.getRam(), right.getRam())
+ .compare(left.getDisk(), right.getDisk()).result();
+ }
+ };
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaComputeServiceContextExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaComputeServiceContextExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaComputeServiceContextExpectTest.java
new file mode 100644
index 0000000..bd3b731
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaComputeServiceContextExpectTest.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.openstack.nova.v2_0.internal;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApiMetadata;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.inject.Module;
+
+/**
+ * Base class for writing KeyStone Expect tests with the ComputeService abstraction
+ *
+ * @author Matt Stephenson
+ */
+public abstract class BaseNovaComputeServiceContextExpectTest<T> extends BaseNovaExpectTest<T> implements
+ Function<ComputeServiceContext, T> {
+
+ protected final HttpRequest listDetail = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/detail")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ protected final HttpResponse listDetailResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/image_list_detail.json")).build();
+
+ protected final HttpRequest listFlavorsDetail = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/detail")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ protected final HttpResponse listFlavorsDetailResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/flavor_list_detail.json")).build();
+
+ protected final HttpRequest listServers = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/detail")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ protected final HttpResponse listServersResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/server_list_details.json")).build();
+
+ protected final HttpRequest listFloatingIps = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ protected final HttpResponse listFloatingIpsResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/floatingip_list.json")).build();
+
+ @Override
+ public T createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
+ return apply(createComputeServiceContext(fn, module, props));
+ }
+
+ private ComputeServiceContext createComputeServiceContext(Function<HttpRequest, HttpResponse> fn, Module module,
+ Properties props) {
+ return createInjector(fn, module, props).getInstance(ComputeServiceContext.class);
+ }
+
+ @Override
+ protected ApiMetadata createApiMetadata() {
+ return new NovaApiMetadata();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaComputeServiceExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaComputeServiceExpectTest.java
new file mode 100644
index 0000000..2664e8d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaComputeServiceExpectTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.openstack.nova.v2_0.internal;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.ComputeServiceContext;
+
+/**
+ * Base class for writing KeyStone Expect tests with the ComputeService
+ * abstraction
+ *
+ * @author Matt Stephenson
+ */
+public class BaseNovaComputeServiceExpectTest extends BaseNovaComputeServiceContextExpectTest<ComputeService> {
+
+ @Override
+ public ComputeService apply(ComputeServiceContext input) {
+ return input.getComputeService();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaExpectTest.java
new file mode 100644
index 0000000..714930c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaExpectTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.openstack.nova.v2_0.internal;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
+
+/**
+ * Base class for writing Nova Expect tests
+ *
+ * @author Adrian Cole
+ */
+public class BaseNovaExpectTest<T> extends BaseRestApiExpectTest<T> {
+ protected HttpRequest keystoneAuthWithUsernameAndPassword;
+ protected HttpRequest keystoneAuthWithUsernameAndPasswordAndTenantName;
+ protected HttpRequest keystoneAuthWithAccessKeyAndSecretKeyAndTenantName;
+ protected String authToken;
+ protected HttpResponse responseWithKeystoneAccess;
+ protected HttpRequest extensionsOfNovaRequest;
+ protected HttpResponse extensionsOfNovaResponse;
+ protected HttpResponse unmatchedExtensionsOfNovaResponse;
+ protected HttpRequest keystoneAuthWithAccessKeyAndSecretKeyAndTenantId;
+ protected String identityWithTenantId;
+
+ public BaseNovaExpectTest() {
+ provider = "openstack-nova";
+ keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPassword(identity,
+ credential);
+ keystoneAuthWithUsernameAndPasswordAndTenantName = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
+ credential);
+ keystoneAuthWithAccessKeyAndSecretKeyAndTenantName = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantName(identity,
+ credential);
+ keystoneAuthWithAccessKeyAndSecretKeyAndTenantId = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantId(identity,
+ credential);
+
+ authToken = KeystoneFixture.INSTANCE.getAuthToken();
+ responseWithKeystoneAccess = KeystoneFixture.INSTANCE.responseWithAccess();
+ // now, createContext arg will need tenant prefix
+ identityWithTenantId = KeystoneFixture.INSTANCE.getTenantId() + ":" + identity;
+ identity = KeystoneFixture.INSTANCE.getTenantName() + ":" + identity;
+
+ extensionsOfNovaRequest = HttpRequest.builder().method("GET")
+ // NOTE THIS IS NOVA, NOT KEYSTONE
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/extensions")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ extensionsOfNovaResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/extension_list_full.json")).build();
+
+ unmatchedExtensionsOfNovaResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/extension_list.json")).build();
+ }
+
+ @Override
+ protected HttpRequestComparisonType compareHttpRequestAsType(HttpRequest input) {
+ return HttpRequestComparisonType.JSON;
+ }
+
+ protected HttpRequest.Builder<?> authenticatedGET() {
+ return HttpRequest.builder()
+ .method("GET")
+ .addHeader("Accept", MediaType.APPLICATION_JSON)
+ .addHeader("X-Auth-Token", authToken);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseComputeServiceTypicalSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseComputeServiceTypicalSecurityGroupTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseComputeServiceTypicalSecurityGroupTest.java
new file mode 100644
index 0000000..9b056b9
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseComputeServiceTypicalSecurityGroupTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.domain.TenantIdAndName;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseSecurityGroupTest")
+public class ParseComputeServiceTypicalSecurityGroupTest extends BaseItemParserTest<SecurityGroup> {
+
+ @Override
+ public String resource() {
+ return "/securitygroup_details_computeservice_typical.json";
+ }
+
+ @Override
+ @SelectJson("security_group")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public SecurityGroup expected() {
+
+ Set<SecurityGroupRule> securityGroupRules = ImmutableSet.of(
+ SecurityGroupRule.builder().fromPort(22)
+ .ipProtocol(IpProtocol.TCP).toPort(22).parentGroupId("2769")
+ .ipRange("0.0.0.0/0").id("10331").build(),
+ SecurityGroupRule.builder().fromPort(22).group(TenantIdAndName.builder().tenantId("37936628937291").name("jclouds_mygroup").build())
+ .ipProtocol(IpProtocol.TCP).toPort(22).parentGroupId("2769")
+ .id("10332").build(),
+ SecurityGroupRule.builder().fromPort(8080)
+ .ipProtocol(IpProtocol.TCP).toPort(8080).parentGroupId("2769")
+ .ipRange("0.0.0.0/0").id("10333").build(),
+ SecurityGroupRule.builder().fromPort(8080).group(TenantIdAndName.builder().tenantId("37936628937291").name("jclouds_mygroup").build())
+ .ipProtocol(IpProtocol.TCP).toPort(8080).parentGroupId("2769")
+ .id("10334").build()
+ );
+
+ return SecurityGroup.builder().description("jclouds_mygroup").id("2769").tenantId("37936628937291").rules(securityGroupRules)
+ .name("jclouds_mygroup").build();
+ }
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseCreateFlavorTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseCreateFlavorTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseCreateFlavorTest.java
new file mode 100644
index 0000000..a125f9f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseCreateFlavorTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @see FlavorApiExpectTest
+ * @author Ilja Bobkevic
+ */
+@Test(groups = "unit", testName = "ParseCreateFlavorTest")
+public class ParseCreateFlavorTest extends BaseItemParserTest<Flavor> {
+
+ @Override
+ public String resource() {
+ return "/flavor_new.json";
+ }
+
+ @Override
+ @SelectJson("flavor")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Flavor expected() {
+ return Flavor.builder()
+ .id("1cb47a44-9b84-4da4-bf81-c1976e8414ab")
+ .name("128 MB Server").ram(128).vcpus(1)
+ .disk(10).build();
+ }
+
+ @Override
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseCreatedServerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseCreatedServerTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseCreatedServerTest.java
new file mode 100644
index 0000000..3b2a774
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseCreatedServerTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseCreatedServerTest")
+public class ParseCreatedServerTest extends BaseItemParserTest<ServerCreated> {
+
+ @Override
+ public String resource() {
+ return "/new_server.json";
+ }
+
+ @Override
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public ServerCreated expected() {
+ return ServerCreated
+ .builder()
+ .id("71752")
+ .name("test-e92")
+ .adminPass("ZWuHcmTMQ7eXoHeM")
+ .links(
+ Link.create(Relation.SELF, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752")),
+ Link.create(Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752"))).build();
+
+ }
+
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public ServerCreated expectedWithDiskConfig(String diskConfig) {
+ return ServerCreated
+ .builder()
+ .id("71752")
+ .name("test-e92")
+ .adminPass("ZWuHcmTMQ7eXoHeM")
+ .diskConfig(diskConfig)
+ .links(
+ Link.create(Relation.SELF, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752")),
+ Link.create(Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752"))).build();
+
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java
new file mode 100644
index 0000000..4fec5c0
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseSetParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.v2_0.domain.Extension;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseExtensionListNormalTest")
+public class ParseExtensionListNormalTest extends BaseSetParserTest<Extension> {
+
+ @Override
+ public String resource() {
+ return "/extension_list_normal.json";
+ }
+
+ @Override
+ @SelectJson("extensions")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Set<Extension> expected() {
+ return ImmutableSet.of(
+ Extension.builder().alias("os-keypairs").name("Keypairs")
+ .namespace(URI.create("http://docs.openstack.org/ext/keypairs/api/v1.1"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-08-08T00:00:00+00:00"))
+ .description("Keypair Support").build(),
+ Extension.builder().alias("os-volumes").name("Volumes")
+ .namespace(URI.create("http://docs.openstack.org/ext/volumes/api/v1.1"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-03-25T00:00:00+00:00"))
+ .description("Volumes support").build(),
+ Extension.builder().alias("security_groups").name("SecurityGroups")
+ .namespace(URI.create("http://docs.openstack.org/ext/securitygroups/api/v1.1"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-07-21T00:00:00+00:00"))
+ .description("Security group support").build(),
+ Extension.builder().alias("os-floating-ips").name("Floating_ips")
+ .namespace(URI.create("http://docs.openstack.org/ext/floating_ips/api/v1.1"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-06-16T00:00:00+00:00"))
+ .description("Floating IPs support").build());
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListTest.java
new file mode 100644
index 0000000..ba83a85
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseSetParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.v2_0.domain.Extension;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseExtensionListTest")
+public class ParseExtensionListTest extends BaseSetParserTest<Extension> {
+
+ @Override
+ public String resource() {
+ return "/extension_list.json";
+ }
+
+ @Override
+ @SelectJson("extensions")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Set<Extension> expected() {
+ return ImmutableSet
+ .of(Extension
+ .builder()
+ .alias("RAX-PIE")
+ .name("Public Image Extension")
+ .namespace(URI.create("http://docs.rackspacecloud.com/servers/api/ext/pie/v1.0"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-01-22T13:25:27-06:00"))
+ .description("Adds the capability to share an image with other users.")
+ .links(
+ ImmutableSet.of(
+ Link.create(Relation.DESCRIBEDBY, "application/pdf",
+ URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie-20111111.pdf")),
+ Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml",
+ URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie.wadl")))).build(),
+ Extension
+ .builder()
+ .alias("RAX-CBS")
+ .name("Cloud Block Storage")
+ .namespace(URI.create("http://docs.rackspacecloud.com/servers/api/ext/cbs/v1.0"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-01-12T11:22:33-06:00"))
+ .description("Allows mounting cloud block storage volumes.")
+ .links(
+ ImmutableSet.of(Link.create(Relation.DESCRIBEDBY, "application/pdf",
+ URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-cbs-20111201.pdf")),
+ Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml",
+ URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-cbs.wadl"))))
+ .build());
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionTest.java
new file mode 100644
index 0000000..6ba9645
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.v2_0.domain.Extension;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseExtensionTest")
+public class ParseExtensionTest extends BaseItemParserTest<Extension> {
+
+ @Override
+ public String resource() {
+ return "/extension_details.json";
+ }
+
+ @Override
+ @SelectJson("extension")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Extension expected() {
+ return Extension
+ .builder()
+ .alias("RS-PIE")
+ .name("Public Image Extension")
+ .namespace(URI.create("http://docs.rackspacecloud.com/servers/api/ext/pie/v1.0"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-01-22T13:25:27-06:00"))
+ .description("Adds the capability to share an image with other users.")
+ .links(
+ ImmutableSet.of(
+ Link.create(Relation.DESCRIBEDBY, "application/pdf",
+ URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie-20111111.pdf")),
+ Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml",
+ URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie.wadl")))).build();
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFlavorListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFlavorListTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFlavorListTest.java
new file mode 100644
index 0000000..27f5484
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFlavorListTest.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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseSetParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Jeremy Daggett
+ */
+@Test(groups = "unit", testName = "ParseFlavorListTest")
+public class ParseFlavorListTest extends BaseSetParserTest<Resource> {
+
+ @Override
+ public String resource() {
+ return "/flavor_list.json";
+ }
+
+ @Override
+ @SelectJson("flavors")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Set<Resource> expected() {
+ return ImmutableSet
+ .of(Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f1195ff37")
+ .name("256 MB Server")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")))
+ .build(),
+ Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f216543fd")
+ .name("512 MB Server")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd")))
+ .build());
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFlavorTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFlavorTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFlavorTest.java
new file mode 100644
index 0000000..9d2a011
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFlavorTest.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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Jeremy Daggett
+ */
+@Test(groups = "unit", testName = "ParseFlavorTest")
+public class ParseFlavorTest extends BaseItemParserTest<Flavor> {
+
+ @Override
+ public String resource() {
+ return "/flavor_details.json";
+ }
+
+ @Override
+ @SelectJson("flavor")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Flavor expected() {
+ return Flavor
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f1195ff37")
+ .name("256 MB Server")
+ .links(
+ ImmutableSet.of(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37"))))
+ .ram(256).disk(10).vcpus(1).build();
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
[25/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
new file mode 100755
index 0000000..b93947a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud express Task List.
+ *
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface TasksList {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java
new file mode 100755
index 0000000..9fb935a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java
@@ -0,0 +1,38 @@
+/*
+ * 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.vcloud.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Represents a component related to vCloud.
+ *
+ * @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface VCloudLogin {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
new file mode 100755
index 0000000..a93be77
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud express Catalog.
+ *
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface VDC {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java
new file mode 100755
index 0000000..439c73e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java
@@ -0,0 +1,144 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
+import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.BindCatalogItemToXmlPayload;
+import org.jclouds.vcloud.binders.OrgNameAndCatalogNameToEndpoint;
+import org.jclouds.vcloud.binders.OrgNameCatalogNameItemNameToEndpoint;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.jclouds.vcloud.xml.CatalogHandler;
+import org.jclouds.vcloud.xml.CatalogItemHandler;
+
+
+/**
+ * Provides access to Catalog functionality in vCloud
+ * <p/>
+ *
+ * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface CatalogApi {
+
+ @GET
+ @XMLResponseParser(CatalogHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Consumes(CATALOG_XML)
+ Catalog getCatalog(@EndpointParam URI catalogId);
+
+ /**
+ * returns the catalog in the organization associated with the specified name. Note that both
+ * parameters can be null to choose default.
+ *
+ * @param orgName
+ * organization name, or null for the default
+ * @param catalogName
+ * catalog name, or null for the default
+ * @throws NoSuchElementException
+ * if you specified an org or catalog name that isn't present
+ */
+ @GET
+ @XMLResponseParser(CatalogHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Consumes(CATALOG_XML)
+ @MapBinder(OrgNameAndCatalogNameToEndpoint.class)
+ Catalog findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("catalogName") String catalogName);
+
+ @GET
+ @Consumes(CATALOGITEM_XML)
+ @XMLResponseParser(CatalogItemHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ CatalogItem getCatalogItem(@EndpointParam URI catalogItem);
+
+ /**
+ * returns the catalog item in the catalog associated with the specified name. Note that the org
+ * and catalog parameters can be null to choose default.
+ *
+ * @param orgName
+ * organization name, or null for the default
+ * @param catalogName
+ * catalog name, or null for the default
+ * @param itemName
+ * item you wish to lookup
+ *
+ * @throws NoSuchElementException
+ * if you specified an org, catalog, or catalog item name that isn't present
+ */
+ @GET
+ @Consumes(CATALOGITEM_XML)
+ @XMLResponseParser(CatalogItemHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameCatalogNameItemNameToEndpoint.class)
+ CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("catalogName") String catalogName,
+ @PayloadParam("itemName") String itemName);
+
+ /**
+ * A catalog can contain references to vApp templates and media images that have been uploaded to
+ * any vDC in an organization. A vApp template or media image can be listed in at most one
+ * catalog.
+ *
+ * @param entity
+ * the reference to the vApp templates and media image
+ * @param catalog
+ * URI of the catalog to add the resourceEntity from
+ * @param name
+ * name of the entry in the catalog
+ *
+ * @param options
+ * options such as description or properties
+ * @return the new catalog item
+ */
+ @POST
+ @Path("/catalogItems")
+ @Consumes(CATALOGITEM_XML)
+ @Produces(CATALOGITEM_XML)
+ @MapBinder(BindCatalogItemToXmlPayload.class)
+ @XMLResponseParser(CatalogItemHandler.class)
+ CatalogItem addVAppTemplateOrMediaImageToCatalogAndNameItem(@PayloadParam("Entity") URI entity,
+ @EndpointParam URI catalog,
+ @PayloadParam("name") String name,
+ CatalogItemOptions... options);
+
+ @DELETE
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteCatalogItem(@EndpointParam URI href);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java
new file mode 100755
index 0000000..f2a97b0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java
@@ -0,0 +1,61 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.OrgNameVDCNameNetworkNameToEndpoint;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.OrgNetworkHandler;
+
+/**
+ * Provides access to Network functionality in vCloud
+ * <p/>
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface NetworkApi {
+
+ @GET
+ @Consumes(NETWORK_XML)
+ @XMLResponseParser(OrgNetworkHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameVDCNameNetworkNameToEndpoint.class)
+ OrgNetwork findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("vdcName") String vdcName,
+ @PayloadParam("resourceName") String networkName);
+
+ @GET
+ @Consumes(NETWORK_XML)
+ @XMLResponseParser(OrgNetworkHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ OrgNetwork getNetwork(@EndpointParam URI network);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java
new file mode 100755
index 0000000..718fda9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java
@@ -0,0 +1,86 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.OrgList;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.functions.OrgNameToEndpoint;
+import org.jclouds.vcloud.xml.OrgHandler;
+import org.jclouds.vcloud.xml.OrgListHandler;
+
+
+/**
+ * Provides access to Org functionality in vCloud
+ * <p/>
+ *
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface OrgApi {
+
+ /**
+ * The response to a login request includes a list of the organizations to which the
+ * authenticated user has access.
+ *
+ * @return organizations indexed by name
+ */
+ @GET
+ @Endpoint(OrgList.class)
+ @XMLResponseParser(OrgListHandler.class)
+ @Consumes(VCloudMediaType.ORGLIST_XML)
+ Map<String, ReferenceType> listOrgs();
+
+ @GET
+ @XMLResponseParser(OrgHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Consumes(ORG_XML)
+ Org getOrg(@EndpointParam URI orgId);
+
+ /**
+ * This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within
+ * the organization.
+ *
+ * @param name
+ * organization name, or null for the default
+ * @throws NoSuchElementException
+ * if you specified an org name that isn't present
+ */
+ @GET
+ @XMLResponseParser(OrgHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Consumes(ORG_XML)
+ Org findOrgNamed(@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java
new file mode 100755
index 0000000..4fe232e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java
@@ -0,0 +1,82 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TasksList;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.functions.OrgNameToTasksListEndpoint;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.TasksListHandler;
+
+/**
+ * Provides access to Task functionality in vCloud
+ * <p/>
+ *
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface TaskApi {
+
+ @GET
+ @Consumes(TASKSLIST_XML)
+ @XMLResponseParser(TasksListHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ TasksList getTasksList(@EndpointParam URI tasksListId);
+
+ @GET
+ @Consumes(TASKSLIST_XML)
+ @XMLResponseParser(TasksListHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ TasksList findTasksListInOrgNamed(@Nullable @EndpointParam(parser = OrgNameToTasksListEndpoint.class) String orgName);
+
+ /**
+ * Whenever the result of a request cannot be returned immediately, the server creates a Task
+ * object and includes it in the response, as a member of the Tasks container in the response
+ * body. Each Task has an href value, which is a URL that the client can use to retrieve the Task
+ * element alone, without the rest of the response in which it was contained. All information
+ * about the task is included in the Task element when it is returned in the response’s Tasks
+ * container, so a client does not need to make an additional request to the Task URL unless it
+ * wants to follow the progress of a task that was incomplete.
+ */
+ @GET
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Task getTask(@EndpointParam URI taskId);
+
+ @POST
+ @Path("/action/cancel")
+ void cancelTask(@EndpointParam URI taskId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
new file mode 100755
index 0000000..c16a5b5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
@@ -0,0 +1,261 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
+import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.predicates.validators.DnsNameValidator;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.ParamValidators;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.PayloadParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+
+
+/**
+ * Provides access to VApp functionality in vCloud
+ * <p/>
+ *
+ * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VAppApi {
+ @GET
+ @Consumes(VAPP_XML)
+ @XMLResponseParser(VAppHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
+ VApp findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
+
+ @POST
+ @Path("/action/cloneVApp")
+ @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @MapBinder(BindCloneVAppParamsToXmlPayload.class)
+ Task copyVAppToVDCAndName(@PayloadParam("Source") URI sourceVApp,
+ @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
+ CloneVAppOptions... options);
+
+ @POST
+ @Path("/action/cloneVApp")
+ @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @PayloadParams(keys = "IsSourceDelete", values = "true")
+ @MapBinder(BindCloneVAppParamsToXmlPayload.class)
+ Task moveVAppToVDCAndRename(@PayloadParam("Source") URI sourceVApp,
+ @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
+ CloneVAppOptions... options);
+
+ @GET
+ @Consumes(VAPP_XML)
+ @XMLResponseParser(VAppHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VApp getVApp(@EndpointParam URI href);
+
+ /**
+ * To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp
+ * automatically deploys all of the virtual machines it contains. To deploy a virtual machine,
+ * the client makes a request to its action/deploy URL.
+ * <p/>
+ * Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(DEPLOYVAPPPARAMS_XML)
+ @Path("/action/deploy")
+ @MapBinder(BindDeployVAppParamsToXmlPayload.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task deployVApp(@EndpointParam URI href);
+
+ /**
+ * like {@link #deployVApp(URI)}, except deploy transitions to power on state
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(DEPLOYVAPPPARAMS_XML)
+ @Path("/action/deploy")
+ @MapBinder(BindDeployVAppParamsToXmlPayload.class)
+ @PayloadParams(keys = "powerOn", values = "true")
+ @XMLResponseParser(TaskHandler.class)
+ Task deployAndPowerOnVApp(@EndpointParam URI href);
+
+ /**
+ * Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees
+ * the resources reserved for the vApp and sets the vApp’s deploy attribute to a value of false
+ * to indicate that it is not deployed.
+ * <p/>
+ * Undeploying a virtual machine powers off or suspends the virtual machine, then frees the
+ * resources reserved for it and sets the its deploy attribute to a value of false to indicate
+ * that it is not deployed. This operation has no effect on the containing vApp.
+ * <h4>NOTE</h4>
+ * Using this method will simply power off the vms. In order to save their state, use
+ * {@link #undeployAndSaveStateOf}
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(UNDEPLOYVAPPPARAMS_XML)
+ @Path("/action/undeploy")
+ @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task undeployVApp(@EndpointParam URI href);
+
+ /**
+ * like {@link #undeployVApp(URI)}, where the undeployed virtual machines are suspended and their
+ * suspend state saved
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(UNDEPLOYVAPPPARAMS_XML)
+ @Path("/action/undeploy")
+ @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
+ @PayloadParams(keys = "saveState", values = "true")
+ @XMLResponseParser(TaskHandler.class)
+ Task undeployAndSaveStateOfVApp(@EndpointParam URI href);
+
+ /**
+ * A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as
+ * specified in the vApp’s StartupSection field.
+ * <p/>
+ * A powerOn request to a virtual machine URL powers on the specified virtual machine and forces
+ * deployment of the parent vApp.
+ * <p/>
+ * <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces
+ * deployment.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/powerOn")
+ @XMLResponseParser(TaskHandler.class)
+ Task powerOnVApp(@EndpointParam URI href);
+
+ /**
+ * A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as
+ * specified in its StartupSection field.
+ * <p/>
+ * A powerOff request to a virtual machine URL powers off the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/powerOff")
+ @XMLResponseParser(TaskHandler.class)
+ Task powerOffVApp(@EndpointParam URI href);
+
+ /**
+ * A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as
+ * specified in its StartupSection field.
+ * <p/>
+ * A shutdown request to a virtual machine URL shuts down the specified virtual machine.
+ * <p/>
+ * <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track
+ * the progress or verify the result of the requested operation. Hence, void is returned
+ */
+ @POST
+ @Path("/power/action/shutdown")
+ void shutdownVApp(@EndpointParam URI href);
+
+ /**
+ * A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in
+ * its StartupSection field.
+ * <p/>
+ * A reset request to a virtual machine URL resets the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/reset")
+ @XMLResponseParser(TaskHandler.class)
+ Task resetVApp(@EndpointParam URI href);
+
+ /**
+ * A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified
+ * in its StartupSection field.
+ * <p/>
+ * A reboot request to a virtual machine URL reboots the specified virtual machine.
+ * <p/>
+ * <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track
+ * the progress or verify the result of the requested operation. Hence, void is returned
+ */
+ @POST
+ @Path("/power/action/reboot")
+ void rebootVApp(@EndpointParam URI href);
+
+ /**
+ * A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified
+ * in its StartupSection field.
+ * <p/>
+ * A suspend request to a virtual machine URL suspends the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/suspend")
+ @XMLResponseParser(TaskHandler.class)
+ Task suspendVApp(@EndpointParam URI href);
+
+ /**
+ * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
+ * object that is being copied or moved is in use. Other criteria that determine whether an
+ * object is in use depend on the object type.
+ * <ul>
+ * <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the
+ * template is no longer in use.</li>
+ * <li>A vApp is in use if it is deployed.</li>
+ * <li>A media image is in use if it is inserted in a Vm.</li>
+ * </ul>
+ *
+ * @param href
+ * href of the vApp
+ * @return task of the operation in progress
+ */
+ @DELETE
+ @Consumes(TASK_XML)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task deleteVApp(@EndpointParam URI href);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
new file mode 100755
index 0000000..bd11f25
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
@@ -0,0 +1,180 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.ovf.xml.EnvelopeHandler;
+import org.jclouds.predicates.validators.DnsNameValidator;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.ParamValidators;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.PayloadParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.BindCaptureVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindCloneVAppTemplateParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
+import org.jclouds.vcloud.binders.OrgNameCatalogNameVAppTemplateNameToEndpoint;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.options.CaptureVAppOptions;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.jclouds.vcloud.xml.VAppTemplateHandler;
+
+
+/**
+ * Provides access to VApp Template functionality in vCloud
+ * <p/>
+ *
+ * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VAppTemplateApi {
+ /**
+ * returns the vapp template corresponding to a catalog item in the catalog associated with the
+ * specified name. Note that the org and catalog parameters can be null to choose default.
+ *
+ * @param orgName
+ * organization name, or null for the default
+ * @param catalogName
+ * catalog name, or null for the default
+ * @param itemName
+ * item you wish to lookup
+ *
+ * @throws NoSuchElementException
+ * if you specified an org, catalog, or catalog item name that isn't present
+ */
+ @GET
+ @Consumes(VAPPTEMPLATE_XML)
+ @XMLResponseParser(VAppTemplateHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
+ VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("catalogName") String catalogName,
+ @PayloadParam("itemName") String itemName);
+
+ /**
+ */
+ @POST
+ @Path("/action/instantiateVAppTemplate")
+ @Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
+ @Consumes(VAPP_XML)
+ @XMLResponseParser(VAppHandler.class)
+ @MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
+ VApp createVAppInVDCByInstantiatingTemplate(
+ @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, @EndpointParam URI vdc,
+ @PayloadParam("template") URI template, InstantiateVAppTemplateOptions... options);
+
+ @POST
+ @Path("/action/cloneVAppTemplate")
+ @Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml")
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class)
+ Task copyVAppTemplateToVDCAndName(@PayloadParam("Source") URI sourceVAppTemplate,
+ @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
+ CloneVAppTemplateOptions... options);
+
+ @POST
+ @Path("/action/cloneVAppTemplate")
+ @Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml")
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @PayloadParams(keys = "IsSourceDelete", values = "true")
+ @MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class)
+ Task moveVAppTemplateToVDCAndRename(@PayloadParam("Source") URI toClone,
+ @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
+ CloneVAppTemplateOptions... options);
+
+ /**
+ * The captureVApp request creates a vApp template from an instantiated vApp. <h4>Note</h4>
+ * Before it can be captured, a vApp must be undeployed
+ *
+ * @param targetVdcHref
+ * @param sourceVAppHref
+ * @param newTemplateName
+ * @param options
+ * @return template in progress
+ */
+ @POST
+ @Path("/action/captureVApp")
+ @Produces("application/vnd.vmware.vcloud.captureVAppParams+xml")
+ @Consumes(VAPPTEMPLATE_XML)
+ @XMLResponseParser(VAppTemplateHandler.class)
+ @MapBinder(BindCaptureVAppParamsToXmlPayload.class)
+ VAppTemplate captureVAppAsTemplateInVDC(@PayloadParam("vApp") URI toCapture,
+ @PayloadParam("templateName") @ParamValidators(DnsNameValidator.class) String templateName,
+ @EndpointParam URI vdc, CaptureVAppOptions... options);
+
+ @GET
+ @Consumes(VAPPTEMPLATE_XML)
+ @XMLResponseParser(VAppTemplateHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VAppTemplate getVAppTemplate(@EndpointParam URI vAppTemplate);
+
+ @GET
+ @Consumes(MediaType.TEXT_XML)
+ @Path("/ovf")
+ @XMLResponseParser(EnvelopeHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Envelope getOvfEnvelopeForVAppTemplate(@EndpointParam URI href);
+
+ /**
+ * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
+ * object that is being copied or moved is in use. Other criteria that determine whether an
+ * object is in use depend on the object type.
+ * <ul>
+ * <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the
+ * template is no longer in use.</li>
+ * <li>A vApp is in use if it is deployed.</li>
+ * <li>A media image is in use if it is inserted in a Vm.</li>
+ * </ul>
+ *
+ * @param id
+ * href of the vApp
+ * @return task of the operation in progress
+ */
+ @DELETE
+ @Consumes(TASK_XML)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task deleteVAppTemplate(@EndpointParam URI href);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
new file mode 100755
index 0000000..ebb8b6a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
@@ -0,0 +1,73 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.OrgNameAndVDCNameToEndpoint;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.VDCHandler;
+
+
+/**
+ * Provides access to VDC functionality in vCloud
+ * <p/>
+ *
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VDCApi {
+ @GET
+ @XMLResponseParser(VDCHandler.class)
+ @Consumes(VDC_XML)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VDC getVDC(@EndpointParam URI vdc);
+
+ /**
+ * returns the VDC in the organization associated with the specified name. Note that both
+ * parameters can be null to choose default.
+ *
+ * @param orgName
+ * organization name, or null for the default
+ * @param vdcName
+ * catalog name, or null for the default
+ * @throws NoSuchElementException
+ * if you specified an org or vdc name that isn't present
+ */
+ @GET
+ @XMLResponseParser(VDCHandler.class)
+ @Consumes(VDC_XML)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameAndVDCNameToEndpoint.class)
+ VDC findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("vdcName") String vdcName);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
new file mode 100755
index 0000000..2026ea4
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
@@ -0,0 +1,295 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
+import static org.jclouds.vcloud.VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML;
+import static org.jclouds.vcloud.VCloudMediaType.NETWORKCONNECTIONSECTION_XML;
+import static org.jclouds.vcloud.VCloudMediaType.RASDITEM_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
+import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VM_XML;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.BindCPUCountToXmlPayload;
+import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindGuestCustomizationSectionToXmlPayload;
+import org.jclouds.vcloud.binders.BindMemoryToXmlPayload;
+import org.jclouds.vcloud.binders.BindNetworkConnectionSectionToXmlPayload;
+import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VmHandler;
+
+
+/**
+ * Provides access to VM functionality in vCloud
+ * <p/>
+ *
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VmApi {
+
+ @GET
+ @Consumes(VM_XML)
+ @XMLResponseParser(VmHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Vm getVm(@EndpointParam URI href);
+
+ /**
+ * To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp
+ * automatically deploys all of the virtual machines it contains. To deploy a virtual machine,
+ * the client makes a request to its action/deploy URL.
+ * <p/>
+ * Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(DEPLOYVAPPPARAMS_XML)
+ @Path("/action/deploy")
+ @MapBinder(BindDeployVAppParamsToXmlPayload.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task deployVm(@EndpointParam URI href);
+
+ /**
+ * like {@link #deploy(URI)}, except deploy transitions to power on state
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(DEPLOYVAPPPARAMS_XML)
+ @Path("/action/deploy")
+ @MapBinder(BindDeployVAppParamsToXmlPayload.class)
+ @PayloadParams(keys = "powerOn", values = "true")
+ @XMLResponseParser(TaskHandler.class)
+ Task deployAndPowerOnVm(@EndpointParam URI href);
+
+ /**
+ * Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees
+ * the resources reserved for the vApp and sets the vApp’s deploy attribute to a value of false
+ * to indicate that it is not deployed.
+ * <p/>
+ * Undeploying a virtual machine powers off or suspends the virtual machine, then frees the
+ * resources reserved for it and sets the its deploy attribute to a value of false to indicate
+ * that it is not deployed. This operation has no effect on the containing vApp.
+ * <h4>NOTE</h4>
+ * Using this method will simply power off the vms. In order to save their state, use
+ * {@link #undeployAndSaveStateOf}
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(UNDEPLOYVAPPPARAMS_XML)
+ @Path("/action/undeploy")
+ @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task undeployVm(@EndpointParam URI href);
+
+ /**
+ * like {@link #undeploy(URI)}, where the undeployed virtual machines are suspended and their
+ * suspend state saved
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(UNDEPLOYVAPPPARAMS_XML)
+ @Path("/action/undeploy")
+ @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
+ @PayloadParams(keys = "saveState", values = "true")
+ @XMLResponseParser(TaskHandler.class)
+ Task undeployAndSaveStateOfVm(@EndpointParam URI href);
+
+ /**
+ * A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as
+ * specified in the vApp’s StartupSection field.
+ * <p/>
+ * A powerOn request to a virtual machine URL powers on the specified virtual machine and forces
+ * deployment of the parent vApp.
+ * <p/>
+ * <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces
+ * deployment.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/powerOn")
+ @XMLResponseParser(TaskHandler.class)
+ Task powerOnVm(@EndpointParam URI href);
+
+ /**
+ * A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as
+ * specified in its StartupSection field.
+ * <p/>
+ * A powerOff request to a virtual machine URL powers off the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/powerOff")
+ @XMLResponseParser(TaskHandler.class)
+ Task powerOffVm(@EndpointParam URI href);
+
+ /**
+ * A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as
+ * specified in its StartupSection field.
+ * <p/>
+ * A shutdown request to a virtual machine URL shuts down the specified virtual machine.
+ * <p/>
+ * <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track
+ * the progress or verify the result of the requested operation. Hence, void is returned
+ */
+ @POST
+ @Path("/power/action/shutdown")
+ void shutdownVm(@EndpointParam URI href);
+
+ /**
+ * A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in
+ * its StartupSection field.
+ * <p/>
+ * A reset request to a virtual machine URL resets the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/reset")
+ @XMLResponseParser(TaskHandler.class)
+ Task resetVm(@EndpointParam URI href);
+
+ /**
+ * A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified
+ * in its StartupSection field.
+ * <p/>
+ * A reboot request to a virtual machine URL reboots the specified virtual machine.
+ * <p/>
+ * <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track
+ * the progress or verify the result of the requested operation. Hence, void is returned
+ */
+ @POST
+ @Path("/power/action/reboot")
+ void rebootVm(@EndpointParam URI href);
+
+ /**
+ * A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified
+ * in its StartupSection field.
+ * <p/>
+ * A suspend request to a virtual machine URL suspends the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/suspend")
+ @XMLResponseParser(TaskHandler.class)
+ Task suspendVm(@EndpointParam URI href);
+
+ /**
+ * Get a Screen Thumbnail for a Virtual Machine
+ *
+ * @param href
+ * to snapshot
+ */
+ @GET
+ @Path("/screen")
+ @Consumes("image/png")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ InputStream getScreenThumbnailForVm(@EndpointParam URI vm);
+
+ /**
+ * Modify the Guest Customization Section of a Virtual Machine
+ *
+ * @param href
+ * uri to modify
+ * @param updated
+ * guestCustomizationSection
+ * @return task in progress
+ */
+ @PUT
+ @Consumes(TASK_XML)
+ @Produces(GUESTCUSTOMIZATIONSECTION_XML)
+ @Path("/guestCustomizationSection")
+ @XMLResponseParser(TaskHandler.class)
+ Task updateGuestCustomizationOfVm(
+ @BinderParam(BindGuestCustomizationSectionToXmlPayload.class) GuestCustomizationSection guestCustomizationSection,
+ @EndpointParam URI href);
+
+ /**
+ * Modify the Network Connection Section of a Virtual Machine
+ *
+ * @param href
+ * uri to modify
+ * @param updated
+ * networkConnectionSection
+ * @return task in progress
+ */
+ @PUT
+ @Consumes(TASK_XML)
+ @Produces(NETWORKCONNECTIONSECTION_XML)
+ @Path("/networkConnectionSection")
+ @XMLResponseParser(TaskHandler.class)
+ Task updateNetworkConnectionOfVm(
+ @BinderParam(BindNetworkConnectionSectionToXmlPayload.class) NetworkConnectionSection networkConnectionSection,
+ @EndpointParam URI href);
+
+ /**
+ * update the cpuCount of an existing VM
+ *
+ * @param href
+ * to update
+ * @param cpuCount
+ * count to change the primary cpu to
+ */
+ @PUT
+ @Consumes(TASK_XML)
+ @Produces(RASDITEM_XML)
+ @Path("/virtualHardwareSection/cpu")
+ @XMLResponseParser(TaskHandler.class)
+ Task updateCPUCountOfVm(@BinderParam(BindCPUCountToXmlPayload.class) int cpuCount,
+ @EndpointParam URI href);
+
+ /**
+ * update the memoryInMB of an existing VM
+ *
+ * @param href
+ * to update
+ * @param memoryInMB
+ * memory in MB to assign to the VM
+ */
+ @PUT
+ @Consumes(TASK_XML)
+ @Produces(RASDITEM_XML)
+ @Path("/virtualHardwareSection/memory")
+ @XMLResponseParser(TaskHandler.class)
+ Task updateMemoryMBOfVm(@BinderParam(BindMemoryToXmlPayload.class) int memoryInMB,
+ @EndpointParam URI href);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
new file mode 100755
index 0000000..9edbad4
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.vcloud.filters;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.ws.rs.core.HttpHeaders;
+
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpRequestFilter;
+import org.jclouds.vcloud.VCloudToken;
+import org.jclouds.rest.annotations.ApiVersion;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableMultimap;
+
+/**
+ * Adds the VCloud Token to the request as a cookie
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class AddVCloudAuthorizationAndCookieToRequest implements HttpRequestFilter {
+ private Supplier<String> vcloudTokenProvider;
+ private final String apiVersion;
+
+ @Inject
+ public AddVCloudAuthorizationAndCookieToRequest(@VCloudToken Supplier<String> authTokenProvider, @ApiVersion final String apiVersion) {
+ this.vcloudTokenProvider = authTokenProvider;
+ this.apiVersion = apiVersion;
+ }
+
+ @Override
+ public HttpRequest filter(HttpRequest request) throws HttpException {
+ String token = vcloudTokenProvider.get();
+ String acceptType = request.getFirstHeaderOrNull(HttpHeaders.ACCEPT) == null
+ ? "application/*+xml"
+ : request.getFirstHeaderOrNull(HttpHeaders.ACCEPT);
+ String version = ";version=" + apiVersion;
+ String acceptHeader = acceptType + version;
+ return request.toBuilder()
+ .replaceHeaders(ImmutableMultimap.of(HttpHeaders.ACCEPT,
+ acceptHeader, "x-vcloud-authorization", token,
+ HttpHeaders.COOKIE, "vcloud-token=" +
+ token)).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
new file mode 100755
index 0000000..f5d6a71
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
@@ -0,0 +1,64 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class CatalogItemsInCatalog implements Function<Catalog, Iterable<CatalogItem>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+
+ private final VCloudApi aclient;
+
+ @Inject
+ CatalogItemsInCatalog(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<CatalogItem> apply(Catalog from) {
+ return transform(filter(from.values(), new Predicate<ReferenceType>() {
+ public boolean apply(ReferenceType input) {
+ return input.getType().equals(VCloudMediaType.CATALOGITEM_XML);
+ }
+ }), new Function<ReferenceType, CatalogItem>() {
+ public CatalogItem apply(ReferenceType from) {
+ return aclient.getCatalogApi().getCatalogItem(from.getHref());
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
new file mode 100755
index 0000000..31f5383
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
@@ -0,0 +1,57 @@
+/*
+ * 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.vcloud.functions;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class CatalogItemsInOrg implements Function<Org, Iterable<CatalogItem>> {
+
+ private final Function<Org, Iterable<Catalog>> allCatalogsInOrg;
+
+ private final Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog;
+
+ @Inject
+ CatalogItemsInOrg(Function<Org, Iterable<Catalog>> allCatalogsInOrg,
+ Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog) {
+ this.allCatalogsInOrg = allCatalogsInOrg;
+ this.allCatalogItemsInCatalog = allCatalogItemsInCatalog;
+ }
+
+ @Override
+ public Iterable<CatalogItem> apply(Org from) {
+ return Iterables.concat(Iterables.transform(allCatalogsInOrg.apply(from),
+ new Function<Catalog, Iterable<? extends CatalogItem>>() {
+ @Override
+ public Iterable<? extends CatalogItem> apply(Catalog from) {
+ return allCatalogItemsInCatalog.apply(from);
+ }
+
+ }));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
new file mode 100755
index 0000000..212569c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
@@ -0,0 +1,73 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import java.util.Collection;
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class CatalogsInOrg implements Function<Org, Iterable<Catalog>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+
+ private final VCloudApi aclient;
+
+ @Inject
+ CatalogsInOrg(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<Catalog> apply(final Org org) {
+
+ Collection<ReferenceType> filtered = Collections2.filter(
+ org.getCatalogs().values(), new Predicate<ReferenceType>() {
+ @Override
+ public boolean apply(ReferenceType type) {
+ if(type == null){
+ return false;
+ }
+ return !ImmutableSet.of("add", "remove").contains(type.getRelationship());
+ }
+ });
+
+
+ return transform(filtered, new Function<ReferenceType, Catalog>() {
+ public Catalog apply(ReferenceType from) {
+ return aclient.getCatalogApi().getCatalog(from.getHref());
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
new file mode 100755
index 0000000..eeecb8d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
@@ -0,0 +1,47 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.collect.Iterables.get;
+
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Network;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+
+@Singleton
+public class DefaultNetworkNameInTemplate implements Function<VAppTemplate, String> {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Override
+ public String apply(VAppTemplate vAppTemplate) {
+ checkArgument(vAppTemplate != null, "vAppTemplate was null!");
+ Set<Network> networks = vAppTemplate.getNetworkSection().getNetworks();
+ checkArgument(networks.size() > 0, "no networks found in vAppTemplate %s", vAppTemplate);
+ if (networks.size() > 1)
+ logger.warn("multiple networks found for %s, choosing first from: %s", vAppTemplate.getName(), networks);
+ return get(networks, 0).getName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
new file mode 100755
index 0000000..261498c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
@@ -0,0 +1,57 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+
+import com.google.common.base.Function;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class NetworksInOrg implements Function<Org, Iterable<OrgNetwork>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+
+ private final VCloudApi aclient;
+
+ @Inject
+ NetworksInOrg(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<OrgNetwork> apply(final Org org) {
+ return transform(org.getNetworks().values(), new Function<ReferenceType, OrgNetwork>() {
+ public OrgNetwork apply(ReferenceType from) {
+ return aclient.getNetworkApi().getNetwork(from.getHref());
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
new file mode 100755
index 0000000..507d307
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
@@ -0,0 +1,57 @@
+/*
+ * 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.vcloud.functions;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgNameToEndpoint implements Function<Object, URI> {
+ private final Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier;
+ private final Supplier<ReferenceType> defaultOrg;
+
+ @Inject
+ public OrgNameToEndpoint(@Org Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier,
+ @Org Supplier<ReferenceType> defaultOrg) {
+ this.orgNameToEndpointSupplier = orgNameToEndpointSupplier;
+ this.defaultOrg = defaultOrg;
+ }
+
+ public URI apply(Object from) {
+ try {
+ Map<String, ReferenceType> orgNameToEndpoint = orgNameToEndpointSupplier.get();
+ return from == null ? defaultOrg.get().getHref() : orgNameToEndpoint.get(from).getHref();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpointSupplier.get().keySet());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
new file mode 100755
index 0000000..bf9fa13
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
@@ -0,0 +1,62 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.TasksList;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgNameToTasksListEndpoint implements Function<Object, URI> {
+ private final Supplier<Map<String, Org>> orgMap;
+ private final Supplier<ReferenceType> defaultTasksList;
+
+ @Inject
+ public OrgNameToTasksListEndpoint(Supplier<Map<String, Org>> orgMap,
+ @TasksList Supplier<ReferenceType> defaultTasksList) {
+ this.orgMap = orgMap;
+ this.defaultTasksList = defaultTasksList;
+ }
+
+ public URI apply(Object from) {
+ Object org = from;
+ if (org == null)
+ return defaultTasksList.get().getHref();
+ try {
+ return checkNotNull(orgMap.get().get(org)).getTasksList().getHref();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException(org + " not found in " + orgMap.get());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
new file mode 100755
index 0000000..26a1450
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
@@ -0,0 +1,73 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import java.net.URI;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Org;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgsForLocations implements Function<Iterable<Location>, Iterable<Org>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+ private final VCloudApi aclient;
+
+ @Inject
+ OrgsForLocations(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ /**
+ * Zones are assignable, but we want regions. so we look for zones, whose
+ * parent is region. then, we use a set to extract the unique set.
+ */
+ @Override
+ public Iterable<Org> apply(Iterable<Location> from) {
+ FluentIterable<URI> uris = FluentIterable.from(from).filter(new Predicate<Location>() {
+ public boolean apply(Location input) {
+ return input.getScope() == LocationScope.ZONE;
+ }
+ }).transform(new Function<Location, URI>() {
+ public URI apply(Location from) {
+ return URI.create(from.getParent().getId());
+ }
+ });
+ return transform(uris, new Function<URI, Org>() {
+ public Org apply(URI from) {
+ return aclient.getOrgApi().getOrg(from);
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
new file mode 100755
index 0000000..7749269
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
@@ -0,0 +1,56 @@
+/*
+ * 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.vcloud.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Org;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgsForNames implements Function<Iterable<String>, Iterable<Org>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+ private final VCloudApi aclient;
+
+ @Inject
+ OrgsForNames(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<Org> apply(Iterable<String> from) {
+ return Iterables.filter(transform(from, new Function<String, Org>() {
+ public Org apply(String from) {
+ return aclient.getOrgApi().findOrgNamed(from);
+ }
+ }), Predicates.notNull());
+ }
+
+}
[46/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
new file mode 100644
index 0000000..dcaf6fc
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
@@ -0,0 +1,127 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+
+/**
+ * Server Resource with administrative password returned by ServerApi#CreateServer calls
+ *
+ * @author Adam Lowe
+ * @see <a href=
+ "http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
+ />
+*/
+public class ServerCreated extends Resource {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromServerCreated(this);
+ }
+
+ public static final class Builder extends Resource.Builder<Builder> {
+ protected String adminPass;
+ protected String diskConfig;
+
+ /**
+ * @see ServerCreated#getAdminPass()
+ */
+ public Builder adminPass(String adminPass) {
+ this.adminPass = adminPass;
+ return self();
+ }
+
+ /**
+ * @see ServerCreated#getDiskConfig()
+ */
+ public Builder diskConfig(String diskConfig) {
+ this.diskConfig = diskConfig;
+ return self();
+ }
+
+ public ServerCreated build() {
+ return new ServerCreated(id, name, links, adminPass, diskConfig);
+ }
+
+ public Builder fromServerCreated(ServerCreated in) {
+ return super.fromResource(in).adminPass(in.getAdminPass().orNull()).diskConfig(in.getDiskConfig().orNull());
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+ }
+
+ private final Optional<String> adminPass;
+ private final Optional<String> diskConfig;
+
+ @ConstructorProperties({
+ "id", "name", "links", "adminPass", "OS-DCF:diskConfig"
+ })
+ protected ServerCreated(String id, @Nullable String name, Set<Link> links, @Nullable String adminPass,
+ @Nullable String diskConfig) {
+ super(id, name, links);
+ this.adminPass = Optional.fromNullable(adminPass);
+ this.diskConfig = Optional.fromNullable(diskConfig);
+ }
+
+ /**
+ * present unless the nova install was configured with the option {@code enable_instance_password=false}
+ */
+ public Optional<String> getAdminPass() {
+ return this.adminPass;
+ }
+
+ /**
+ * @see CreateServerOptions#getDiskConfig()
+ */
+ public Optional<String> getDiskConfig() {
+ return this.diskConfig;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(adminPass, diskConfig);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ServerCreated that = ServerCreated.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.adminPass, that.adminPass)
+ && Objects.equal(this.diskConfig, that.diskConfig);
+ }
+
+ @Override
+ protected ToStringHelper string() {
+ return super.string().add("adminPass", adminPass.orNull()).add("diskConfig", diskConfig.orNull());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
new file mode 100644
index 0000000..1390660
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
@@ -0,0 +1,156 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Additional attributes delivered by Extended Server Attributes extension (alias "OS-EXT-SRV-ATTR")
+ *
+ * @author Adam Lowe
+ * @see <a href=
+ "http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_server_attributes.html"
+ />
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
+*/
+public class ServerExtendedAttributes {
+
+ public static String PREFIX;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromServerExtendedAttributes(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String instanceName;
+ protected String hostName;
+ protected String hypervisorHostName;
+
+ /**
+ * @see ServerExtendedAttributes#getInstanceName()
+ */
+ public T instanceName(String instanceName) {
+ this.instanceName = instanceName;
+ return self();
+ }
+
+ /**
+ * @see ServerExtendedAttributes#getHostName()
+ */
+ public T hostName(String hostName) {
+ this.hostName = hostName;
+ return self();
+ }
+
+ /**
+ * @see ServerExtendedAttributes#getHypervisorHostName()
+ */
+ public T hypervisorHostName(String hypervisorHostName) {
+ this.hypervisorHostName = hypervisorHostName;
+ return self();
+ }
+
+ public ServerExtendedAttributes build() {
+ return new ServerExtendedAttributes(instanceName, hostName, hypervisorHostName);
+ }
+
+ public T fromServerExtendedAttributes(ServerExtendedAttributes in) {
+ return this
+ .instanceName(in.getInstanceName())
+ .hostName(in.getHostName())
+ .hypervisorHostName(in.getHypervisorHostName());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("OS-EXT-SRV-ATTR:instance_name")
+ private final String instanceName;
+ @Named("OS-EXT-SRV-ATTR:host")
+ private final String hostName;
+ @Named("OS-EXT-SRV-ATTR:hypervisor_hostname")
+ private final String hypervisorHostName;
+
+ @ConstructorProperties({
+ "OS-EXT-SRV-ATTR:instance_name", "OS-EXT-SRV-ATTR:host", "OS-EXT-SRV-ATTR:hypervisor_hostname"
+ })
+ protected ServerExtendedAttributes(@Nullable String instanceName, @Nullable String hostName, @Nullable String hypervisorHostName) {
+ this.instanceName = instanceName;
+ this.hostName = hostName;
+ this.hypervisorHostName = hypervisorHostName;
+ }
+
+ @Nullable
+ public String getInstanceName() {
+ return this.instanceName;
+ }
+
+ @Nullable
+ public String getHostName() {
+ return this.hostName;
+ }
+
+ @Nullable
+ public String getHypervisorHostName() {
+ return this.hypervisorHostName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(instanceName, hostName, hypervisorHostName);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ServerExtendedAttributes that = ServerExtendedAttributes.class.cast(obj);
+ return Objects.equal(this.instanceName, that.instanceName)
+ && Objects.equal(this.hostName, that.hostName)
+ && Objects.equal(this.hypervisorHostName, that.hypervisorHostName);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("instanceName", instanceName).add("hostName", hostName).add("hypervisorHostName", hypervisorHostName);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
new file mode 100644
index 0000000..33dcb75
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
@@ -0,0 +1,155 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Additional attributes delivered by Extended Server Status extension (alias "OS-EXT-STS")
+ *
+ * @author Adam Lowe
+ * @see <a href=
+ "http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_status.html"
+ />
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v1_1.extensions.ExtensionNamespaces#EXTENDED_STATUS (extended status?)
+*/
+public class ServerExtendedStatus {
+
+ public static String PREFIX;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromServerExtendedStatus(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String taskState;
+ protected String vmState;
+ protected int powerState;
+
+ /**
+ * @see ServerExtendedStatus#getTaskState()
+ */
+ public T taskState(String taskState) {
+ this.taskState = taskState;
+ return self();
+ }
+
+ /**
+ * @see ServerExtendedStatus#getVmState()
+ */
+ public T vmState(String vmState) {
+ this.vmState = vmState;
+ return self();
+ }
+
+ /**
+ * @see ServerExtendedStatus#getPowerState()
+ */
+ public T powerState(int powerState) {
+ this.powerState = powerState;
+ return self();
+ }
+
+ public ServerExtendedStatus build() {
+ return new ServerExtendedStatus(taskState, vmState, powerState);
+ }
+
+ public T fromServerExtendedStatus(ServerExtendedStatus in) {
+ return this
+ .taskState(in.getTaskState())
+ .vmState(in.getVmState())
+ .powerState(in.getPowerState());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("OS-EXT-STS:task_state")
+ private final String taskState;
+ @Named("OS-EXT-STS:vm_state")
+ private final String vmState;
+ @Named("OS-EXT-STS:power_state")
+ private final int powerState;
+
+ @ConstructorProperties({
+ "OS-EXT-STS:task_state", "OS-EXT-STS:vm_state", "OS-EXT-STS:power_state"
+ })
+ protected ServerExtendedStatus(@Nullable String taskState, @Nullable String vmState, int powerState) {
+ this.taskState = taskState;
+ this.vmState = vmState;
+ this.powerState = powerState;
+ }
+
+ @Nullable
+ public String getTaskState() {
+ return this.taskState;
+ }
+
+ @Nullable
+ public String getVmState() {
+ return this.vmState;
+ }
+
+ public int getPowerState() {
+ return this.powerState;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(taskState, vmState, powerState);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ServerExtendedStatus that = ServerExtendedStatus.class.cast(obj);
+ return Objects.equal(this.taskState, that.taskState)
+ && Objects.equal(this.vmState, that.vmState)
+ && Objects.equal(this.powerState, that.powerState);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("taskState", taskState).add("vmState", vmState).add("powerState", powerState);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
new file mode 100644
index 0000000..3d7a9b9
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
@@ -0,0 +1,128 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Multimap;
+
+/**
+ * Extended server returned by ServerWithSecurityGroupsApi
+ *
+ * @author Adam Lowe
+ * @see <a href=
+"http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
+/>
+*/
+public class ServerWithSecurityGroups extends Server {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromServerWithSecurityGroups(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Server.Builder<T> {
+ protected Set<String> securityGroupNames = ImmutableSet.of();
+
+ /**
+ * @see ServerWithSecurityGroups#getSecurityGroupNames()
+ */
+ public T securityGroupNames(Set<String> securityGroupNames) {
+ this.securityGroupNames = ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames"));
+ return self();
+ }
+
+ public T securityGroupNames(String... in) {
+ return securityGroupNames(ImmutableSet.copyOf(in));
+ }
+
+ public ServerWithSecurityGroups build() {
+ return new ServerWithSecurityGroups(id, name, links, uuid, tenantId, userId, updated, created, hostId,
+ accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses,
+ metadata, extendedStatus, extendedAttributes, diskConfig, securityGroupNames);
+ }
+
+ public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) {
+ return super.fromServer(in)
+ .securityGroupNames(in.getSecurityGroupNames());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("security_groups")
+ private final Set<String> securityGroupNames;
+
+ @ConstructorProperties({
+ "id", "name", "links", "uuid", "tenant_id", "user_id", "updated", "created", "hostId", "accessIPv4", "accessIPv6", "status", "image", "flavor", "key_name", "config_drive", "addresses", "metadata", "extendedStatus", "extendedAttributes", "OS-DCF:diskConfig", "security_groups"
+ })
+ protected ServerWithSecurityGroups(String id, @Nullable String name, Set<Link> links, @Nullable String uuid,
+ String tenantId, String userId, Date updated, Date created, @Nullable String hostId,
+ @Nullable String accessIPv4, @Nullable String accessIPv6, Server.Status status, Resource image,
+ Resource flavor, @Nullable String keyName, @Nullable String configDrive,
+ Multimap<String, Address> addresses, Map<String, String> metadata,
+ @Nullable ServerExtendedStatus extendedStatus, @Nullable ServerExtendedAttributes extendedAttributes,
+ @Nullable String diskConfig, Set<String> securityGroupNames) {
+ super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
+ this.securityGroupNames = ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames"));
+ }
+
+ public Set<String> getSecurityGroupNames() {
+ return this.securityGroupNames;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(securityGroupNames);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ServerWithSecurityGroups that = ServerWithSecurityGroups.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.securityGroupNames, that.securityGroupNames);
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("securityGroupNames", securityGroupNames);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
new file mode 100644
index 0000000..eba8531
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
@@ -0,0 +1,312 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Information the SimpleTenantUsage extension return data about each Server
+ *
+ * @author Adam Lowe
+*/
+public class SimpleServerUsage {
+
+ /**
+ */
+ public static enum Status {
+
+ UNRECOGNIZED, ACTIVE;
+
+ public String value() {
+ return name();
+ }
+
+ public static Status fromValue(String v) {
+ try {
+ return valueOf(v.toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSimpleServerUsage(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String instanceName;
+ protected double hours;
+ protected double flavorMemoryMb;
+ protected double flavorLocalGb;
+ protected double flavorVcpus;
+ protected String tenantId;
+ protected String flavorName;
+ protected Date instanceCreated;
+ protected Date instanceTerminated;
+ protected SimpleServerUsage.Status instanceStatus;
+ protected long uptime;
+
+ /**
+ * @see SimpleServerUsage#getInstanceName()
+ */
+ public T instanceName(String instanceName) {
+ this.instanceName = instanceName;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getHours()
+ */
+ public T hours(double hours) {
+ this.hours = hours;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getFlavorMemoryMb()
+ */
+ public T flavorMemoryMb(double flavorMemoryMb) {
+ this.flavorMemoryMb = flavorMemoryMb;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getFlavorLocalGb()
+ */
+ public T flavorLocalGb(double flavorLocalGb) {
+ this.flavorLocalGb = flavorLocalGb;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getFlavorVcpus()
+ */
+ public T flavorVcpus(double flavorVcpus) {
+ this.flavorVcpus = flavorVcpus;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getFlavorName()
+ */
+ public T flavorName(String flavorName) {
+ this.flavorName = flavorName;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getInstanceCreated()
+ */
+ public T instanceCreated(Date instanceCreated) {
+ this.instanceCreated = instanceCreated;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getInstanceTerminated()
+ */
+ public T instanceTerminated(Date instanceTerminated) {
+ this.instanceTerminated = instanceTerminated;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getInstanceStatus()
+ */
+ public T instanceStatus(SimpleServerUsage.Status instanceStatus) {
+ this.instanceStatus = instanceStatus;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getUptime()
+ */
+ public T uptime(long uptime) {
+ this.uptime = uptime;
+ return self();
+ }
+
+ public SimpleServerUsage build() {
+ return new SimpleServerUsage(instanceName, hours, flavorMemoryMb, flavorLocalGb, flavorVcpus, tenantId, flavorName, instanceCreated, instanceTerminated, instanceStatus, uptime);
+ }
+
+ public T fromSimpleServerUsage(SimpleServerUsage in) {
+ return this
+ .instanceName(in.getInstanceName())
+ .hours(in.getHours())
+ .flavorMemoryMb(in.getFlavorMemoryMb())
+ .flavorLocalGb(in.getFlavorLocalGb())
+ .flavorVcpus(in.getFlavorVcpus())
+ .tenantId(in.getTenantId())
+ .flavorName(in.getFlavorName())
+ .instanceCreated(in.getInstanceCreated())
+ .instanceTerminated(in.getInstanceTerminated())
+ .instanceStatus(in.getInstanceStatus())
+ .uptime(in.getUptime());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("name")
+ private final String instanceName;
+ private final double hours;
+ @Named("memory_mb")
+ private final double flavorMemoryMb;
+ @Named("local_gb")
+ private final double flavorLocalGb;
+ @Named("vcpus")
+ private final double flavorVcpus;
+ @Named("tenant_id")
+ private final String tenantId;
+ @Named("flavor")
+ private final String flavorName;
+ @Named("started_at")
+ private final Date instanceCreated;
+ @Named("ended_at")
+ private final Date instanceTerminated;
+ @Named("state")
+ private final SimpleServerUsage.Status instanceStatus;
+ private final long uptime;
+
+ @ConstructorProperties({
+ "name", "hours", "memory_mb", "local_gb", "vcpus", "tenant_id", "flavor", "started_at", "ended_at", "state", "uptime"
+ })
+ protected SimpleServerUsage(String instanceName, double hours, double flavorMemoryMb, double flavorLocalGb, double flavorVcpus, String tenantId, String flavorName, Date instanceCreated, @Nullable Date instanceTerminated, SimpleServerUsage.Status instanceStatus, long uptime) {
+ this.instanceName = checkNotNull(instanceName, "instanceName");
+ this.hours = hours;
+ this.flavorMemoryMb = flavorMemoryMb;
+ this.flavorLocalGb = flavorLocalGb;
+ this.flavorVcpus = flavorVcpus;
+ this.tenantId = checkNotNull(tenantId, "tenantId");
+ this.flavorName = checkNotNull(flavorName, "flavorName");
+ this.instanceCreated = checkNotNull(instanceCreated, "instanceCreated");
+ this.instanceTerminated = instanceTerminated;
+ this.instanceStatus = checkNotNull(instanceStatus, "instanceStatus");
+ this.uptime = uptime;
+ }
+
+ public String getInstanceName() {
+ return this.instanceName;
+ }
+
+ public double getHours() {
+ return this.hours;
+ }
+
+ public double getFlavorMemoryMb() {
+ return this.flavorMemoryMb;
+ }
+
+ public double getFlavorLocalGb() {
+ return this.flavorLocalGb;
+ }
+
+ public double getFlavorVcpus() {
+ return this.flavorVcpus;
+ }
+
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ public String getFlavorName() {
+ return this.flavorName;
+ }
+
+ public Date getInstanceCreated() {
+ return this.instanceCreated;
+ }
+
+ @Nullable
+ public Date getInstanceTerminated() {
+ return this.instanceTerminated;
+ }
+
+ public SimpleServerUsage.Status getInstanceStatus() {
+ return this.instanceStatus;
+ }
+
+ public long getUptime() {
+ return this.uptime;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(instanceName, hours, flavorMemoryMb, flavorLocalGb, flavorVcpus, tenantId, flavorName, instanceCreated, instanceTerminated, instanceStatus, uptime);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ SimpleServerUsage that = SimpleServerUsage.class.cast(obj);
+ return Objects.equal(this.instanceName, that.instanceName)
+ && Objects.equal(this.hours, that.hours)
+ && Objects.equal(this.flavorMemoryMb, that.flavorMemoryMb)
+ && Objects.equal(this.flavorLocalGb, that.flavorLocalGb)
+ && Objects.equal(this.flavorVcpus, that.flavorVcpus)
+ && Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.flavorName, that.flavorName)
+ && Objects.equal(this.instanceCreated, that.instanceCreated)
+ && Objects.equal(this.instanceTerminated, that.instanceTerminated)
+ && Objects.equal(this.instanceStatus, that.instanceStatus)
+ && Objects.equal(this.uptime, that.uptime);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("instanceName", instanceName).add("hours", hours).add("flavorMemoryMb", flavorMemoryMb).add("flavorLocalGb", flavorLocalGb).add("flavorVcpus", flavorVcpus).add("tenantId", tenantId).add("flavorName", flavorName).add("instanceCreated", instanceCreated).add("instanceTerminated", instanceTerminated).add("instanceStatus", instanceStatus).add("uptime", uptime);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
new file mode 100644
index 0000000..61cec18
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
@@ -0,0 +1,245 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Information the SimpleTenantUsage extension returns data about each tenant
+ *
+ * @author Adam Lowe
+*/
+public class SimpleTenantUsage {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSimpleTenantUsage(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String tenantId;
+ protected double totalLocalGbUsage;
+ protected double totalVcpusUsage;
+ protected double totalMemoryMbUsage;
+ protected double totalHours;
+ protected Date start;
+ protected Date stop;
+ protected Set<SimpleServerUsage> serverUsages = ImmutableSet.of();
+
+ /**
+ * @see SimpleTenantUsage#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getTotalLocalGbUsage()
+ */
+ public T totalLocalGbUsage(double totalLocalGbUsage) {
+ this.totalLocalGbUsage = totalLocalGbUsage;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getTotalVcpusUsage()
+ */
+ public T totalVcpusUsage(double totalVcpusUsage) {
+ this.totalVcpusUsage = totalVcpusUsage;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getTotalMemoryMbUsage()
+ */
+ public T totalMemoryMbUsage(double totalMemoryMbUsage) {
+ this.totalMemoryMbUsage = totalMemoryMbUsage;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getTotalHours()
+ */
+ public T totalHours(double totalHours) {
+ this.totalHours = totalHours;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getStart()
+ */
+ public T start(Date start) {
+ this.start = start;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getStop()
+ */
+ public T stop(Date stop) {
+ this.stop = stop;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getServerUsages()
+ */
+ public T serverUsages(Set<SimpleServerUsage> serverUsages) {
+ this.serverUsages = ImmutableSet.copyOf(checkNotNull(serverUsages, "serverUsages"));
+ return self();
+ }
+
+ public T serverUsages(SimpleServerUsage... in) {
+ return serverUsages(ImmutableSet.copyOf(in));
+ }
+
+ public SimpleTenantUsage build() {
+ return new SimpleTenantUsage(tenantId, totalLocalGbUsage, totalVcpusUsage, totalMemoryMbUsage, totalHours, start, stop, serverUsages);
+ }
+
+ public T fromSimpleTenantUsage(SimpleTenantUsage in) {
+ return this
+ .tenantId(in.getTenantId())
+ .totalLocalGbUsage(in.getTotalLocalGbUsage())
+ .totalVcpusUsage(in.getTotalVcpusUsage())
+ .totalMemoryMbUsage(in.getTotalMemoryMbUsage())
+ .totalHours(in.getTotalHours())
+ .start(in.getStart())
+ .stop(in.getStop())
+ .serverUsages(in.getServerUsages());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("tenant_id")
+ private final String tenantId;
+ @Named("total_local_gb_usage")
+ private final double totalLocalGbUsage;
+ @Named("total_vcpus_usage")
+ private final double totalVcpusUsage;
+ @Named("total_memory_mb_usage")
+ private final double totalMemoryMbUsage;
+ @Named("total_hours")
+ private final double totalHours;
+ private final Date start;
+ private final Date stop;
+ @Named("server_usages")
+ private final Set<SimpleServerUsage> serverUsages;
+
+ @ConstructorProperties({
+ "tenant_id", "total_local_gb_usage", "total_vcpus_usage", "total_memory_mb_usage", "total_hours", "start", "stop", "server_usages"
+ })
+ protected SimpleTenantUsage(String tenantId, double totalLocalGbUsage, double totalVcpusUsage, double totalMemoryMbUsage, double totalHours, @Nullable Date start, @Nullable Date stop, @Nullable Set<SimpleServerUsage> serverUsages) {
+ this.tenantId = checkNotNull(tenantId, "tenantId");
+ this.totalLocalGbUsage = totalLocalGbUsage;
+ this.totalVcpusUsage = totalVcpusUsage;
+ this.totalMemoryMbUsage = totalMemoryMbUsage;
+ this.totalHours = totalHours;
+ this.start = start;
+ this.stop = stop;
+ this.serverUsages = serverUsages == null ? ImmutableSet.<SimpleServerUsage>of() : ImmutableSet.copyOf(serverUsages);
+ }
+
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ public double getTotalLocalGbUsage() {
+ return this.totalLocalGbUsage;
+ }
+
+ public double getTotalVcpusUsage() {
+ return this.totalVcpusUsage;
+ }
+
+ public double getTotalMemoryMbUsage() {
+ return this.totalMemoryMbUsage;
+ }
+
+ public double getTotalHours() {
+ return this.totalHours;
+ }
+
+ @Nullable
+ public Date getStart() {
+ return this.start;
+ }
+
+ @Nullable
+ public Date getStop() {
+ return this.stop;
+ }
+
+ public Set<SimpleServerUsage> getServerUsages() {
+ return this.serverUsages;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(tenantId, totalLocalGbUsage, totalVcpusUsage, totalMemoryMbUsage, totalHours, start, stop, serverUsages);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ SimpleTenantUsage that = SimpleTenantUsage.class.cast(obj);
+ return Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.totalLocalGbUsage, that.totalLocalGbUsage)
+ && Objects.equal(this.totalVcpusUsage, that.totalVcpusUsage)
+ && Objects.equal(this.totalMemoryMbUsage, that.totalMemoryMbUsage)
+ && Objects.equal(this.totalHours, that.totalHours)
+ && Objects.equal(this.start, that.start)
+ && Objects.equal(this.stop, that.stop)
+ && Objects.equal(this.serverUsages, that.serverUsages);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("tenantId", tenantId).add("totalLocalGbUsage", totalLocalGbUsage).add("totalVcpusUsage", totalVcpusUsage).add("totalMemoryMbUsage", totalMemoryMbUsage).add("totalHours", totalHours).add("start", start).add("stop", stop).add("serverUsages", serverUsages);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
new file mode 100644
index 0000000..c90f40e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
@@ -0,0 +1,127 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Class TenantIdAndName
+ *
+ * @author Adrian Cole
+*/
+public class TenantIdAndName {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromTenantIdAndName(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String tenantId;
+ protected String name;
+
+ /**
+ * @see TenantIdAndName#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see TenantIdAndName#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ public TenantIdAndName build() {
+ return new TenantIdAndName(tenantId, name);
+ }
+
+ public T fromTenantIdAndName(TenantIdAndName in) {
+ return this
+ .tenantId(in.getTenantId())
+ .name(in.getName());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("tenant_id")
+ private final String tenantId;
+ private final String name;
+
+ @ConstructorProperties({
+ "tenant_id", "name"
+ })
+ protected TenantIdAndName(String tenantId, String name) {
+ this.tenantId = checkNotNull(tenantId, "tenantId");
+ this.name = checkNotNull(name, "name");
+ }
+
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(tenantId, name);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ TenantIdAndName that = TenantIdAndName.class.cast(obj);
+ return Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.name, that.name);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("tenantId", tenantId).add("name", name);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
new file mode 100644
index 0000000..b77f242
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
@@ -0,0 +1,128 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Represents a Virtual Interface (VIF)
+ *
+ * @author Adam Lowe
+ * @see org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi
+*/
+public class VirtualInterface {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromVirtualInterface(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String macAddress;
+
+ /**
+ * @see VirtualInterface#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see VirtualInterface#getMacAddress()
+ */
+ public T macAddress(String macAddress) {
+ this.macAddress = macAddress;
+ return self();
+ }
+
+ public VirtualInterface build() {
+ return new VirtualInterface(id, macAddress);
+ }
+
+ public T fromVirtualInterface(VirtualInterface in) {
+ return this
+ .id(in.getId())
+ .macAddress(in.getMacAddress());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ @Named("mac_address")
+ private final String macAddress;
+
+ @ConstructorProperties({
+ "id", "mac_address"
+ })
+ protected VirtualInterface(String id, String macAddress) {
+ this.id = checkNotNull(id, "id");
+ this.macAddress = checkNotNull(macAddress, "macAddress");
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getMacAddress() {
+ return this.macAddress;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, macAddress);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ VirtualInterface that = VirtualInterface.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.macAddress, that.macAddress);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("macAddress", macAddress);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
new file mode 100644
index 0000000..7fecfb2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
@@ -0,0 +1,346 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.CaseFormat;
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * An OpenStack Nova Volume
+*/
+public class Volume {
+
+ /**
+ */
+ public static enum Status {
+ CREATING, AVAILABLE, IN_USE, DELETING, ERROR, UNRECOGNIZED;
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static Status fromValue(String status) {
+ try {
+ return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(status, "status")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromVolume(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected Volume.Status status;
+ protected int size;
+ protected String zone;
+ protected Date created;
+ protected Set<VolumeAttachment> attachments = ImmutableSet.of();
+ protected String volumeType;
+ protected String snapshotId;
+ protected String name;
+ protected String description;
+ protected Map<String, String> metadata = ImmutableMap.of();
+
+ /**
+ * @see Volume#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see Volume#getStatus()
+ */
+ public T status(Volume.Status status) {
+ this.status = status;
+ return self();
+ }
+
+ /**
+ * @see Volume#getSize()
+ */
+ public T size(int size) {
+ this.size = size;
+ return self();
+ }
+
+ /**
+ * @see Volume#getZone()
+ */
+ public T zone(String zone) {
+ this.zone = zone;
+ return self();
+ }
+
+ /**
+ * @see Volume#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see Volume#getAttachments()
+ */
+ public T attachments(Set<VolumeAttachment> attachments) {
+ this.attachments = ImmutableSet.copyOf(checkNotNull(attachments, "attachments"));
+ return self();
+ }
+
+ public T attachments(VolumeAttachment... in) {
+ return attachments(ImmutableSet.copyOf(in));
+ }
+
+ /**
+ * @see Volume#getVolumeType()
+ */
+ public T volumeType(String volumeType) {
+ this.volumeType = volumeType;
+ return self();
+ }
+
+ /**
+ * @see Volume#getSnapshotId()
+ */
+ public T snapshotId(String snapshotId) {
+ this.snapshotId = snapshotId;
+ return self();
+ }
+
+ /**
+ * @see Volume#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see Volume#getDescription()
+ */
+ public T description(String description) {
+ this.description = description;
+ return self();
+ }
+
+ /**
+ * @see Volume#getMetadata()
+ */
+ public T metadata(Map<String, String> metadata) {
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ return self();
+ }
+
+ public Volume build() {
+ return new Volume(id, status, size, zone, created, attachments, volumeType, snapshotId, name, description, metadata);
+ }
+
+ public T fromVolume(Volume in) {
+ return this
+ .id(in.getId())
+ .status(in.getStatus())
+ .size(in.getSize())
+ .zone(in.getZone())
+ .created(in.getCreated())
+ .attachments(in.getAttachments())
+ .volumeType(in.getVolumeType())
+ .snapshotId(in.getSnapshotId())
+ .name(in.getName())
+ .description(in.getDescription())
+ .metadata(in.getMetadata());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final Volume.Status status;
+ private final int size;
+ @Named("availabilityZone")
+ private final String zone;
+ @Named("createdAt")
+ private final Date created;
+ private final Set<VolumeAttachment> attachments;
+ private final String volumeType;
+ private final String snapshotId;
+ @Named("displayName")
+ private final String name;
+ @Named("displayDescription")
+ private final String description;
+ private final Map<String, String> metadata;
+
+ @ConstructorProperties({
+ "id", "status", "size", "availabilityZone", "createdAt", "attachments", "volumeType", "snapshotId", "displayName", "displayDescription", "metadata"
+ })
+ protected Volume(String id, Volume.Status status, int size, String zone, Date created, @Nullable Set<VolumeAttachment> attachments, @Nullable String volumeType, @Nullable String snapshotId, @Nullable String name, @Nullable String description, @Nullable Map<String, String> metadata) {
+ this.id = checkNotNull(id, "id");
+ this.status = checkNotNull(status, "status");
+ this.size = size;
+ this.zone = checkNotNull(zone, "zone");
+ this.created = checkNotNull(created, "created");
+ this.attachments = attachments == null ? ImmutableSet.<VolumeAttachment>of() : ImmutableSet.copyOf(attachments);
+ this.volumeType = volumeType;
+ this.snapshotId = snapshotId;
+ this.name = name;
+ this.description = description;
+ this.metadata = metadata == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(metadata);
+ }
+
+ /**
+ * @return the id of this volume
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * @return the status of this volume
+ */
+ public Volume.Status getStatus() {
+ return this.status;
+ }
+
+ /**
+ * @return the size in GB of this volume
+ */
+ public int getSize() {
+ return this.size;
+ }
+
+ /**
+ * @return the availabilityZone containing this volume
+ */
+ public String getZone() {
+ return this.zone;
+ }
+
+ /**
+ * @return the time this volume was created
+ */
+ public Date getCreated() {
+ return this.created;
+ }
+
+ /**
+ * @return the set of attachments (to Servers)
+ */
+ public Set<VolumeAttachment> getAttachments() {
+ return this.attachments;
+ }
+
+ /**
+ * @return the type of this volume
+ */
+ @Nullable
+ public String getVolumeType() {
+ return this.volumeType;
+ }
+
+ @Nullable
+ public String getSnapshotId() {
+ return this.snapshotId;
+ }
+
+ /**
+ * @return the name of this volume - as displayed in the openstack console
+ */
+ @Nullable
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the description of this volume - as displayed in the openstack console
+ */
+ @Nullable
+ public String getDescription() {
+ return this.description;
+ }
+
+ public Map<String, String> getMetadata() {
+ return this.metadata;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, status, size, zone, created, attachments, volumeType, snapshotId, name, description, metadata);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Volume that = Volume.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.status, that.status)
+ && Objects.equal(this.size, that.size)
+ && Objects.equal(this.zone, that.zone)
+ && Objects.equal(this.created, that.created)
+ && Objects.equal(this.attachments, that.attachments)
+ && Objects.equal(this.volumeType, that.volumeType)
+ && Objects.equal(this.snapshotId, that.snapshotId)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.description, that.description)
+ && Objects.equal(this.metadata, that.metadata);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("status", status).add("size", size).add("zone", zone).add("created", created).add("attachments", attachments).add("volumeType", volumeType).add("snapshotId", snapshotId).add("name", name).add("description", description).add("metadata", metadata);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
new file mode 100644
index 0000000..894f85b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
@@ -0,0 +1,172 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * An OpenStack Nova Volume Attachment (describes how Volumes are attached to Servers)
+*/
+public class VolumeAttachment {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromVolumeAttachment(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String volumeId;
+ protected String serverId;
+ protected String device;
+
+ /**
+ * @see VolumeAttachment#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see VolumeAttachment#getVolumeId()
+ */
+ public T volumeId(String volumeId) {
+ this.volumeId = volumeId;
+ return self();
+ }
+
+ /**
+ * @see VolumeAttachment#getServerId()
+ */
+ public T serverId(String serverId) {
+ this.serverId = serverId;
+ return self();
+ }
+
+ /**
+ * @see VolumeAttachment#getDevice()
+ */
+ public T device(String device) {
+ this.device = device;
+ return self();
+ }
+
+ public VolumeAttachment build() {
+ return new VolumeAttachment(id, volumeId, serverId, device);
+ }
+
+ public T fromVolumeAttachment(VolumeAttachment in) {
+ return this
+ .id(in.getId())
+ .volumeId(in.getVolumeId())
+ .serverId(in.getServerId())
+ .device(in.getDevice());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final String volumeId;
+ private final String serverId;
+ private final String device;
+
+ @ConstructorProperties({
+ "id", "volumeId", "serverId", "device"
+ })
+ protected VolumeAttachment(String id, String volumeId, @Nullable String serverId, @Nullable String device) {
+ this.id = checkNotNull(id, "id");
+ this.volumeId = checkNotNull(volumeId, "volumeId");
+ this.serverId = serverId;
+ this.device = device;
+ }
+
+ /**
+ * @return the attachment id (typically the same as #getVolumeId())
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * @return the id of the volume attached
+ */
+ public String getVolumeId() {
+ return this.volumeId;
+ }
+
+ /**
+ * @return the id of the server the volume is attached to
+ */
+ @Nullable
+ public String getServerId() {
+ return this.serverId;
+ }
+
+ /**
+ * @return the device name (e.g. "/dev/vdc")
+ */
+ @Nullable
+ public String getDevice() {
+ return this.device;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, volumeId, serverId, device);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ VolumeAttachment that = VolumeAttachment.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.volumeId, that.volumeId)
+ && Objects.equal(this.serverId, that.serverId)
+ && Objects.equal(this.device, that.device);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("volumeId", volumeId).add("serverId", serverId).add("device", device);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeSnapshot.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeSnapshot.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeSnapshot.java
new file mode 100644
index 0000000..bbd45a4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeSnapshot.java
@@ -0,0 +1,239 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * An OpenStack Nova Volume Snapshot
+*/
+public class VolumeSnapshot {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromVolumeSnapshot(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String volumeId;
+ protected Volume.Status status;
+ protected int size;
+ protected Date created;
+ protected String name;
+ protected String description;
+
+ /**
+ * @see VolumeSnapshot#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see VolumeSnapshot#getVolumeId()
+ */
+ public T volumeId(String volumeId) {
+ this.volumeId = volumeId;
+ return self();
+ }
+
+ /**
+ * @see VolumeSnapshot#getStatus()
+ */
+ public T status(Volume.Status status) {
+ this.status = status;
+ return self();
+ }
+
+ /**
+ * @see VolumeSnapshot#getSize()
+ */
+ public T size(int size) {
+ this.size = size;
+ return self();
+ }
+
+ /**
+ * @see VolumeSnapshot#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see VolumeSnapshot#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see VolumeSnapshot#getDescription()
+ */
+ public T description(String description) {
+ this.description = description;
+ return self();
+ }
+
+ public VolumeSnapshot build() {
+ return new VolumeSnapshot(id, volumeId, status, size, created, name, description);
+ }
+
+ public T fromVolumeSnapshot(VolumeSnapshot in) {
+ return this
+ .id(in.getId())
+ .volumeId(in.getVolumeId())
+ .status(in.getStatus())
+ .size(in.getSize())
+ .created(in.getCreated())
+ .name(in.getName())
+ .description(in.getDescription());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final String volumeId;
+ private final Volume.Status status;
+ private final int size;
+ @Named("createdAt")
+ private final Date created;
+ @Named("displayName")
+ private final String name;
+ @Named("displayDescription")
+ private final String description;
+
+ @ConstructorProperties({
+ "id", "volumeId", "status", "size", "createdAt", "displayName", "displayDescription"
+ })
+ protected VolumeSnapshot(String id, String volumeId, Volume.Status status, int size, @Nullable Date created, @Nullable String name, @Nullable String description) {
+ this.id = checkNotNull(id, "id");
+ this.volumeId = checkNotNull(volumeId, "volumeId");
+ this.status = checkNotNull(status, "status");
+ this.size = size;
+ this.created = created;
+ this.name = name;
+ this.description = description;
+ }
+
+ /**
+ * @return the id of this snapshot
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * @return the id of the Volume this snapshot was taken from
+ */
+ public String getVolumeId() {
+ return this.volumeId;
+ }
+
+ /**
+ * @return the status of this snapshot
+ */
+ public Volume.Status getStatus() {
+ return this.status;
+ }
+
+ /**
+ * @return the size in GB of the volume this snapshot was taken from
+ */
+ public int getSize() {
+ return this.size;
+ }
+
+ /**
+ * @return the data the snapshot was taken
+ */
+ @Nullable
+ public Date getCreated() {
+ return this.created;
+ }
+
+ /**
+ * @return the name of this snapshot - as displayed in the openstack console
+ */
+ @Nullable
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the description of this snapshot - as displayed in the openstack console
+ */
+ @Nullable
+ public String getDescription() {
+ return this.description;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, volumeId, status, size, created, name, description);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ VolumeSnapshot that = VolumeSnapshot.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.volumeId, that.volumeId)
+ && Objects.equal(this.status, that.status)
+ && Objects.equal(this.size, that.size)
+ && Objects.equal(this.created, that.created)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.description, that.description);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("volumeId", volumeId).add("status", status).add("size", size).add("created", created).add("name", name).add("description", description);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeType.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeType.java
new file mode 100644
index 0000000..43a0aba
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeType.java
@@ -0,0 +1,192 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Volume Type used in the Volume Type Extension for Nova
+ *
+ * @see org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi
+*/
+public class VolumeType {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromVolumeType(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String name;
+ protected Date created;
+ protected Date updated;
+ protected Map<String, String> extraSpecs = ImmutableMap.of();
+
+ /**
+ * @see VolumeType#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see VolumeType#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see VolumeType#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see VolumeType#getUpdated()
+ */
+ public T updated(Date updated) {
+ this.updated = updated;
+ return self();
+ }
+
+ /**
+ * @see VolumeType#getExtraSpecs()
+ */
+ public T extraSpecs(Map<String, String> extraSpecs) {
+ this.extraSpecs = ImmutableMap.copyOf(checkNotNull(extraSpecs, "extraSpecs"));
+ return self();
+ }
+
+ public VolumeType build() {
+ return new VolumeType(id, name, created, updated, extraSpecs);
+ }
+
+ public T fromVolumeType(VolumeType in) {
+ return this
+ .id(in.getId())
+ .name(in.getName())
+ .created(in.getCreated())
+ .updated(in.getUpdated().orNull())
+ .extraSpecs(in.getExtraSpecs());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final String name;
+ @Named("created_at")
+ private final Date created;
+ @Named("updated_at")
+ private final Optional<Date> updated;
+ @Named("extra_specs")
+ private final Map<String, String> extraSpecs;
+
+ @ConstructorProperties({
+ "id", "name", "created_at", "updated_at", "extra_specs"
+ })
+ protected VolumeType(String id, String name, Date created, @Nullable Date updated, Map<String, String> extraSpecs) {
+ this.id = checkNotNull(id, "id");
+ this.name = checkNotNull(name, "name");
+ this.created = checkNotNull(created, "created");
+ this.updated = Optional.fromNullable(updated);
+ this.extraSpecs = ImmutableMap.copyOf(checkNotNull(extraSpecs, "extraSpecs"));
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * The Date the VolumeType was created
+ */
+ public Date getCreated() {
+ return this.created;
+ }
+
+ /**
+ * The Date the VolumeType as last updated - absent if no updates have taken place
+ */
+ public Optional<Date> getUpdated() {
+ return this.updated;
+ }
+
+ public Map<String, String> getExtraSpecs() {
+ return this.extraSpecs;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, name, created, updated, extraSpecs);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ VolumeType that = VolumeType.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.created, that.created)
+ && Objects.equal(this.updated, that.updated)
+ && Objects.equal(this.extraSpecs, that.extraSpecs);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("name", name).add("created", created).add("updated", updated).add("extraSpecs", extraSpecs);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
new file mode 100644
index 0000000..6946961
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.domain.zonescoped;
+
+import com.google.common.base.Objects;
+import com.google.gson.annotations.SerializedName;
+
+import java.beans.ConstructorProperties;
+
+/**
+ * @author Inbar Stolberg
+ */
+public class AvailabilityZone {
+
+ @SerializedName("zoneName")
+ private final String name;
+ private final ZoneState state;
+
+ @ConstructorProperties({"zoneName" , "zoneState"})
+ protected AvailabilityZone(String name, ZoneState state) {
+ this.name = name;
+ this.state = state;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ZoneState getState() {
+ return state;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, state);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this != obj) return false;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ AvailabilityZone that = AvailabilityZone.class.cast(obj);
+ return Objects.equal(this.name, that.name) && Objects.equal(this.state, that.state);
+ }
+
+ protected Objects.ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("name", name)
+ .add("state", state);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/FlavorInZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/FlavorInZone.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/FlavorInZone.java
new file mode 100644
index 0000000..5836ac2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/FlavorInZone.java
@@ -0,0 +1,46 @@
+/*
+ * 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.openstack.nova.v2_0.domain.zonescoped;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+
+/**
+ * @author Adrian Cole
+ */
+public class FlavorInZone extends ZoneAndId {
+ protected final Flavor image;
+
+ public FlavorInZone(Flavor image, String zoneId) {
+ super(zoneId, checkNotNull(image, "image").getId());
+ this.image = image;
+ }
+
+ public Flavor getFlavor() {
+ return image;
+ }
+
+ // superclass hashCode/equals are good enough, and help us use ZoneAndId and FlavorInZone
+ // interchangeably as Map keys
+
+ @Override
+ public String toString() {
+ return "[image=" + image + ", zoneId=" + zoneId + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ImageInZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ImageInZone.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ImageInZone.java
new file mode 100644
index 0000000..b7d03f4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ImageInZone.java
@@ -0,0 +1,46 @@
+/*
+ * 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.openstack.nova.v2_0.domain.zonescoped;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+
+/**
+ * @author Adrian Cole
+ */
+public class ImageInZone extends ZoneAndId {
+ protected final Image image;
+
+ public ImageInZone(Image image, String zoneId) {
+ super(zoneId, checkNotNull(image, "image").getId());
+ this.image = image;
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ // superclass hashCode/equals are good enough, and help us use ZoneAndId and ImageInZone
+ // interchangeably as Map keys
+
+ @Override
+ public String toString() {
+ return "[image=" + image + ", zoneId=" + zoneId + "]";
+ }
+
+}
[03/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardwareTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardwareTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardwareTest.java
deleted file mode 100644
index b3a0e30..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/FlavorInZoneToHardwareTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Map;
-import java.util.UUID;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.openstack.nova.v2_0.domain.Flavor;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.FlavorInZone;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Tests the function used to transform Flavor objects into Hardware objects
- *
- * @author Matt Stephenson, Adrian Cole
- */
-@Test(testName = "FlavorInZoneToHardwareTest")
-public class FlavorInZoneToHardwareTest {
- Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova").description(
- "openstack-nova").build();
- Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1").scope(
- LocationScope.ZONE).parent(provider).build();
- Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
- .<String, Location> of("az-1.region-a.geo-1", zone));
-
- @Test
- public void testConversionWhereLocationFound() {
-
- UUID id = UUID.randomUUID();
-
- FlavorInZone flavorInZoneToConvert = new FlavorInZone(Flavor.builder().id(id.toString())
- .name("Test Flavor " + id).ram(262144).disk(10000).vcpus(16).build(), "az-1.region-a.geo-1");
-
- Hardware converted = new FlavorInZoneToHardware(locationIndex).apply(flavorInZoneToConvert);
-
- Flavor flavorToConvert = flavorInZoneToConvert.getFlavor();
- assertEquals(converted.getName(), flavorToConvert.getName());
- assertEquals(converted.getId(), flavorInZoneToConvert.slashEncode());
- assertEquals(converted.getProviderId(), flavorToConvert.getId());
- assertEquals(converted.getLocation(), locationIndex.get().get("az-1.region-a.geo-1"));
-
- assertEquals(converted.getRam(), flavorToConvert.getRam());
-
- assertNotNull(converted.getProcessors());
- assertFalse(converted.getProcessors().isEmpty());
- assertEquals(converted.getProcessors().iterator().next().getCores(), (double) flavorToConvert.getVcpus());
-
- assertNotNull(converted.getVolumes());
- assertFalse(converted.getVolumes().isEmpty());
- assertEquals(converted.getVolumes().iterator().next().getSize(), Float.valueOf(flavorToConvert.getDisk()));
-
- }
-
- @Test(expectedExceptions = IllegalStateException.class)
- public void testConversionWhereLocationNotFound() {
-
- UUID id = UUID.randomUUID();
-
- FlavorInZone flavorInZoneToConvert = new FlavorInZone(Flavor.builder().id(id.toString())
- .name("Test Flavor " + id).ram(262144).disk(10000).vcpus(16).build(), "South");
- new FlavorInZoneToHardware(locationIndex).apply(flavorInZoneToConvert);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImageTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImageTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImageTest.java
deleted file mode 100644
index dfc15f4..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageInZoneToImageTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Map;
-import java.util.UUID;
-
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextModule;
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Tests the function that transforms nova-specific images to generic images.
- *
- * @author Matt Stephenson, Adrian Cole
- */
-@Test(testName = "ImageInZoneToHardwareTest")
-public class ImageInZoneToImageTest {
-
- Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova").description(
- "openstack-nova").build();
- Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1").scope(
- LocationScope.ZONE).parent(provider).build();
- Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
- .<String, Location> of("az-1.region-a.geo-1", zone));
-
- @Test
- public void testConversionWhereLocationFound() {
- UUID id = UUID.randomUUID();
- Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).status(Image.Status.DELETED).build();
- OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86",
- "My Test OS", true);
- ImageInZoneToImage converter = new ImageInZoneToImage(NovaComputeServiceContextModule.toPortableImageStatus,
- constant(operatingSystem), locationIndex);
-
- ImageInZone novaImageInZoneToConvert = new ImageInZone(novaImageToConvert, "az-1.region-a.geo-1");
-
- org.jclouds.compute.domain.Image convertedImage = converter.apply(novaImageInZoneToConvert);
-
- assertEquals(convertedImage.getId(), novaImageInZoneToConvert.slashEncode());
- assertEquals(convertedImage.getProviderId(), novaImageToConvert.getId());
- assertEquals(convertedImage.getLocation(), locationIndex.get().get("az-1.region-a.geo-1"));
-
- assertEquals(convertedImage.getName(), novaImageToConvert.getName());
- assertEquals(convertedImage.getStatus(), org.jclouds.compute.domain.Image.Status.DELETED);
- assertEquals(convertedImage.getOperatingSystem(), operatingSystem);
- }
-
- @Test(expectedExceptions = IllegalStateException.class)
- public void testConversionWhereLocationNotFound() {
- UUID id = UUID.randomUUID();
- Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).build();
- OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86",
- "My Test OS", true);
- ImageInZoneToImage converter = new ImageInZoneToImage(NovaComputeServiceContextModule.toPortableImageStatus,
- constant(operatingSystem), locationIndex);
-
- ImageInZone novaImageInZoneToConvert = new ImageInZone(novaImageToConvert, "South");
-
- converter.apply(novaImageInZoneToConvert);
- }
-
- @SuppressWarnings("unchecked")
- private static Function<Image, OperatingSystem> constant(OperatingSystem operatingSystem) {
- return Function.class.cast(Functions.constant(operatingSystem));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystemTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystemTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystemTest.java
deleted file mode 100644
index 2fdc0a4..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ImageToOperatingSystemTest.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-
-/**
- * Tests for the function for transforming a nova specific Image into a generic
- * OperatingSystem object.
- *
- * @author Matt Stephenson
- */
-public class ImageToOperatingSystemTest {
-
- @Test(dataProvider = "getOsFamilyValues")
- public void testOsFamilyValues(OsFamily family) {
-
- Image imageToConvert = Image.builder().id("id-" + family.name()).name(family.name()).build();
-
- ImageToOperatingSystem converter = new ImageToOperatingSystem(
- new HashMap<OsFamily, Map<String, String>>());
-
- OperatingSystem convertedOs = converter.apply(imageToConvert);
-
- assertEquals(convertedOs.getName(), imageToConvert.getName());
- assertEquals(convertedOs.getFamily(), family);
- assertEquals(convertedOs.getDescription(), imageToConvert.getName());
- assertEquals(convertedOs.getVersion(), null);
- assertEquals(convertedOs.getArch(), null);
- assertTrue(convertedOs.is64Bit());
- }
-
- @DataProvider
- public Object[][] getOsFamilyValues() {
- return Iterables.toArray(
- Iterables.transform(Arrays.asList(OsFamily.values()), new Function<OsFamily, Object[]>() {
- @Override
- public Object[] apply(OsFamily osFamily) {
- return new Object[] { osFamily };
- }
- }), Object[].class);
- }
-
- @Test
- public void testWindowsServer2008R2x64() {
- String name = "Windows Server 2008 R2 x64";
-
- Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
-
- Map<OsFamily, Map<String, String>> osFamilyMap = Maps.newHashMap();
- osFamilyMap.put(OsFamily.WINDOWS, ImmutableMap.of("Server 2008 R2", "Server-2008-R2"));
-
- ImageToOperatingSystem converter = new ImageToOperatingSystem(osFamilyMap);
-
- OperatingSystem convertedOs = converter.apply(imageToConvert);
-
- assertEquals(convertedOs.getName(), imageToConvert.getName());
- assertEquals(convertedOs.getFamily(), OsFamily.WINDOWS);
- assertEquals(convertedOs.getDescription(), imageToConvert.getName());
- assertEquals(convertedOs.getVersion(), "Server-2008-R2");
- assertEquals(convertedOs.getArch(), null);
- assertTrue(convertedOs.is64Bit());
- }
-
- @Test
- public void testWindows98x86() {
- String name = "Windows 98 x86";
-
- Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
-
- Map<OsFamily, Map<String, String>> osFamilyMap = Maps.newHashMap();
- osFamilyMap.put(OsFamily.WINDOWS, ImmutableMap.of("98", "98"));
-
- ImageToOperatingSystem converter = new ImageToOperatingSystem(osFamilyMap);
-
- OperatingSystem convertedOs = converter.apply(imageToConvert);
-
- assertEquals(convertedOs.getName(), imageToConvert.getName());
- assertEquals(convertedOs.getFamily(), OsFamily.WINDOWS);
- assertEquals(convertedOs.getDescription(), imageToConvert.getName());
- assertEquals(convertedOs.getVersion(), "98");
- assertEquals(convertedOs.getArch(), null);
- assertFalse(convertedOs.is64Bit());
- }
-
- @Test
- public void testRHEL() {
- String name = "Red Hat EL";
-
- Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
-
- ImageToOperatingSystem converter = new ImageToOperatingSystem(
- new HashMap<OsFamily, Map<String, String>>());
-
- OperatingSystem convertedOs = converter.apply(imageToConvert);
-
- assertEquals(convertedOs.getName(), imageToConvert.getName());
- assertEquals(convertedOs.getFamily(), OsFamily.RHEL);
- assertEquals(convertedOs.getDescription(), imageToConvert.getName());
- assertEquals(convertedOs.getVersion(), null);
- assertEquals(convertedOs.getArch(), null);
- assertTrue(convertedOs.is64Bit());
- }
-
- @Test
- public void testOEL() {
- String name = "Oracle EL";
-
- Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
-
- ImageToOperatingSystem converter = new ImageToOperatingSystem(
- new HashMap<OsFamily, Map<String, String>>());
-
- OperatingSystem convertedOs = converter.apply(imageToConvert);
-
- assertEquals(convertedOs.getName(), imageToConvert.getName());
- assertEquals(convertedOs.getFamily(), OsFamily.OEL);
- assertEquals(convertedOs.getDescription(), imageToConvert.getName());
- assertEquals(convertedOs.getVersion(), null);
- assertEquals(convertedOs.getArch(), null);
- assertTrue(convertedOs.is64Bit());
- }
-
-
- ImageToOperatingSystem converterForUbuntu = new ImageToOperatingSystem(ImmutableMap.<OsFamily, Map<String, String>> of(
- OsFamily.UBUNTU, ImmutableMap.of("lucid", "10.04", "maverick", "10.10", "natty", "11.04", "oneiric",
- "11.10")));
- @Test
- public void testTryStackOneric() {
-
- String name = "oneiric-server-cloudimg-amd64";
-
- Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
-
- OperatingSystem convertedOs = converterForUbuntu.apply(imageToConvert);
-
- assertEquals(convertedOs.getName(), imageToConvert.getName());
- assertEquals(convertedOs.getFamily(), OsFamily.UBUNTU);
- assertEquals(convertedOs.getDescription(), imageToConvert.getName());
- assertEquals(convertedOs.getVersion(), "11.10");
- assertEquals(convertedOs.getArch(), null);
- assertTrue(convertedOs.is64Bit());
- }
-
- @Test
- public void testTryStackNatty() {
-
- String name = "natty-server-cloudimg-amd64";
-
- Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
-
- OperatingSystem convertedOs = converterForUbuntu.apply(imageToConvert);
-
- assertEquals(convertedOs.getName(), imageToConvert.getName());
- assertEquals(convertedOs.getFamily(), OsFamily.UBUNTU);
- assertEquals(convertedOs.getDescription(), imageToConvert.getName());
- assertEquals(convertedOs.getVersion(), "11.04");
- assertEquals(convertedOs.getArch(), null);
- assertTrue(convertedOs.is64Bit());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroupTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroupTest.java
deleted file mode 100644
index c884987..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupInZoneToSecurityGroupTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.openstack.nova.v2_0.compute.functions.NovaSecurityGroupToSecurityGroupTest.securityGroupWithCidr;
-import static org.jclouds.openstack.nova.v2_0.compute.functions.NovaSecurityGroupToSecurityGroupTest.securityGroupWithGroup;
-import static org.testng.Assert.assertEquals;
-
-import java.util.Map;
-
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * @author Andrew Bayer
- */
-@Test(groups = "unit", testName = "NovaSecurityGroupInZoneToSecurityGroupTest")
-public class NovaSecurityGroupInZoneToSecurityGroupTest {
-
- Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova")
- .description("openstack-nova").build();
- Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1")
- .scope(LocationScope.ZONE).parent(provider).build();
- Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
- .<String, Location>of("az-1.region-a.geo-1", zone));
-
-
- @Test
- public void testApplyWithGroup() {
- NovaSecurityGroupInZoneToSecurityGroup parser = createGroupParser();
-
- SecurityGroupInZone origGroup = new SecurityGroupInZone(securityGroupWithGroup(), zone.getId());
-
- SecurityGroup newGroup = parser.apply(origGroup);
-
- assertEquals(newGroup.getId(), origGroup.getZone() + "/" + origGroup.getSecurityGroup().getId());
- assertEquals(newGroup.getProviderId(), origGroup.getSecurityGroup().getId());
- assertEquals(newGroup.getName(), origGroup.getSecurityGroup().getName());
- assertEquals(newGroup.getOwnerId(), origGroup.getSecurityGroup().getTenantId());
- assertEquals(newGroup.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getSecurityGroup().getRules(),
- NovaSecurityGroupToSecurityGroupTest.ruleConverter)));
- assertEquals(newGroup.getLocation().getId(), origGroup.getZone());
- }
-
- @Test
- public void testApplyWithCidr() {
-
- NovaSecurityGroupInZoneToSecurityGroup parser = createGroupParser();
-
- SecurityGroupInZone origGroup = new SecurityGroupInZone(securityGroupWithCidr(), zone.getId());
-
- SecurityGroup newGroup = parser.apply(origGroup);
-
- assertEquals(newGroup.getId(), origGroup.getZone() + "/" + origGroup.getSecurityGroup().getId());
- assertEquals(newGroup.getProviderId(), origGroup.getSecurityGroup().getId());
- assertEquals(newGroup.getName(), origGroup.getSecurityGroup().getName());
- assertEquals(newGroup.getOwnerId(), origGroup.getSecurityGroup().getTenantId());
- assertEquals(newGroup.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getSecurityGroup().getRules(),
- NovaSecurityGroupToSecurityGroupTest.ruleConverter)));
- assertEquals(newGroup.getLocation().getId(), origGroup.getZone());
- }
-
- private NovaSecurityGroupInZoneToSecurityGroup createGroupParser() {
- NovaSecurityGroupToSecurityGroup baseParser = new NovaSecurityGroupToSecurityGroup(NovaSecurityGroupToSecurityGroupTest.ruleConverter);
-
- NovaSecurityGroupInZoneToSecurityGroup parser = new NovaSecurityGroupInZoneToSecurityGroup(baseParser, locationIndex);
-
- return parser;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroupTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroupTest.java
deleted file mode 100644
index 6754087..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/NovaSecurityGroupToSecurityGroupTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static com.google.common.collect.Iterables.transform;
-import static org.testng.Assert.assertEquals;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.net.domain.IpProtocol;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-import org.jclouds.openstack.nova.v2_0.domain.TenantIdAndName;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Functions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * @author Andrew Bayer
- */
-@Test(groups = "unit", testName = "NovaSecurityGroupToSecurityGroupTest")
-public class NovaSecurityGroupToSecurityGroupTest {
-
- private static final Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova")
- .description("openstack-nova").build();
- private static final Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1")
- .scope(LocationScope.ZONE).parent(provider).build();
- private static final Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
- .<String, Location>of("az-1.region-a.geo-1", zone));
-
-
- private static final Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = Predicates.alwaysTrue();
-
- private static final Map<ZoneAndName, SecurityGroupInZone> groupMap = ImmutableMap.of(
- ZoneAndName.fromZoneAndName("az-1.region-a.geo-1", "some-group"), new SecurityGroupInZone(securityGroupWithGroup(), "az-1.region-a.geo-1"),
- ZoneAndName.fromZoneAndName("az-1.region-a.geo-1", "some-other-group"), new SecurityGroupInZone(securityGroupWithCidr(), "az-1.region-a.geo-1"));
-
- // weird compilation error means have to declare extra generics for call to build() - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818
- private static final Supplier <LoadingCache<ZoneAndName, SecurityGroupInZone>> groupCache = Suppliers.<LoadingCache<ZoneAndName,SecurityGroupInZone>> ofInstance(
- CacheBuilder.newBuilder().<ZoneAndName, SecurityGroupInZone>build(CacheLoader.from(Functions.forMap(groupMap))));
-
- public static final SecurityGroupRuleToIpPermission ruleConverter = new SecurityGroupRuleToIpPermission(returnSecurityGroupExistsInZone, locationIndex,
- groupCache.get());
-
- public static org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroupWithGroup() {
- TenantIdAndName group = TenantIdAndName.builder().tenantId("tenant").name("some-other-group").build();
-
- SecurityGroupRule ruleToConvert = SecurityGroupRule.builder()
- .id("some-id")
- .ipProtocol(IpProtocol.TCP)
- .fromPort(10)
- .toPort(20)
- .group(group)
- .parentGroupId("some-other-id")
- .build();
-
- org.jclouds.openstack.nova.v2_0.domain.SecurityGroup origGroup = org.jclouds.openstack.nova.v2_0.domain.SecurityGroup.builder()
- .tenantId("tenant")
- .id("some-id")
- .name("some-group")
- .description("some-description")
- .rules(ruleToConvert)
- .build();
-
- return origGroup;
- }
-
- public static org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroupWithCidr() {
- SecurityGroupRule ruleToConvert = SecurityGroupRule.builder()
- .id("some-id")
- .ipProtocol(IpProtocol.TCP)
- .fromPort(10)
- .toPort(20)
- .ipRange("0.0.0.0/0")
- .parentGroupId("some-other-id")
- .build();
-
- org.jclouds.openstack.nova.v2_0.domain.SecurityGroup origGroup = org.jclouds.openstack.nova.v2_0.domain.SecurityGroup.builder()
- .tenantId("tenant")
- .id("some-id")
- .name("some-other-group")
- .description("some-description")
- .rules(ruleToConvert)
- .build();
-
- return origGroup;
- }
-
- @Test
- public void testApplyWithGroup() {
- NovaSecurityGroupToSecurityGroup parser = createGroupParser();
-
- org.jclouds.openstack.nova.v2_0.domain.SecurityGroup origGroup = securityGroupWithGroup();
-
- SecurityGroup newGroup = parser.apply(origGroup);
-
- assertEquals(newGroup.getId(), origGroup.getId());
- assertEquals(newGroup.getProviderId(), origGroup.getId());
- assertEquals(newGroup.getName(), origGroup.getName());
- assertEquals(newGroup.getOwnerId(), origGroup.getTenantId());
- assertEquals(newGroup.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getRules(), ruleConverter)));
- }
-
- @Test
- public void testApplyWithCidr() {
-
- NovaSecurityGroupToSecurityGroup parser = createGroupParser();
-
- org.jclouds.openstack.nova.v2_0.domain.SecurityGroup origGroup = securityGroupWithCidr();
-
- SecurityGroup group = parser.apply(origGroup);
-
- assertEquals(group.getId(), origGroup.getId());
- assertEquals(group.getProviderId(), origGroup.getId());
- assertEquals(group.getName(), origGroup.getName());
- assertEquals(group.getOwnerId(), origGroup.getTenantId());
- assertEquals(group.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getRules(), ruleConverter)));
- }
-
- private NovaSecurityGroupToSecurityGroup createGroupParser() {
- NovaSecurityGroupToSecurityGroup parser = new NovaSecurityGroupToSecurityGroup(ruleConverter);
-
- return parser;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneIdTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneIdTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneIdTest.java
deleted file mode 100644
index 1f520dc..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/OrphanedGroupsByZoneIdTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextModule;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.parse.ParseServerTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Guice;
-
-/**
- *
- *
- * @author Adrian Cole
- */
-@Test(testName = "OrphanedGroupsByZoneIdTest")
-public class OrphanedGroupsByZoneIdTest {
-
- Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova").description(
- "openstack-nova").build();
- Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1").scope(
- LocationScope.ZONE).parent(provider).build();
- Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
- .<String, Location> of("az-1.region-a.geo-1", zone));
-
- GroupNamingConvention.Factory namingConvention = Guice.createInjector().getInstance(GroupNamingConvention.Factory.class);
-
- @Test
- public void testWhenComputeServiceSaysAllNodesAreDeadBothGroupsAreReturned() {
-
- ServerInZone withoutHost = new ServerInZone(new ServerInZoneToNodeMetadataTest().expectedServer(), "az-1.region-a.geo-1");
- ServerInZone withHost = new ServerInZone(new ParseServerTest().expected(), "az-1.region-a.geo-1");
-
- ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
- NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
- .<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
- .<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
-
- Set<? extends NodeMetadata> set = ImmutableSet.of(converter.apply(withHost), converter.apply(withoutHost));
-
- assertEquals(new OrphanedGroupsByZoneId(Predicates.<ZoneAndName> alwaysTrue()).apply(set), ImmutableMultimap
- .<String, String> builder().putAll("az-1.region-a.geo-1", "sample", "test").build());
- }
-
- @Test
- public void testWhenComputeServiceSaysAllNodesAreDeadNoGroupsAreReturned() {
-
- ServerInZone withoutHost = new ServerInZone(new ServerInZoneToNodeMetadataTest().expectedServer(), "az-1.region-a.geo-1");
- ServerInZone withHost = new ServerInZone(new ParseServerTest().expected(), "az-1.region-a.geo-1");
-
- ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
- NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
- .<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
- .<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
-
- Set<? extends NodeMetadata> set = ImmutableSet.of(converter.apply(withHost), converter.apply(withoutHost));
-
- assertEquals(new OrphanedGroupsByZoneId(Predicates.<ZoneAndName> alwaysFalse()).apply(set), ImmutableMultimap
- .<String, String> of());
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermissionTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermissionTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermissionTest.java
deleted file mode 100644
index 59c59d0..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/SecurityGroupRuleToIpPermissionTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.net.domain.IpProtocol;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-import org.jclouds.openstack.nova.v2_0.domain.TenantIdAndName;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-
-/**
- * Tests for the function for transforming a nova specific SecurityGroupRule into a generic
- * IpPermission object.
- *
- * @author Andrew Bayer
- */
-public class SecurityGroupRuleToIpPermissionTest {
-
- @Test
- public void testApplyWithGroup() {
-
- TenantIdAndName group = TenantIdAndName.builder().tenantId("tenant").name("some-group").build();
-
- SecurityGroupRule ruleToConvert = SecurityGroupRule.builder()
- .id("some-id")
- .ipProtocol(IpProtocol.TCP)
- .fromPort(10)
- .toPort(20)
- .group(group)
- .parentGroupId("some-other-id")
- .build();
-
- IpPermission convertedPerm = NovaSecurityGroupToSecurityGroupTest.ruleConverter.apply(ruleToConvert);
-
- assertEquals(convertedPerm.getIpProtocol(), ruleToConvert.getIpProtocol());
- assertEquals(convertedPerm.getFromPort(), ruleToConvert.getFromPort());
- assertEquals(convertedPerm.getToPort(), ruleToConvert.getToPort());
- assertTrue(convertedPerm.getGroupIds().contains("az-1.region-a.geo-1/some-id"));
- assertTrue(convertedPerm.getCidrBlocks().size() == 0);
- }
-
- @Test
- public void testApplyWithCidr() {
- SecurityGroupRule ruleToConvert = SecurityGroupRule.builder()
- .id("some-id")
- .ipProtocol(IpProtocol.TCP)
- .fromPort(10)
- .toPort(20)
- .ipRange("0.0.0.0/0")
- .parentGroupId("some-other-id")
- .build();
-
- IpPermission convertedPerm = NovaSecurityGroupToSecurityGroupTest.ruleConverter.apply(ruleToConvert);
-
- assertEquals(convertedPerm.getIpProtocol(), ruleToConvert.getIpProtocol());
- assertEquals(convertedPerm.getFromPort(), ruleToConvert.getFromPort());
- assertEquals(convertedPerm.getToPort(), ruleToConvert.getToPort());
- assertEquals(convertedPerm.getCidrBlocks(), ImmutableSet.of("0.0.0.0/0"));
- assertTrue(convertedPerm.getTenantIdGroupNamePairs().size() == 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadataTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadataTest.java
deleted file mode 100644
index 7ef9fa7..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/ServerInZoneToNodeMetadataTest.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Set;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextModule;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
-import org.jclouds.openstack.nova.v2_0.parse.ParseServerTest;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Guice;
-
-/**
- * Tests for the function for transforming a nova specific Server into a generic
- * NodeMetadata object.
- *
- * @author Matt Stephenson, Adam Lowe, Adrian Cole
- */
-@Test(testName = "ServerInZoneToNodeMetadataTest")
-public class ServerInZoneToNodeMetadataTest {
-
- Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova")
- .description("openstack-nova").build();
- Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1")
- .scope(LocationScope.ZONE).parent(provider).build();
- Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
- .<String, Location> of("az-1.region-a.geo-1", zone));
-
- GroupNamingConvention.Factory namingConvention = Guice.createInjector().getInstance(GroupNamingConvention.Factory.class);
-
- @Test
- public void testWhenNoHardwareOrImageMatchServerScopedIdsImageIdIsStillSet() {
-
- Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/FOOOOOOOO").providerId("FOOOOOOOO")
- .location(zone).build();
- Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/FOOOOOOOO")
- .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
- .providerId("FOOOOOOOO").description("foobuntu").location(zone).status(Image.Status.AVAILABLE).build();
-
- checkHardwareAndImageStatus(null, existingHardware, "az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54",
- null, existingImage);
- }
-
- @Test
- public void testWhenNoHardwareAndImageMatchServerScopedIdsHardwareOperatingSystemAndImageIdAreSet() {
-
- Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
- .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
- Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
- .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
- .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
- .location(zone).build();
-
- checkHardwareAndImageStatus(existingHardware, existingHardware, existingImage.getId(),
- existingImage.getOperatingSystem(), existingImage);
- }
-
- @Test
- public void testNullAccessIPs() {
- Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
- .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
- Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
- .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
- .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
- .location(zone).build();
-
- Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
- Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
- .of(existingHardware);
- Server serverToConvert = new ParseServerTest().expected().toBuilder()
- .accessIPv4(null)
- .accessIPv6(null)
- .build();
-
- ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
-
- ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
- NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
- .<Set<? extends Image>> ofInstance(images), Suppliers
- .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
-
- NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
-
- assertNotNull(convertedNodeMetadata.getPrivateAddresses());
- assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
-
- assertNotNull(convertedNodeMetadata.getPublicAddresses());
- // note jclouds doesn't yet support ipv6 b/c not tested yet
- assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131"));
- }
-
- @Test
- public void testDuplicateAccessIPs() {
- Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
- .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
- Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
- .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
- .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
- .location(zone).build();
-
- Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
- Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
- .of(existingHardware);
- Server serverToConvert = new ParseServerTest().expected().toBuilder()
- .accessIPv4("67.23.10.132")
- .accessIPv6("::babe:67.23.10.132")
- .build();
-
- ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
-
- ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
- NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
- .<Set<? extends Image>> ofInstance(images), Suppliers
- .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
-
- NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
-
- assertNotNull(convertedNodeMetadata.getPrivateAddresses());
- assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
-
- assertNotNull(convertedNodeMetadata.getPublicAddresses());
- // note jclouds doesn't yet support ipv6 b/c not tested yet
- assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131"));
- }
-
- @Test
- public void testAlternateAccessIPs() {
- Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
- .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
- Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
- .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
- .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
- .location(zone).build();
-
- Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
- Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
- .of(existingHardware);
- Server serverToConvert = new ParseServerTest().expected().toBuilder()
- .accessIPv4("76.32.1.231")
- .accessIPv6("::babe:76.32.1.231")
- .build();
-
- ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
-
- ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
- NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
- .<Set<? extends Image>> ofInstance(images), Suppliers
- .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
-
- NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
-
- assertNotNull(convertedNodeMetadata.getPrivateAddresses());
- assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
-
- assertNotNull(convertedNodeMetadata.getPublicAddresses());
- // note jclouds doesn't yet support ipv6 b/c not tested yet
- assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131", "76.32.1.231"));
- }
-
- // TODO: clean up this syntax
- private void checkHardwareAndImageStatus(Hardware expectedHardware, Hardware existingHardware,
- String expectedImageId, OperatingSystem expectedOs, Image existingImage) {
-
- Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
- Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
- .of(existingHardware);
- Server serverToConvert = new ParseServerTest().expected();
-
- ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
-
- ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
- NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
- .<Set<? extends Image>> ofInstance(images), Suppliers
- .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
-
- NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
-
- assertEquals(serverInZoneToConvert.slashEncode(), convertedNodeMetadata.getId());
- assertEquals(serverToConvert.getId(), convertedNodeMetadata.getProviderId());
-
- assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.HOST);
- assertEquals(convertedNodeMetadata.getLocation().getId(), "e4d909c290d0fb1ca068ffaddf22cbd0");
-
- assertEquals(convertedNodeMetadata.getLocation().getParent(), locationIndex.get().get("az-1.region-a.geo-1"));
-
- assertEquals(serverToConvert.getName(), convertedNodeMetadata.getName());
- assertEquals(convertedNodeMetadata.getGroup(), "sample");
-
- assertEquals(convertedNodeMetadata.getImageId(), expectedImageId);
- assertEquals(convertedNodeMetadata.getOperatingSystem(), expectedOs);
-
- assertEquals(convertedNodeMetadata.getHardware(), expectedHardware);
-
- assertEquals(NovaComputeServiceContextModule.toPortableNodeStatus.get(serverToConvert.getStatus()),
- convertedNodeMetadata.getStatus());
-
- assertNotNull(convertedNodeMetadata.getPrivateAddresses());
- assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
-
- assertNotNull(convertedNodeMetadata.getPublicAddresses());
- // note jclouds doesn't yet support ipv6 b/c not tested yet
- assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131"));
-
- assertNotNull(convertedNodeMetadata.getUserMetadata());
- assertEquals(convertedNodeMetadata.getUserMetadata(),
- ImmutableMap.<String, String> of("Server Label", "Web Head 1", "Image Version", "2.1"));
-
- URI expectedURI = URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f6f006e54");
- assertEquals(convertedNodeMetadata.getUri(), expectedURI);
- }
-
- @Test
- public void testNewServerWithoutHostIdSetsZoneAsLocation() {
-
- Set<Image> images = ImmutableSet.<Image> of();
- Set<Hardware> hardwares = ImmutableSet.<Hardware> of();
-
- Server serverToConvert = expectedServer();
-
- ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");
-
- ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
- NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
- .<Set<? extends Image>> ofInstance(images), Suppliers
- .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
-
- NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);
-
- assertEquals(serverInZoneToConvert.slashEncode(), convertedNodeMetadata.getId());
- assertEquals(serverToConvert.getId(), convertedNodeMetadata.getProviderId());
-
- assertEquals(convertedNodeMetadata.getLocation(), zone);
-
- URI expectedURI = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752");
- assertEquals(convertedNodeMetadata.getUri(), expectedURI);
- }
-
- public Server expectedServer() {
- return Server
- .builder()
- .id("71752")
- .uuid("47491020-6a78-4f63-9475-23195ac4515c")
- .tenantId("37936628937291")
- .userId("54297837463082")
- .name("test-e92")
- .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-03-19T06:21:13Z"))
- .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-03-19T06:21:13Z"))
- .status(Server.Status.BUILD)
- .image(
- Resource
- .builder()
- .id("1241")
- .links(
- Link.create(
- Link.Relation.BOOKMARK,
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241")))
- .build())
- .flavor(
- Resource
- .builder()
- .id("100")
- .links(
- Link.create(
- Link.Relation.BOOKMARK,
- URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100")))
- .build())
- .links(
- Link.create(Link.Relation.SELF, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752")),
- Link.create(Link.Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752"))).build();
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java
deleted file mode 100644
index 9bca8e1..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.loaders;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertEquals;
-
-import java.net.UnknownHostException;
-
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.TypeLiteral;
-
-/**
- * @author Adam Lowe
- */
-@Test(groups = "unit", testName = "CreateUniqueKeyPairTest")
-public class CreateUniqueKeyPairTest {
-
- @Test
- public void testApply() throws UnknownHostException {
- final NovaApi api = createMock(NovaApi.class);
- KeyPairApi keyApi = createMock(KeyPairApi.class);
-
- KeyPair pair = createMock(KeyPair.class);
-
- Optional optKeyApi = Optional.of(keyApi);
-
- expect(api.getKeyPairExtensionForZone("zone")).andReturn(optKeyApi).atLeastOnce();
-
- expect(keyApi.create("group-1")).andReturn(pair);
-
- replay(api, keyApi);
-
- CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
-
- @Override
- protected void configure() {
- bind(new TypeLiteral<Supplier<String>>() {
- }).toInstance(Suppliers.ofInstance("1"));
- bind(NovaApi.class).toInstance(api);
- }
-
- }).getInstance(CreateUniqueKeyPair.class);
-
- assertEquals(parser.load(ZoneAndName.fromZoneAndName("zone", "group")), pair);
-
- verify(api, keyApi);
- }
-
- @Test
- public void testApplyWithIllegalStateException() throws UnknownHostException {
- final NovaApi api = createMock(NovaApi.class);
- KeyPairApi keyApi = createMock(KeyPairApi.class);
- @SuppressWarnings("unchecked")
- final Supplier<String> uniqueIdSupplier = createMock(Supplier.class);
-
- KeyPair pair = createMock(KeyPair.class);
-
- expect(api.getKeyPairExtensionForZone("zone")).andReturn((Optional) Optional.of(keyApi)).atLeastOnce();
-
- expect(uniqueIdSupplier.get()).andReturn("1");
- expect(keyApi.create("group-1")).andThrow(new IllegalStateException());
- expect(uniqueIdSupplier.get()).andReturn("2");
- expect(keyApi.create("group-2")).andReturn(pair);
-
- replay(api, keyApi, uniqueIdSupplier);
-
- CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
-
- @Override
- protected void configure() {
- bind(new TypeLiteral<Supplier<String>>() {
- }).toInstance(uniqueIdSupplier);
- bind(NovaApi.class).toInstance(api);
- }
-
- }).getInstance(CreateUniqueKeyPair.class);
-
- assertEquals(parser.load(ZoneAndName.fromZoneAndName("zone", "group")), pair);
-
- verify(api, keyApi, uniqueIdSupplier);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreateTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreateTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreateTest.java
deleted file mode 100644
index 62f45fd..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/FindSecurityGroupOrCreateTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.loaders;
-
-import static org.easymock.EasyMock.createMock;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "unit", singleThreaded = true, testName = "FindSecurityGroupOrCreateTest")
-public class FindSecurityGroupOrCreateTest {
-
- @Test
- public void testWhenNotFoundCreatesANewSecurityGroup() throws Exception {
- Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = Predicates.alwaysFalse();
-
- SecurityGroupInZone securityGroupInZone = createMock(SecurityGroupInZone.class);
-
- ZoneSecurityGroupNameAndPorts input = new ZoneSecurityGroupNameAndPorts("zone", "groupName", ImmutableSet
- .<Integer> of(22, 8080));
-
- Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = Functions.forMap(ImmutableMap
- .<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> of(input, securityGroupInZone));
-
- FindSecurityGroupOrCreate parser = new FindSecurityGroupOrCreate(
- returnSecurityGroupExistsInZone, groupCreator);
-
- assertEquals(parser.load(input), securityGroupInZone);
-
- }
-
- @Test
- public void testWhenFoundReturnsSecurityGroupFromAtomicReferenceValueUpdatedDuringPredicateCheck() throws Exception {
- final SecurityGroupInZone securityGroupInZone = createMock(SecurityGroupInZone.class);
-
- Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = new Predicate<AtomicReference<ZoneAndName>>() {
-
- @Override
- public boolean apply(AtomicReference<ZoneAndName> input) {
- input.set(securityGroupInZone);
- return true;
- }
-
- };
-
- ZoneAndName input = ZoneAndName.fromZoneAndName("zone", "groupName");
-
- Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = new Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>() {
-
- @Override
- public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts input) {
- fail();
- return null;
- }
-
- };
-
- FindSecurityGroupOrCreate parser = new FindSecurityGroupOrCreate(
- returnSecurityGroupExistsInZone, groupCreator);
-
- assertEquals(parser.load(input), securityGroupInZone);
-
- }
-
-
- @Test(expectedExceptions = IllegalStateException.class)
- public void testWhenFoundPredicateMustUpdateAtomicReference() throws Exception {
-
- Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = Predicates.alwaysTrue();
-
- ZoneAndName input = ZoneAndName.fromZoneAndName("zone", "groupName");
-
- Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = new Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>() {
-
- @Override
- public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts input) {
- fail();
- return null;
- }
-
- };
-
- FindSecurityGroupOrCreate parser = new FindSecurityGroupOrCreate(
- returnSecurityGroupExistsInZone, groupCreator);
-
- parser.load(input);
-
- }
-
-
-
- @Test(expectedExceptions = IllegalStateException.class)
- public void testWhenNotFoundInputMustBeZoneSecurityGroupNameAndPorts() throws Exception {
- Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone = Predicates.alwaysFalse();
-
- ZoneAndName input = ZoneAndName.fromZoneAndName("zone", "groupName");
-
- Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = new Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>() {
-
- @Override
- public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts input) {
- fail();
- return null;
- }
-
- };
-
- FindSecurityGroupOrCreate parser = new FindSecurityGroupOrCreate(
- returnSecurityGroupExistsInZone, groupCreator);
-
- parser.load(input);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java
deleted file mode 100644
index 771d63f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.loaders;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-
-
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * @author Adam Lowe
- */
-@Test(groups = "unit", singleThreaded = true, testName = "LoadFloatingIpsForInstanceTest")
-public class LoadFloatingIpsForInstanceTest {
-
- @Test
- public void testReturnsPublicIpOnMatch() throws Exception {
- NovaApi api = createMock(NovaApi.class);
- FloatingIPApi ipApi = createMock(FloatingIPApi.class);
- FloatingIP testIp = FloatingIP.builder().id("1").ip("1.1.1.1").fixedIp("10.1.1.1").instanceId("i-blah").build();
-
- expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
- expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(testIp)))
- .atLeastOnce();
-
- replay(api);
- replay(ipApi);
-
- LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
-
- assertEquals(ImmutableSet.copyOf(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah"))), ImmutableSet.of(testIp));
-
- verify(api);
- verify(ipApi);
- }
-
- @Test
- public void testReturnsNullWhenNotFound() throws Exception {
- NovaApi api = createMock(NovaApi.class);
- FloatingIPApi ipApi = createMock(FloatingIPApi.class);
-
- expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
-
- expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of()))
- .atLeastOnce();
-
- replay(api);
- replay(ipApi);
-
- LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
-
- assertFalse(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah")).iterator().hasNext());
-
- verify(api);
- verify(ipApi);
-
- }
-
- @Test
- public void testReturnsNullWhenNotAssigned() throws Exception {
- NovaApi api = createMock(NovaApi.class);
- FloatingIPApi ipApi = createMock(FloatingIPApi.class);
-
- expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
-
- expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(FloatingIP.builder().id("1").ip("1.1.1.1").build())))
- .atLeastOnce();
-
- replay(api);
- replay(ipApi);
-
- LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
-
- assertFalse(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah")).iterator().hasNext());
-
- verify(api);
- verify(ipApi);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptionsTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptionsTest.java
deleted file mode 100644
index 106da5b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptionsTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.options;
-
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.authorizePublicKey;
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.autoAssignFloatingIp;
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.blockOnPort;
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.generateKeyPair;
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.inboundPorts;
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.installPrivateKey;
-import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.securityGroupNames;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Tests possible uses of NovaTemplateOptions and NovaTemplateOptions.Builder.*
- *
- * @author Adrian Cole
- */
-@Test(testName = "NovaTemplateOptionsTest")
-public class NovaTemplateOptionsTest {
-
- public void testAs() {
- TemplateOptions options = new NovaTemplateOptions();
- assertEquals(options.as(NovaTemplateOptions.class), options);
- }
-
- @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "all security groups must be non-empty")
- public void testsecurityGroupNamesIterableBadFormat() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.securityGroupNames(ImmutableSet.of("group1", ""));
- }
-
- @Test
- public void testsecurityGroupNamesIterable() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.securityGroupNames(ImmutableSet.of("group1", "group2"));
- assertEquals(options.getSecurityGroupNames(), Optional.of(ImmutableSet.of("group1", "group2")));
-
- }
-
- @Test
- public void testsecurityGroupNamesIterableStatic() {
- NovaTemplateOptions options = securityGroupNames(ImmutableSet.of("group1", "group2"));
- assertEquals(options.getSecurityGroupNames(), Optional.of(ImmutableSet.of("group1", "group2")));
- }
-
- @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "all security groups must be non-empty")
- public void testsecurityGroupNamesVarArgsBadFormat() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.securityGroupNames("mygroup", "");
- }
-
- @Test
- public void testsecurityGroupNamesVarArgs() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.securityGroupNames("group1", "group2");
- assertEquals(options.getSecurityGroupNames(), Optional.of(ImmutableSet.of("group1", "group2")));
-
- }
-
- @Test
- public void testDefaultGroupsVarArgsEmpty() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- assertEquals(options.getSecurityGroupNames(), Optional.absent());
- }
-
- @Test
- public void testsecurityGroupNamesVarArgsStatic() {
- NovaTemplateOptions options = securityGroupNames("group1", "group2");
- assertEquals(options.getSecurityGroupNames(), Optional.of(ImmutableSet.of("group1", "group2")));
- }
-
- @Test
- public void testautoAssignFloatingIpDefault() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- assert !options.shouldAutoAssignFloatingIp();
- }
-
- @Test
- public void testautoAssignFloatingIp() {
- NovaTemplateOptions options = new NovaTemplateOptions().autoAssignFloatingIp(true);
- assert options.shouldAutoAssignFloatingIp();
- }
-
- @Test
- public void testautoAssignFloatingIpStatic() {
- NovaTemplateOptions options = autoAssignFloatingIp(true);
- assert options.shouldAutoAssignFloatingIp();
- }
-
- @Test
- public void testGenerateKeyPairDefault() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- assert !options.shouldGenerateKeyPair();
- }
-
- @Test
- public void testGenerateKeyPair() {
- NovaTemplateOptions options = new NovaTemplateOptions().generateKeyPair(true);
- assert options.shouldGenerateKeyPair();
- }
-
- @Test
- public void testGenerateKeyPairStatic() {
- NovaTemplateOptions options = generateKeyPair(true);
- assert options.shouldGenerateKeyPair();
- }
-
- // superclass tests
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testinstallPrivateKeyBadFormat() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.installPrivateKey("whompy");
- }
-
- @Test
- public void testinstallPrivateKey() throws IOException {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
- assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
- }
-
- @Test
- public void testNullinstallPrivateKey() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- assertEquals(options.getPrivateKey(), null);
- }
-
- @Test
- public void testinstallPrivateKeyStatic() throws IOException {
- NovaTemplateOptions options = installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
- assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testinstallPrivateKeyNPE() {
- installPrivateKey(null);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testauthorizePublicKeyBadFormat() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.authorizePublicKey("whompy");
- }
-
- @Test
- public void testauthorizePublicKey() throws IOException {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.authorizePublicKey("ssh-rsa");
- assertEquals(options.getPublicKey(), "ssh-rsa");
- }
-
- @Test
- public void testNullauthorizePublicKey() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- assertEquals(options.getPublicKey(), null);
- }
-
- @Test
- public void testauthorizePublicKeyStatic() throws IOException {
- NovaTemplateOptions options = authorizePublicKey("ssh-rsa");
- assertEquals(options.getPublicKey(), "ssh-rsa");
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testauthorizePublicKeyNPE() {
- authorizePublicKey(null);
- }
-
- @Test
- public void testUserData() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.userData("test".getBytes());
- assertEquals(new String(options.getUserData()), "test");
- }
-
- @Test
- public void testDiskConfig() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.diskConfig(Server.DISK_CONFIG_AUTO);
- assertEquals(options.getDiskConfig(), Server.DISK_CONFIG_AUTO);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testblockOnPortBadFormat() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.blockOnPort(-1, -1);
- }
-
- @Test
- public void testblockOnPort() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.blockOnPort(22, 30);
- assertEquals(options.getPort(), 22);
- assertEquals(options.getSeconds(), 30);
-
- }
-
- @Test
- public void testNullblockOnPort() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- assertEquals(options.getPort(), -1);
- assertEquals(options.getSeconds(), -1);
- }
-
- @Test
- public void testblockOnPortStatic() {
- NovaTemplateOptions options = blockOnPort(22, 30);
- assertEquals(options.getPort(), 22);
- assertEquals(options.getSeconds(), 30);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testinboundPortsBadFormat() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.inboundPorts(-1, -1);
- }
-
- @Test
- public void testinboundPorts() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- options.inboundPorts(22, 30);
- assertEquals(options.getInboundPorts()[0], 22);
- assertEquals(options.getInboundPorts()[1], 30);
-
- }
-
- @Test
- public void testDefaultOpen22() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- assertEquals(options.getInboundPorts()[0], 22);
- }
-
- @Test
- public void testinboundPortsStatic() {
- NovaTemplateOptions options = inboundPorts(22, 30);
- assertEquals(options.getInboundPorts()[0], 22);
- assertEquals(options.getInboundPorts()[1], 30);
- }
-}
[52/52] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by la...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/de87ec62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/de87ec62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/de87ec62
Branch: refs/heads/master
Commit: de87ec6262927f36ff7e5810374c70e8b2ffdcad
Parents: 19c8cda eadddc1
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Mon Mar 31 00:12:14 2014 -0700
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Mon Mar 31 00:12:14 2014 -0700
----------------------------------------------------------------------
.../org.apache.stratos.cloud.controller/pom.xml | 6 +-
.../TopologySynchronizerTaskScheduler.java | 91 +--
.../main/resources/conf/cloud-controller.xml | 1 -
tools/puppet3/modules/autoscaler/LICENSE | 13 -
.../autoscaler/files/configs/bin/stratos.sh | 298 --------
.../configs/repository/conf/autoscaler.xml | 34 -
.../modules/autoscaler/manifests/clean.pp | 45 --
.../modules/autoscaler/manifests/deploy.pp | 43 --
.../modules/autoscaler/manifests/init.pp | 97 ---
.../modules/autoscaler/manifests/initialize.pp | 59 --
.../modules/autoscaler/manifests/params.pp | 66 --
.../autoscaler/manifests/push_templates.pp | 26 -
.../modules/autoscaler/manifests/start.pp | 27 -
.../templates/conf/autoscaler.xml.erb | 39 -
.../templates/conf/axis2/axis2.xml.erb | 701 ------------------
.../autoscaler/templates/conf/carbon.xml.erb | 625 ----------------
.../templates/conf/jndi.properties.erb | 4 -
.../economy-autoscale.xml.erb | 26 -
.../economy-deployment.xml.erb | 23 -
.../server/partitions/partitions.xml.erb | 19 -
tools/puppet3/modules/cc/LICENSE | 13 -
.../modules/cc/files/configs/bin/stratos.sh | 299 --------
.../repository/conf/cloud-controller.xml | 81 ---
....stratos.cloud.controller_4.0.0.SNAPSHOT.jar | Bin 183364 -> 0 bytes
tools/puppet3/modules/cc/manifests/clean.pp | 45 --
tools/puppet3/modules/cc/manifests/deploy.pp | 43 --
tools/puppet3/modules/cc/manifests/init.pp | 96 ---
.../puppet3/modules/cc/manifests/initialize.pp | 59 --
tools/puppet3/modules/cc/manifests/params.pp | 66 --
.../modules/cc/manifests/push_templates.pp | 26 -
tools/puppet3/modules/cc/manifests/start.pp | 27 -
.../cc/templates/conf/axis2/axis2.xml.erb | 703 ------------------
.../modules/cc/templates/conf/carbon.xml.erb | 625 ----------------
.../cc/templates/conf/jndi.properties.erb | 4 -
tools/puppet3/modules/cep/LICENSE | 13 -
.../modules/cep/files/configs/bin/wso2server.sh | 304 --------
.../dropins/activemq_client_5.8.0_1.0.0.jar | Bin 1032400 -> 0 bytes
.../dropins/andes_client_0.13.wso2v8_1.0.0.jar | Bin 1854829 -> 0 bytes
...che.stratos.cep.extension-1.0.0-SNAPSHOT.jar | Bin 16495 -> 0 bytes
.../repository/conf/siddhi/siddhi.extension | 3 -
.../repository/conf/stream-manager-config.xml | 177 -----
.../HealthStatisticsEventBuilder.xml | 10 -
.../InstanceStatusStatisticsBuilder.xml | 10 -
.../LoadBalancerStatisticsEventBuilder.xml | 10 -
.../AverageInFlightRequestsEventFormatter.xml | 11 -
.../AverageLoadAverageEventFormatter.xml | 11 -
.../AverageMemoryConsumptionEventFormatter.xml | 11 -
.../FaultMessageEventFormatter.xml | 11 -
.../GradientInFlightRequestsEventFormatter.xml | 11 -
.../GradientLoadAverageEventFormatter.xml | 11 -
.../GradientMemoryConsumptionEventFormatter.xml | 11 -
.../MemberAverageLoadAverageEventFormatter.xml | 11 -
...erAverageMemoryConsumptionEventFormatter.xml | 11 -
.../MemberGradientLoadAverageEventFormatter.xml | 11 -
...rGradientMemoryConsumptionEventFormatter.xml | 11 -
...econdDerivativeLoadAverageEventFormatter.xml | 11 -
...erivativeMemoryConsumptionEventFormatter.xml | 11 -
...DerivativeInFlightRequestsEventFormatter.xml | 11 -
...econdDerivativeLoadAverageEventFormatter.xml | 11 -
...erivativeMemoryConsumptionEventFormatter.xml | 11 -
.../executionplans/AverageHeathRequest.xml | 29 -
.../AverageInFlightRequestsFinder.xml | 19 -
.../executionplans/GradientOfHealthRequest.xml | 30 -
.../GradientOfRequestsInFlightFinder.xml | 18 -
.../SecondDerivativeOfHealthRequest.xml | 27 -
...SecondDerivativeOfRequestsInFlightFinder.xml | 19 -
.../DefaultWSO2EventInputAdaptor.xml | 3 -
.../DefaultWSO2EventOutputAdaptor.xml | 8 -
.../outputeventadaptors/JMSOutputAdaptor.xml | 8 -
.../streamdefinitions/stream-manager-config.xml | 269 -------
tools/puppet3/modules/cep/manifests/clean.pp | 45 --
tools/puppet3/modules/cep/manifests/deploy.pp | 43 --
tools/puppet3/modules/cep/manifests/init.pp | 101 ---
.../puppet3/modules/cep/manifests/initialize.pp | 59 --
tools/puppet3/modules/cep/manifests/params.pp | 69 --
.../modules/cep/manifests/push_templates.pp | 26 -
tools/puppet3/modules/cep/manifests/start.pp | 27 -
.../cep/templates/conf/axis2/axis2.xml.erb | 698 ------------------
.../modules/cep/templates/conf/carbon.xml.erb | 609 ----------------
.../cep/templates/conf/jndi.properties.erb | 32 -
.../JMSOutputAdaptor.xml.erb | 8 -
tools/puppet3/modules/manager/LICENSE | 13 -
.../manager/files/configs/bin/stratos.sh | 301 --------
.../lib/mysql-connector-java-5.1.26-bin.jar | Bin 855948 -> 0 bytes
.../repository/conf/cartridge-config.properties | 63 --
.../conf/datasources/master-datasources.xml | 27 -
.../conf/datasources/stratos-datasources.xml | 66 --
.../repository/conf/stratos-datasources.xml | 66 --
.../puppet3/modules/manager/manifests/clean.pp | 45 --
.../puppet3/modules/manager/manifests/deploy.pp | 43 --
tools/puppet3/modules/manager/manifests/init.pp | 99 ---
.../modules/manager/manifests/initialize.pp | 59 --
.../puppet3/modules/manager/manifests/params.pp | 66 --
.../modules/manager/manifests/push_templates.pp | 26 -
.../puppet3/modules/manager/manifests/start.pp | 27 -
.../manager/templates/conf/axis2/axis2.xml.erb | 702 ------------------
.../manager/templates/conf/carbon.xml.erb | 625 ----------------
.../conf/cartridge-config.properties.erb | 73 --
.../conf/datasources/master-datasources.xml.erb | 27 -
.../datasources/stratos-datasources.xml.erb | 66 --
.../manager/templates/conf/jndi.properties.erb | 4 -
tools/puppet3/modules/messagebroker/LICENSE | 13 -
.../files/configs/bin/wso2server.sh | 300 --------
.../modules/messagebroker/manifests/clean.pp | 45 --
.../modules/messagebroker/manifests/deploy.pp | 43 --
.../modules/messagebroker/manifests/init.pp | 99 ---
.../messagebroker/manifests/initialize.pp | 59 --
.../modules/messagebroker/manifests/params.pp | 66 --
.../messagebroker/manifests/push_templates.pp | 26 -
.../modules/messagebroker/manifests/start.pp | 27 -
.../templates/conf/axis2/axis2.xml.erb | 719 -------------------
.../messagebroker/templates/conf/carbon.xml.erb | 583 ---------------
.../cc/repository/conf/cloud-controller.xml | 1 -
113 files changed, 42 insertions(+), 11517 deletions(-)
----------------------------------------------------------------------
[38/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiExpectTest.java
new file mode 100644
index 0000000..4f0ac08
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiExpectTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.DateService;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.HostAggregate;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests HostAggregateApi guice wiring and parsing
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "HostAggregateApiExpectTest")
+public class HostAggregateApiExpectTest extends BaseNovaApiExpectTest {
+ private DateService dateService = new SimpleDateFormatDateService();
+
+ public void testList() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_list.json")).build())
+ .getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ HostAggregate result = Iterables.getOnlyElement(api.list());
+ assertEquals(result, exampleHostAggregate());
+ }
+
+ public void testGet() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_with_host_details.json")).build())
+ .getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.get("1"), exampleHostAggregateWithHost());
+ }
+
+ public void testGetFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertNull(api.get("1"));
+ }
+
+ public void testCreateAggregate() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"aggregate\":{\"name\":\"ubuntu1\",\"availability_zone\":\"nova\"}}", MediaType.APPLICATION_JSON))
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build())
+ .getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.createInAvailabilityZone("ubuntu1", "nova"), exampleHostAggregate());
+ }
+
+ public void testDeleteAggregate() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.delete("1"));
+ }
+
+ public void testDeleteAggregateFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(404).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.delete("1"));
+ }
+
+ public void testUpdateName() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"aggregate\":{\"name\":\"newaggregatename\"}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.updateName("1", "newaggregatename"), exampleHostAggregate());
+ }
+
+ public void testUpdateAvailabilityZone() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"aggregate\":{\"availability_zone\":\"zone1\"}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.updateAvailabilityZone("1", "zone1"), exampleHostAggregate());
+ }
+
+ public void testAddHost() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"add_host\":{\"host\":\"ubuntu\"}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.addHost("1", "ubuntu"), exampleHostAggregate());
+ }
+
+ public void testRemoveHost() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"remove_host\":{\"host\":\"ubuntu\"}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.removeHost("1", "ubuntu"), exampleHostAggregate());
+ }
+
+
+ public void testSetMetadata() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
+ HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"set_metadata\":{\"metadata\":{\"mykey\":\"some value or other\"}}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.setMetadata("1", ImmutableMap.of("mykey", "some value or other")), exampleHostAggregate());
+ }
+
+ public HostAggregate exampleHostAggregate() {
+ return HostAggregate.builder().name("jclouds-test-a").availabilityZone("nova")
+ .created(dateService.iso8601SecondsDateParse("2012-05-11 11:40:17"))
+ .updated(dateService.iso8601SecondsDateParse("2012-05-11 11:46:44"))
+ .state("created").id("1").metadata(ImmutableMap.of("somekey", "somevalue", "anotherkey", "another val")).build();
+ }
+
+ public HostAggregate exampleHostAggregateWithHost() {
+ return exampleHostAggregate().toBuilder().hosts("ubuntu").build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java
new file mode 100644
index 0000000..5a237db
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java
@@ -0,0 +1,148 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.Host;
+import org.jclouds.openstack.nova.v2_0.domain.HostAggregate;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of AggregateApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "AggregateApiLiveTest", singleThreaded = true)
+public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest {
+ private Optional<? extends HostAggregateApi> apiOption;
+ private Optional<? extends HostAdministrationApi> hostAdminOption;
+
+ private HostAggregate testAggregate;
+
+ @BeforeClass(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ String zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ apiOption = api.getHostAggregateExtensionForZone(zone);
+ hostAdminOption = api.getHostAdministrationExtensionForZone(zone);
+ }
+
+ @AfterClass(groups = { "integration", "live" })
+ @Override
+ protected void tearDown() {
+ if (testAggregate != null) {
+ assertTrue(apiOption.get().delete(testAggregate.getId()));
+ }
+ super.tearDown();
+ }
+
+ public void testCreateAggregate() {
+ if (apiOption.isPresent()) {
+ // TODO assuming "nova" availability zone is present
+ testAggregate = apiOption.get().createInAvailabilityZone("jclouds-test-a", "nova");
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateAggregate")
+ public void testListAndGetAggregate() {
+ if (apiOption.isPresent()) {
+ HostAggregateApi api = apiOption.get();
+ Set<? extends HostAggregate> aggregates = api.list().toSet();
+ for (HostAggregate aggregate : aggregates) {
+ assertNotNull(aggregate.getId());
+ assertNotNull(aggregate.getName());
+ assertNotNull(aggregate.getAvailabilityZone());
+
+ HostAggregate details = api.get(aggregate.getId());
+ assertEquals(details.getId(), aggregate.getId());
+ assertEquals(details.getName(), aggregate.getName());
+ assertEquals(details.getAvailabilityZone(), aggregate.getAvailabilityZone());
+ assertEquals(details.getHosts(), aggregate.getHosts());
+ }
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateAggregate")
+ public void testModifyMetadata() {
+ if (apiOption.isPresent()) {
+ HostAggregateApi api = apiOption.get();
+ for (Map<String, String> theMetaData : ImmutableSet.of(
+ ImmutableMap.of("somekey", "somevalue"),
+ ImmutableMap.of("somekey", "some other value", "anotherkey", "another val")
+ )) {
+ // Apply changes
+ HostAggregate details = api.setMetadata(testAggregate.getId(), theMetaData);
+
+ // bug in openstack - metadata values are never removed, so we just checking what we've set
+ for (Map.Entry<String, String> entry : theMetaData.entrySet()) {
+ assertEquals(details.getMetadata().get(entry.getKey()), entry.getValue());
+ }
+
+ // Re-fetch to double-check
+ details = api.get(testAggregate.getId());
+ for (Map.Entry<String, String> entry : theMetaData.entrySet()) {
+ assertEquals(details.getMetadata().get(entry.getKey()), entry.getValue());
+ }
+ }
+ }
+ }
+
+ // Note the host will be added, but cannot remove it til
+ @Test(enabled = false, dependsOnMethods = "testCreateAggregate")
+ public void testModifyHosts() {
+ if (apiOption.isPresent() && hostAdminOption.isPresent()) {
+ HostAggregateApi api = apiOption.get();
+ Host host = Iterables.getFirst(hostAdminOption.get().list(), null);
+ assertNotNull(host);
+
+ String host_id = host.getName();
+ assertNotNull(host_id);
+ HostAggregate details;
+
+ try {
+ details = api.addHost(testAggregate.getId(), host_id);
+
+ assertEquals(details.getHosts(), ImmutableSet.of(host_id));
+
+ // re-fetch to double-check
+ details = api.get(testAggregate.getId());
+ assertEquals(details.getHosts(), ImmutableSet.of(host_id));
+
+ // TODO wait until status of aggregate isn't CHANGING (hostAdministration.shutdown?)
+ } finally {
+ details = api.removeHost(testAggregate.getId(), host_id);
+ }
+
+ assertEquals(details.getHosts(), ImmutableSet.of());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiExpectTest.java
new file mode 100644
index 0000000..55f0d58
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiExpectTest.java
@@ -0,0 +1,142 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseKeyPairListTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseKeyPairTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests annotation parsing of {@code KeyPairAsyncApi}
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "KeyPairApiExpectTest")
+public class KeyPairApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testListKeyPairsWhenResponseIs2xx() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-keypairs")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/keypair_list.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
+
+ assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ // NOTE this required a change to the KeyPair domain object toString method
+ assertEquals(apiWhenServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().list().toString(),
+ new ParseKeyPairListTest().expected().toString());
+ }
+
+ public void testListKeyPairsWhenResponseIs404() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-keypairs")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
+
+ assertTrue(apiWhenNoServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().list().isEmpty());
+
+ }
+
+ public void testCreateKeyPair() throws Exception {
+ HttpRequest create = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-keypairs")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"keypair\":{\"name\":\"testkeypair\"}}", "application/json"))
+ .build();
+
+ HttpResponse createResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/keypair_created.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, create, createResponse);
+
+ assertEquals(apiWhenServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().create("testkeypair")
+ .toString(), new ParseKeyPairTest().expected().toString());
+
+ }
+
+ public void testCreateKeyPairWithPublicKey() throws Exception {
+ HttpRequest create = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-keypairs")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"keypair\":{\"name\":\"testkeypair\",\"public_key\":\"ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABACE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumADSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQ== nova@nv-aw2az1-api0001\n\"}}",
+ "application/json")).build();
+
+ HttpResponse createResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/keypair_created.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, create, createResponse);
+
+ assertEquals(
+ apiWhenServersExist
+ .getKeyPairExtensionForZone("az-1.region-a.geo-1")
+ .get()
+ .createWithPublicKey(
+ "testkeypair",
+ "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABACE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumADSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQ== nova@nv-aw2az1-api0001\n")
+ .toString(), new ParseKeyPairTest().expected().toString());
+ }
+
+ public void testDeleteKeyPair() throws Exception {
+ HttpRequest delete = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-keypairs/testkeypair")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(202).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, delete, deleteResponse);
+
+ assertTrue(apiWhenServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().delete("testkeypair"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java
new file mode 100644
index 0000000..da2e1e4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Tests behavior of {@code KeyPairApi}
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "live", testName = "KeyPairApiLiveTest")
+public class KeyPairApiLiveTest extends BaseNovaApiLiveTest {
+
+ public void testListKeyPairs() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get();
+ FluentIterable<? extends KeyPair> keyPairsList = keyPairApi.list();
+ assertNotNull(keyPairsList);
+ }
+ }
+
+ public void testCreateAndDeleteKeyPair() throws Exception {
+ final String KEYPAIR_NAME = "testkp";
+ for (String zoneId : api.getConfiguredZones()) {
+ KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get();
+ KeyPair keyPair = null;
+ try {
+ keyPair = keyPairApi.create(KEYPAIR_NAME);
+ assertNotNull(keyPair);
+ } finally {
+ if (keyPair != null) {
+ keyPairApi.delete(KEYPAIR_NAME);
+ }
+ }
+ }
+ }
+
+ public void testCreateAndDeleteKeyPairWithPublicKey() throws Exception {
+ final String KEYPAIR_NAME = "testkp";
+ final String PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCrrBREFxz3002l1HuXz0+UOdJQ/mOYD5DiJwwB/TOybwIKQJPOxJWA9gBoo4k9dthTKBTaEYbzrll7iZcp59E80S6mNiAr3mUgi+x5Y8uyXeJ2Ws+h6peVyFVUu9epkwpcTd1GVfdcVWsTajwDz9+lxCDhl0RZKDFoT0scTxbj/w== nova@nv-aw2az2-api0002";
+
+ for (String zoneId : api.getConfiguredZones()) {
+ KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get();
+ KeyPair keyPair = null;
+ try {
+ keyPair = keyPairApi.createWithPublicKey(KEYPAIR_NAME, PUBLIC_KEY);
+ assertNotNull(keyPair);
+ } finally {
+ if (keyPair != null) {
+ keyPairApi.delete(KEYPAIR_NAME);
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiExpectTest.java
new file mode 100644
index 0000000..79e6747
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiExpectTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.Quota;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.testng.annotations.Test;
+
+/**
+ * Tests HostAdministrationApi guice wiring and parsing
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "QuotaApiExpectTest")
+public class QuotaApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testGetQuotas() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo");
+ QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/quotas.json")).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.getByTenant("demo"), getTestQuotas());
+ }
+
+ public void testGetQuotasFailsTenantNotFound() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo");
+ QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
+ assertNull(api.getByTenant("demo"));
+ }
+
+ public void testGetDefaultQuotas() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo/defaults");
+ QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/quotas.json")).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.getDefaultsForTenant("demo"), getTestQuotas());
+ }
+
+ public void testGetDefaultQuotasFailsTenantNotFound() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo/defaults");
+ QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
+ assertNull(api.getDefaultsForTenant("demo"));
+ }
+
+
+ public void testUpdateQuotas() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo");
+ QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().endpoint(endpoint).method("PUT")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromResourceWithContentType("/quotas.json", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(200).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.updateQuotaOfTenant(getTestQuotas(), "demo"));
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testUpdateQuotasFailsNotFound() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo");
+ QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().endpoint(endpoint).method("PUT")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromResourceWithContentType("/quotas.json", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(404).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.updateQuotaOfTenant(getTestQuotas(), "demo");
+ }
+
+ public static Quota getTestQuotas() {
+ return Quota.builder()
+ .metadataItems(128)
+ .injectedFileContentBytes(10240)
+ .injectedFiles(5)
+ .gigabytes(1000)
+ .ram(51200)
+ .floatingIps(10)
+ .securityGroups(10)
+ .securityGroupRules(20)
+ .instances(10)
+ .keyPairs(100)
+ .volumes(10)
+ .cores(20)
+ .id("demo").build();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java
new file mode 100644
index 0000000..1408223
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.openstack.nova.v2_0.domain.Quota;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of QuotaApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "QuotaApiLiveTest", singleThreaded = true)
+public class QuotaApiLiveTest extends BaseNovaApiLiveTest {
+ private Optional<? extends QuotaApi> apiOption;
+ private String tenant;
+
+ @BeforeClass(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ tenant = identity.split(":")[0];
+ String zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ apiOption = api.getQuotaExtensionForZone(zone);
+ }
+
+ public void testGetQuotasForCurrentTenant() {
+ if (apiOption.isPresent()) {
+ Quota quota = apiOption.get().getByTenant(tenant);
+ assertQuotasIsValid(quota);
+ }
+ }
+
+ public void testGetDefaultQuotasForCurrentTenant() {
+ if (apiOption.isPresent()) {
+ Quota quota = apiOption.get().getDefaultsForTenant(tenant);
+ assertQuotasIsValid(quota);
+ }
+ }
+
+ public void testUpdateQuotasOfCurrentTenantThenReset() {
+ if (apiOption.isPresent()) {
+ QuotaApi api = apiOption.get();
+ Quota before = api.getByTenant(tenant);
+ assertQuotasIsValid(before);
+
+ Quota modified = before.toBuilder()
+ .cores(before.getCores() - 1)
+ .instances(before.getInstances() - 1)
+ .metadataItems(before.getMetadatas() - 1)
+ .ram(before.getRam() - 1)
+ .volumes(before.getVolumes() - 1)
+ .build();
+
+ assertTrue(api.updateQuotaOfTenant(modified, tenant));
+
+ assertEquals(api.getByTenant(tenant), modified);
+
+ assertTrue(api.updateQuotaOfTenant(before, tenant));
+
+ assertEquals(api.getByTenant(tenant), before);
+ }
+ }
+
+ protected void assertQuotasIsValid(Quota quota) {
+ assertTrue(quota.getCores() > 0);
+ assertTrue(quota.getFloatingIps() >= 0);
+ assertTrue(quota.getGigabytes() > 0);
+ assertTrue(quota.getInjectedFileContentBytes() >= 0);
+ assertTrue(quota.getInjectedFiles() >= 0);
+ assertTrue(quota.getInstances() > 0);
+ assertTrue(quota.getKeyPairs() > 0);
+ assertTrue(quota.getRam() > 0);
+ assertTrue(quota.getSecurityGroups() > 0);
+ assertTrue(quota.getSecurityGroupRules() > 0);
+ assertTrue(quota.getVolumes() > 0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiExpectTest.java
new file mode 100644
index 0000000..4611ea9
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiExpectTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.QuotaClass;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.testng.annotations.Test;
+
+/**
+ * Tests HostAdministrationApi guice wiring and parsing
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "QuotaClassApiExpectTest")
+public class QuotaClassApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testGetQuotas() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas");
+ QuotaClassApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/quota_class.json")).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.get("jcloudstestquotas"), getTestQuotas());
+ }
+
+ public void testGetQuotasFailsTenantNotFound() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas");
+ QuotaClassApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get();
+ assertNull(api.get("jcloudstestquotas"));
+ }
+
+ public void testUpdateQuotas() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/myclass");
+ QuotaClassApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().endpoint(endpoint).method("PUT")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromResourceWithContentType("/quota_class.json", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(200).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.update("myclass", getTestQuotas()));
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testUpdateQuotasFailsNotFound() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas");
+ QuotaClassApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().endpoint(endpoint).method("PUT")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromResourceWithContentType("/quota_class.json", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(404).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.update("jcloudstestquotas", getTestQuotas());
+ }
+
+ public static QuotaClass getTestQuotas() {
+ return QuotaClass.builder()
+ .metadataItems(128)
+ .injectedFileContentBytes(10240)
+ .injectedFiles(5)
+ .gigabytes(1000)
+ .ram(4096)
+ .floatingIps(10)
+ .securityGroups(10)
+ .securityGroupRules(20)
+ .instances(5)
+ .keyPairs(100)
+ .volumes(5)
+ .cores(10)
+ .id("jcloudstestquotas").build();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java
new file mode 100644
index 0000000..43fd342
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.openstack.nova.v2_0.domain.QuotaClass;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of QuotaApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "QuotaClassApiLiveTest", singleThreaded = true)
+public class QuotaClassApiLiveTest extends BaseNovaApiLiveTest {
+ private Optional<? extends QuotaClassApi> apiOption;
+ private String zone;
+
+ @BeforeClass(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ apiOption = api.getQuotaClassExtensionForZone(zone);
+ }
+
+ public void testUpdateAndGetQuotaClass() {
+ if (apiOption.isPresent()) {
+ QuotaClassApi api = apiOption.get();
+
+ QuotaClass firstVersion =
+ QuotaClassApiExpectTest.getTestQuotas().toBuilder()
+ .id("jcloudstestquotas")
+ .cores(10)
+ .instances(5)
+ .ram(4096)
+ .volumes(5)
+ .build();
+
+ assertTrue(api.update(firstVersion.getId(), firstVersion));
+
+ assertEquals(api.get(firstVersion.getId()), firstVersion);
+
+ // Change it again (since we may have run this test before and we can't delete the QuotaClass)
+ QuotaClass secondVersion = firstVersion.toBuilder().ram(8192).build();
+
+ assertTrue(api.update(secondVersion.getId(), secondVersion));
+
+ assertEquals(api.get(secondVersion.getId()), secondVersion);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiExpectTest.java
new file mode 100644
index 0000000..1fa8416
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiExpectTest.java
@@ -0,0 +1,235 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Ingress;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseSecurityGroupListTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseSecurityGroupTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests annotation parsing of {@code SecurityGroupAsyncApi}
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "SecurityGroupApiExpectTest")
+public class SecurityGroupApiExpectTest extends BaseNovaApiExpectTest {
+ public void testListSecurityGroupsWhenResponseIs2xx() throws Exception {
+ HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_list.json")).build();
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list,
+ listResponse);
+
+ assertEquals(apiWhenSecurityGroupsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .list().toString(), new ParseSecurityGroupListTest().expected().toString());
+ }
+
+ public void testListSecurityGroupsWhenReponseIs404IsEmpty() throws Exception {
+ HttpRequest listListSecurityGroups = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listListSecurityGroupsResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listListSecurityGroups,
+ listListSecurityGroupsResponse);
+
+ assertTrue(apiWhenNoSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .list().isEmpty());
+ }
+
+ public void testGetSecurityGroupWhenResponseIs2xx() throws Exception {
+
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/0")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details.json")).build();
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, getSecurityGroup,
+ getSecurityGroupResponse);
+
+ assertEquals(apiWhenSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .get("0").toString(), new ParseSecurityGroupTest().expected().toString());
+ }
+
+ public void testGetSecurityGroupWhenResponseIs404() throws Exception {
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/0")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, getSecurityGroup,
+ getSecurityGroupResponse);
+
+ assertNull(apiWhenNoSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .get("0"));
+
+ }
+
+ public void testCreateSecurityGroupWhenResponseIs2xx() throws Exception {
+ HttpRequest create = HttpRequest.builder().method("POST").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build())
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group\":{\"name\":\"jclouds-test\",\"description\":\"jclouds-test\"}}",
+ "application/json")).build();
+
+ HttpResponse createResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_created.json")).build();
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, create,
+ createResponse);
+
+ assertEquals(apiWhenSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .createWithDescription("jclouds-test", "jclouds-test").toString(),
+ createExpected().toString());
+ }
+
+ public void testDeleteSecurityGroupWhenResponseIs2xx() throws Exception {
+ HttpRequest delete = HttpRequest.builder().method("DELETE").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160"))
+ .headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json")
+ .put("X-Auth-Token", authToken).build()).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(202).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, delete,
+ deleteResponse);
+
+ assertTrue(apiWhenServersExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .delete("160"));
+
+ }
+
+ public void testCreateSecurityGroupRuleForCidrBlockWhenResponseIs2xx() throws Exception {
+ HttpRequest createRule = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group_rule\":{\"parent_group_id\":\"161\",\"cidr\":\"0.0.0.0/0\",\"ip_protocol\":\"tcp\",\"from_port\":\"80\",\"to_port\":\"8080\"}}",
+ "application/json")).build();
+
+ HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygrouprule_created.json")).build();
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createRule,
+ createRuleResponse);
+
+ assertEquals(apiWhenSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .createRuleAllowingCidrBlock("161",
+ Ingress.builder().ipProtocol(IpProtocol.TCP).fromPort(80).toPort(8080).build(), "0.0.0.0/0")
+ .toString(), createRuleExpected().toString());
+ }
+
+ public void testCreateSecurityGroupRuleForSecurityGroupIdWhenResponseIs2xx() throws Exception {
+ HttpRequest createRule = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group_rule\":{\"group_id\":\"999\",\"parent_group_id\":\"161\",\"ip_protocol\":\"tcp\",\"from_port\":\"80\",\"to_port\":\"8080\"}}",
+ "application/json")).build();
+
+ HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygrouprule_created.json")).build();
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createRule,
+ createRuleResponse);
+
+ assertEquals(apiWhenSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .createRuleAllowingSecurityGroupId("161",
+ Ingress.builder().ipProtocol(IpProtocol.TCP).fromPort(80).toPort(8080).build(), "999")
+ .toString(), createRuleExpected().toString());
+ }
+
+ public void testDeleteSecurityGroupRuleWhenResponseIs2xx() throws Exception {
+ HttpRequest deleteRule = HttpRequest.builder().method("DELETE").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules/161"))
+ .headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "*/*")
+ .put("X-Auth-Token", authToken).build()).build();
+
+ HttpResponse deleteRuleResponse = HttpResponse.builder().statusCode(202).build();
+
+ NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, deleteRule,
+ deleteRuleResponse);
+
+ assertTrue(apiWhenSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
+ .deleteRule("161"));
+
+ }
+
+ private SecurityGroup createExpected() {
+ return SecurityGroup.builder().description("jclouds-test").id("160").name("jclouds-test").rules(
+ ImmutableSet.<SecurityGroupRule> of()).tenantId("dev_16767499955063").build();
+ }
+
+ private SecurityGroupRule createRuleExpected() {
+ return SecurityGroupRule.builder().fromPort(80).id("218").ipProtocol(
+ IpProtocol.TCP).ipRange("0.0.0.0/0").parentGroupId("161").toPort(8080).build();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java
new file mode 100644
index 0000000..c0fb2df
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertNotNull;
+
+import java.util.Set;
+
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.domain.Ingress;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code SecurityGroupApi}
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "live", testName = "SecurityGroupApiLiveTest", singleThreaded = true)
+public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest {
+
+ public static final String SECURITY_GROUP_NAME = "testsg";
+
+ public void list() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get();
+ Set<? extends SecurityGroup> securityGroupsList = securityGroupApi.list().toSet();
+ assertNotNull(securityGroupsList);
+ }
+ }
+
+ public void createGetAndDeleteSecurityGroup() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get();
+ SecurityGroup securityGroup = null;
+ String id;
+ try {
+ securityGroup = securityGroupApi
+ .createWithDescription(SECURITY_GROUP_NAME, "test security group");
+ assertNotNull(securityGroup);
+ id = securityGroup.getId();
+ SecurityGroup theGroup = securityGroupApi.get(id);
+ assertNotNull(theGroup);
+ } finally {
+ if (securityGroup != null) {
+ securityGroupApi.delete(securityGroup.getId());
+ }
+ }
+ }
+ }
+
+ public void createAndDeleteSecurityGroupRule() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get();
+ SecurityGroup securityGroup = null;
+
+ try {
+ securityGroup = securityGroupApi.createWithDescription(SECURITY_GROUP_NAME, "test security group");
+ assertNotNull(securityGroup);
+
+ for (int port : ImmutableSet.of(22, 8080)) {
+ SecurityGroupRule rule = securityGroupApi.createRuleAllowingCidrBlock(securityGroup.getId(), Ingress
+ .builder().ipProtocol(IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0");
+ assertNotNull(rule);
+
+ SecurityGroupRule rule2 = securityGroupApi.createRuleAllowingSecurityGroupId(securityGroup.getId(),
+ Ingress.builder().ipProtocol(IpProtocol.TCP).fromPort(port).toPort(port).build(), securityGroup
+ .getId());
+
+ assertNotNull(rule2);
+ }
+ securityGroup = securityGroupApi.get(securityGroup.getId());
+
+ } finally {
+ if (securityGroup != null) {
+ securityGroupApi.delete(securityGroup.getId());
+ }
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiExpectTest.java
new file mode 100644
index 0000000..3eb9524
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiExpectTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests parsing and guice wiring of ServerWithSecurityGroupsApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "ServerWithSecurityGroupsApiExpectTest")
+public class ServerWithSecurityGroupsApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testGetServerWithSecurityGroups() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
+ ServerWithSecurityGroupsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_with_security_groups.json")).build()
+ ).getServerWithSecurityGroupsExtensionForZone("az-1.region-a.geo-1").get();
+
+ ServerWithSecurityGroups server = api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
+ assertEquals(server.getId(), "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
+ assertEquals(server.getSecurityGroupNames(), ImmutableSet.of("default", "group1"));
+ }
+
+ public void testGetServerWithSecurityGroupsFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
+ ServerWithSecurityGroupsApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getServerWithSecurityGroupsExtensionForZone("az-1.region-a.geo-1").get();
+ assertNull(api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java
new file mode 100644
index 0000000..a448253
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of ServerWithSecurityGroupsApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "ServerWithSecurityGroupsApiLiveTest", singleThreaded = true)
+public class ServerWithSecurityGroupsApiLiveTest extends BaseNovaApiLiveTest {
+ private ServerApi serverApi;
+ private Optional<? extends ServerWithSecurityGroupsApi> apiOption;
+ private String zone;
+
+ @BeforeGroups(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ serverApi = api.getServerApiForZone(zone);
+ apiOption = api.getServerWithSecurityGroupsExtensionForZone(zone);
+ }
+
+ public void testGetServer() {
+ if (apiOption.isPresent()) {
+
+ for (Resource server : serverApi.list().concat()) {
+ ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId());
+ assertEquals(serverWithGroups.getId(), server.getId());
+ assertEquals(serverWithGroups.getName(), server.getName());
+ assertNotNull(serverWithGroups.getSecurityGroupNames());
+ }
+
+ // Create a new server to verify the groups work as expected
+ Server testServer = null;
+ try {
+ testServer = createServerInZone(zone);
+
+ ServerWithSecurityGroups results = apiOption.get().get(testServer.getId());
+ assertEquals(results.getId(), testServer.getId());
+ assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default"));
+ } finally {
+ if (testServer != null) {
+ serverApi.delete(testServer.getId());
+ }
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiExpectTest.java
new file mode 100644
index 0000000..cfb2393
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiExpectTest.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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.jclouds.date.DateService;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.SimpleServerUsage;
+import org.jclouds.openstack.nova.v2_0.domain.SimpleTenantUsage;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests SimpleTenantUsageApi guice wiring and parsing
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "SimpleTenantUsageApiExpectTest")
+public class SimpleTenantUsageApiExpectTest extends BaseNovaApiExpectTest {
+ private DateService dateService = new SimpleDateFormatDateService();
+
+ public void testList() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-simple-tenant-usage");
+ SimpleTenantUsageApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/simple_tenant_usages.json")).build())
+ .getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends SimpleTenantUsage> results = api.list().toSet();
+
+ SimpleTenantUsage usage = Iterables.getOnlyElement(results);
+ assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921");
+ assertEquals(usage.getTotalHours(), 4.888888888888889e-07);
+ assertEquals(usage.getTotalLocalGbUsage(), 1.9555555555555557e-05);
+ assertEquals(usage.getTotalMemoryMbUsage(), 0.0015018666666666667);
+ assertEquals(usage.getTotalVcpusUsage(), 7.333333333333333e-07);
+ assertEquals(usage.getStart(), dateService.iso8601DateParse("2012-04-18 12:18:39.702411"));
+ assertEquals(usage.getStop(), dateService.iso8601DateParse("2012-04-18 12:18:39.702499"));
+ assertNotNull(usage.getServerUsages());
+ assertTrue(usage.getServerUsages().isEmpty());
+ }
+
+ public void testGet() throws Exception {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-simple-tenant-usage/test-1234");
+ SimpleTenantUsageApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ HttpRequest.builder().method("GET")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/simple_tenant_usage.json")).build())
+ .getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get();
+
+ SimpleTenantUsage usage = api.get("test-1234");
+ assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921");
+
+ SimpleTenantUsage expected = SimpleTenantUsage.builder().tenantId("f8535069c3fb404cb61c873b1a0b4921").totalHours(4.833333333333333E-7).totalLocalGbUsage(1.933333333333333E-05)
+ .start(dateService.iso8601DateParse("2012-04-18 13:32:07.255743")).stop(dateService.iso8601DateParse("2012-04-18 13:32:07.255743"))
+ .totalMemoryMbUsage(0.0014847999999999999).totalVcpusUsage(7.249999999999999E-07).serverUsages(
+ ImmutableSet.of(
+ SimpleServerUsage.builder().hours(2.4166666666666665e-07).uptime(91149).flavorLocalGb(50).instanceName("test1").tenantId("f8535069c3fb404cb61c873b1a0b4921").flavorVcpus(2).flavorMemoryMb(4096).instanceStatus(SimpleServerUsage.Status.ACTIVE).flavorName("m1.medium").instanceCreated(this.dateService.iso8601SecondsDateParse("2012-04-17T12:12:58")).build(),
+ SimpleServerUsage.builder().hours(2.4166666666666665e-07).uptime(84710).flavorLocalGb(30).instanceName("mish_test").tenantId("f8535069c3fb404cb61c873b1a0b4921").flavorVcpus(1).flavorMemoryMb(2048).instanceStatus(SimpleServerUsage.Status.ACTIVE).flavorName("m1.small").instanceCreated(this.dateService.iso8601SecondsDateParse("2012-04-17T14:00:17")).build()
+ )).build();
+
+ assertEquals(usage, expected);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java
new file mode 100644
index 0000000..f658d26
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertNotNull;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.SimpleTenantUsage;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+
+/**
+ * Tests behavior of SimpleTenantUsageApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "SimpleTenantUsageApiLiveTest")
+public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest {
+
+ public void testList() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ Optional<? extends SimpleTenantUsageApi> optApi = api.getSimpleTenantUsageExtensionForZone(zoneId);
+ if (optApi.isPresent() && identity.endsWith(":admin")) {
+ SimpleTenantUsageApi api = optApi.get();
+ Set<? extends SimpleTenantUsage> usages = api.list().toSet();
+ assertNotNull(usages);
+ for (SimpleTenantUsage usage : usages) {
+ SimpleTenantUsage details = api.get(usage.getTenantId());
+ assertNotNull(details);
+ }
+ }
+ }
+ }
+}
[10/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
deleted file mode 100644
index fc6744c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Aggregates can be manipulated using the Aggregate Extension to Nova (alias "OS-AGGREGATES")
- *
- * @see org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi
-*/
-public class HostAggregate {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromHostAggregate(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected String name;
- protected String availabilityZone;
- protected Set<String> hosts = ImmutableSet.of();
- protected String state;
- protected Date created;
- protected Date updated;
- protected Map<String, String> metadata = ImmutableMap.of();
-
- /**
- * @see HostAggregate#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see HostAggregate#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see HostAggregate#getAvailabilityZone()
- */
- public T availabilityZone(String availabilityZone) {
- this.availabilityZone = availabilityZone;
- return self();
- }
-
- /**
- * @see HostAggregate#getHosts()
- */
- public T hosts(Set<String> hosts) {
- this.hosts = ImmutableSet.copyOf(checkNotNull(hosts, "hosts"));
- return self();
- }
-
- public T hosts(String... in) {
- return hosts(ImmutableSet.copyOf(in));
- }
-
- /**
- * @see HostAggregate#getState()
- */
- public T state(String state) {
- this.state = state;
- return self();
- }
-
- /**
- * @see HostAggregate#getCreated()
- */
- public T created(Date created) {
- this.created = created;
- return self();
- }
-
- /**
- * @see HostAggregate#getUpdated()
- */
- public T updated(Date updated) {
- this.updated = updated;
- return self();
- }
-
- /**
- * @see HostAggregate#getMetadata()
- */
- public T metadata(Map<String, String> metadata) {
- this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
- return self();
- }
-
- public HostAggregate build() {
- return new HostAggregate(id, name, availabilityZone, hosts, state, created, updated, metadata);
- }
-
- public T fromHostAggregate(HostAggregate in) {
- return this
- .id(in.getId())
- .name(in.getName())
- .availabilityZone(in.getAvailabilityZone())
- .hosts(in.getHosts())
- .state(in.getState())
- .created(in.getCreated())
- .updated(in.getUpdated().get())
- .metadata(in.getMetadata());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- private final String name;
- @Named("availability_zone")
- private final String availabilityZone;
- private final Set<String> hosts;
- @Named("operational_state")
- private final String state;
- @Named("created_at")
- private final Date created;
- @Named("updated_at")
- private final Optional<Date> updated;
- private final Map<String, String> metadata;
-
- @ConstructorProperties({
- "id", "name", "availability_zone", "hosts", "operational_state", "created_at", "updated_at", "metadata"
- })
- protected HostAggregate(String id, String name, String availabilityZone, @Nullable Set<String> hosts, String state, Date created,
- @Nullable Date updated, @Nullable Map<String, String> metadata) {
- this.id = checkNotNull(id, "id");
- this.name = checkNotNull(name, "name");
- this.availabilityZone = checkNotNull(availabilityZone, "availabilityZone");
- this.hosts = hosts == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(hosts);
- this.state = checkNotNull(state, "state");
- this.created = checkNotNull(created, "created");
- this.updated = Optional.fromNullable(updated);
- this.metadata = metadata == null ? ImmutableMap.<String,String>of() : ImmutableMap.copyOf(metadata);
- }
-
- public String getId() {
- return this.id;
- }
-
- public String getName() {
- return this.name;
- }
-
- /**
- * note: an "Availability Zone" is different from a Nova "Zone"
- *
- * @return the availability zone this aggregate is in
- */
- public String getAvailabilityZone() {
- return this.availabilityZone;
- }
-
- public Set<String> getHosts() {
- return this.hosts;
- }
-
- public String getState() {
- return this.state;
- }
-
- public Date getCreated() {
- return this.created;
- }
-
- public Optional<Date> getUpdated() {
- return this.updated;
- }
-
- public Map<String, String> getMetadata() {
- return this.metadata;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, name, availabilityZone, hosts, state, created, updated, metadata);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- HostAggregate that = HostAggregate.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.availabilityZone, that.availabilityZone)
- && Objects.equal(this.hosts, that.hosts)
- && Objects.equal(this.state, that.state)
- && Objects.equal(this.created, that.created)
- && Objects.equal(this.updated, that.updated)
- && Objects.equal(this.metadata, that.metadata);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("name", name).add("availabilityZone", availabilityZone).add("hosts", hosts).add("state", state).add("created", created).add("updated", updated).add("metadata", metadata);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
deleted file mode 100644
index 186fb33..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Class HostResourceUsage
-*/
-public class HostResourceUsage {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromHostResourceUsage(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String host;
- protected String project;
- protected int memoryMb;
- protected int cpu;
- protected int diskGb;
-
- /**
- * @see HostResourceUsage#getHost()
- */
- public T host(String host) {
- this.host = host;
- return self();
- }
-
- /**
- * @see HostResourceUsage#getProject()
- */
- public T project(String project) {
- this.project = project;
- return self();
- }
-
- /**
- * @see HostResourceUsage#getMemoryMb()
- */
- public T memoryMb(int memoryMb) {
- this.memoryMb = memoryMb;
- return self();
- }
-
- /**
- * @see HostResourceUsage#getCpu()
- */
- public T cpu(int cpu) {
- this.cpu = cpu;
- return self();
- }
-
- /**
- * @see HostResourceUsage#getDiskGb()
- */
- public T diskGb(int diskGb) {
- this.diskGb = diskGb;
- return self();
- }
-
- public HostResourceUsage build() {
- return new HostResourceUsage(host, project, memoryMb, cpu, diskGb);
- }
-
- public T fromHostResourceUsage(HostResourceUsage in) {
- return this
- .host(in.getHost())
- .project(in.getProject())
- .memoryMb(in.getMemoryMb())
- .cpu(in.getCpu())
- .diskGb(in.getDiskGb());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String host;
- private final String project;
- @Named("memory_mb")
- private final int memoryMb;
- private final int cpu;
- @Named("disk_gb")
- private final int diskGb;
-
- @ConstructorProperties({
- "host", "project", "memory_mb", "cpu", "disk_gb"
- })
- protected HostResourceUsage(String host, @Nullable String project, int memoryMb, int cpu, int diskGb) {
- this.host = checkNotNull(host, "host");
- this.project = project;
- this.memoryMb = memoryMb;
- this.cpu = cpu;
- this.diskGb = diskGb;
- }
-
- public String getHost() {
- return this.host;
- }
-
- @Nullable
- public String getProject() {
- return this.project;
- }
-
- public int getMemoryMb() {
- return this.memoryMb;
- }
-
- public int getCpu() {
- return this.cpu;
- }
-
- public int getDiskGb() {
- return this.diskGb;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(host, project, memoryMb, cpu, diskGb);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- HostResourceUsage that = HostResourceUsage.class.cast(obj);
- return Objects.equal(this.host, that.host)
- && Objects.equal(this.project, that.project)
- && Objects.equal(this.memoryMb, that.memoryMb)
- && Objects.equal(this.cpu, that.cpu)
- && Objects.equal(this.diskGb, that.diskGb);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("host", host).add("project", project).add("memoryMb", memoryMb).add("cpu", cpu).add("diskGb", diskGb);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
deleted file mode 100644
index 65cc81d..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-import java.util.Map;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * An image is a collection of files you use to create or rebuild a server. Operators provide
- * pre-built OS images by default. You may also create custom images.
- *
- * @author Jeremy Daggett
- * @see <a href= "http://docs.openstack.org/api/openstack-compute/1.1/content/Images-d1e4427.html"
- />
-*/
-public class Image extends Resource {
-
- /**
- * In-flight images will have the status attribute set to SAVING and the conditional progress
- * element (0-100% completion) will also be returned. Other possible values for the status
- * attribute include: UNKNOWN, ACTIVE, SAVING, ERROR, and DELETED. Images with an ACTIVE status
- * are available for install. The optional minDisk and minRam attributes set the minimum disk and
- * RAM requirements needed to create a server with the image.
- *
- * @author Adrian Cole
- */
- public static enum Status {
-
- UNRECOGNIZED, UNKNOWN, ACTIVE, SAVING, ERROR, DELETED;
-
- public String value() {
- return name();
- }
-
- public static Status fromValue(String v) {
- try {
- return valueOf(v);
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
- }
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromImage(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Resource.Builder<T> {
- protected Date updated;
- protected Date created;
- protected String tenantId;
- protected String userId;
- protected Image.Status status;
- protected int progress;
- protected int minDisk;
- protected int minRam;
- protected Resource server;
- protected Map<String, String> metadata = ImmutableMap.of();
-
- /**
- * @see Image#getUpdated()
- */
- public T updated(Date updated) {
- this.updated = updated;
- return self();
- }
-
- /**
- * @see Image#getCreated()
- */
- public T created(Date created) {
- this.created = created;
- return self();
- }
-
- /**
- * @see Image#getTenantId()
- */
- public T tenantId(String tenantId) {
- this.tenantId = tenantId;
- return self();
- }
-
- /**
- * @see Image#getUserId()
- */
- public T userId(String userId) {
- this.userId = userId;
- return self();
- }
-
- /**
- * @see Image#getStatus()
- */
- public T status(Image.Status status) {
- this.status = status;
- return self();
- }
-
- /**
- * @see Image#getProgress()
- */
- public T progress(int progress) {
- this.progress = progress;
- return self();
- }
-
- /**
- * @see Image#getMinDisk()
- */
- public T minDisk(int minDisk) {
- this.minDisk = minDisk;
- return self();
- }
-
- /**
- * @see Image#getMinRam()
- */
- public T minRam(int minRam) {
- this.minRam = minRam;
- return self();
- }
-
- /**
- * @see Image#getServer()
- */
- public T server(Resource server) {
- this.server = server;
- return self();
- }
-
- /**
- * @see Image#getMetadata()
- */
- public T metadata(Map<String, String> metadata) {
- this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
- return self();
- }
-
- public Image build() {
- return new Image(id, name, links, updated, created, tenantId, userId, status, progress, minDisk, minRam, server, metadata);
- }
-
- public T fromImage(Image in) {
- return super.fromResource(in)
- .updated(in.getUpdated())
- .created(in.getCreated())
- .tenantId(in.getTenantId())
- .userId(in.getUserId())
- .status(in.getStatus())
- .progress(in.getProgress())
- .minDisk(in.getMinDisk())
- .minRam(in.getMinRam())
- .server(in.getServer())
- .metadata(in.getMetadata());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Date updated;
- private final Date created;
- @Named("tenant_id")
- private final String tenantId;
- @Named("user_id")
- private final String userId;
- private final Image.Status status;
- private final int progress;
- private final int minDisk;
- private final int minRam;
- private final Resource server;
- private final Map<String, String> metadata;
-
- @ConstructorProperties({
- "id", "name", "links", "updated", "created", "tenant_id", "user_id", "status", "progress", "minDisk", "minRam", "server", "metadata"
- })
- protected Image(String id, @Nullable String name, java.util.Set<Link> links, @Nullable Date updated, @Nullable Date created,
- String tenantId, @Nullable String userId, @Nullable Status status, int progress, int minDisk, int minRam,
- @Nullable Resource server, @Nullable Map<String, String> metadata) {
- super(id, name, links);
- this.updated = updated;
- this.created = created;
- this.tenantId = tenantId;
- this.userId = userId;
- this.status = status;
- this.progress = progress;
- this.minDisk = minDisk;
- this.minRam = minRam;
- this.server = server;
- this.metadata = metadata == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(metadata);
- }
-
- @Nullable
- public Date getUpdated() {
- return this.updated;
- }
-
- @Nullable
- public Date getCreated() {
- return this.created;
- }
-
- @Nullable
- public String getTenantId() {
- return this.tenantId;
- }
-
- @Nullable
- public String getUserId() {
- return this.userId;
- }
-
- @Nullable
- public Status getStatus() {
- return this.status;
- }
-
- public int getProgress() {
- return this.progress;
- }
-
- public int getMinDisk() {
- return this.minDisk;
- }
-
- public int getMinRam() {
- return this.minRam;
- }
-
- @Nullable
- public Resource getServer() {
- return this.server;
- }
-
- public Map<String, String> getMetadata() {
- return this.metadata;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(updated, created, tenantId, userId, status, progress, minDisk, minRam, server, metadata);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Image that = Image.class.cast(obj);
- return super.equals(that) && Objects.equal(this.updated, that.updated)
- && Objects.equal(this.created, that.created)
- && Objects.equal(this.tenantId, that.tenantId)
- && Objects.equal(this.userId, that.userId)
- && Objects.equal(this.status, that.status)
- && Objects.equal(this.progress, that.progress)
- && Objects.equal(this.minDisk, that.minDisk)
- && Objects.equal(this.minRam, that.minRam)
- && Objects.equal(this.server, that.server)
- && Objects.equal(this.metadata, that.metadata);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("updated", updated).add("created", created).add("tenantId", tenantId).add("userId", userId).add("status", status).add("progress", progress).add("minDisk", minDisk).add("minRam", minRam).add("server", server).add("metadata", metadata);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
deleted file mode 100644
index 3a9322d..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.net.domain.IpProtocol;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Ingress access to a destination protocol on particular ports
- *
- * @author Adrian Cole
-*/
-@Beta
-public class Ingress {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromIngress(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected IpProtocol ipProtocol;
- protected int fromPort;
- protected int toPort;
-
- /**
- * @see Ingress#getIpProtocol()
- */
- public T ipProtocol(IpProtocol ipProtocol) {
- this.ipProtocol = ipProtocol;
- return self();
- }
-
- /**
- * @see Ingress#getFromPort()
- */
- public T fromPort(int fromPort) {
- this.fromPort = fromPort;
- return self();
- }
-
- /**
- * @see Ingress#getToPort()
- */
- public T toPort(int toPort) {
- this.toPort = toPort;
- return self();
- }
-
- public Ingress build() {
- return new Ingress(ipProtocol, fromPort, toPort);
- }
-
- public T fromIngress(Ingress in) {
- return this
- .ipProtocol(in.getIpProtocol())
- .fromPort(in.getFromPort())
- .toPort(in.getToPort());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("ip_protocol")
- private final IpProtocol ipProtocol;
- @Named("from_port")
- private final int fromPort;
- @Named("to_port")
- private final int toPort;
-
- @ConstructorProperties({
- "ip_protocol", "from_port", "to_port"
- })
- protected Ingress(@Nullable IpProtocol ipProtocol, int fromPort, int toPort) {
- this.ipProtocol = ipProtocol == null ? IpProtocol.UNRECOGNIZED : ipProtocol;
- this.fromPort = fromPort;
- this.toPort = toPort;
- }
-
- /**
- * destination IP protocol
- */
- public IpProtocol getIpProtocol() {
- return this.ipProtocol;
- }
-
- /**
- * Start of destination port range for the TCP and UDP protocols, or an ICMP type number. An ICMP
- * type number of -1 indicates a wildcard (i.e., any ICMP type number).
- */
- public int getFromPort() {
- return this.fromPort;
- }
-
- /**
- * End of destination port range for the TCP and UDP protocols, or an ICMP code. An ICMP code of
- * -1 indicates a wildcard (i.e., any ICMP code).
- */
- public int getToPort() {
- return this.toPort;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(ipProtocol, fromPort, toPort);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Ingress that = Ingress.class.cast(obj);
- return Objects.equal(this.ipProtocol, that.ipProtocol)
- && Objects.equal(this.fromPort, that.fromPort)
- && Objects.equal(this.toPort, that.toPort);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("ipProtocol", ipProtocol).add("fromPort", fromPort).add("toPort", toPort);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
deleted file mode 100644
index aded550..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Class KeyPair
-*/
-public class KeyPair {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromKeyPair(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String publicKey;
- protected String privateKey;
- protected String userId;
- protected String name;
- protected String fingerprint;
-
- /**
- * @see KeyPair#getPublicKey()
- */
- public T publicKey(String publicKey) {
- this.publicKey = publicKey;
- return self();
- }
-
- /**
- * @see KeyPair#getPrivateKey()
- */
- public T privateKey(String privateKey) {
- this.privateKey = privateKey;
- return self();
- }
-
- /**
- * @see KeyPair#getUserId()
- */
- public T userId(String userId) {
- this.userId = userId;
- return self();
- }
-
- /**
- * @see KeyPair#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see KeyPair#getFingerprint()
- */
- public T fingerprint(String fingerprint) {
- this.fingerprint = fingerprint;
- return self();
- }
-
- public KeyPair build() {
- return new KeyPair(publicKey, privateKey, userId, name, fingerprint);
- }
-
- public T fromKeyPair(KeyPair in) {
- return this
- .publicKey(in.getPublicKey())
- .privateKey(in.getPrivateKey())
- .userId(in.getUserId())
- .name(in.getName())
- .fingerprint(in.getFingerprint());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("public_key")
- private final String publicKey;
- @Named("private_key")
- private final String privateKey;
- @Named("user_id")
- private final String userId;
- private final String name;
- private final String fingerprint;
-
- @ConstructorProperties({
- "public_key", "private_key", "user_id", "name", "fingerprint"
- })
- protected KeyPair(@Nullable String publicKey, @Nullable String privateKey, @Nullable String userId, String name, @Nullable String fingerprint) {
- this.publicKey = publicKey;
- this.privateKey = privateKey;
- this.userId = userId;
- this.name = checkNotNull(name, "name");
- this.fingerprint = fingerprint;
- }
-
- @Nullable
- public String getPublicKey() {
- return this.publicKey;
- }
-
- @Nullable
- public String getPrivateKey() {
- return this.privateKey;
- }
-
- @Nullable
- public String getUserId() {
- return this.userId;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Nullable
- public String getFingerprint() {
- return this.fingerprint;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(publicKey, privateKey, userId, name, fingerprint);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- KeyPair that = KeyPair.class.cast(obj);
- return Objects.equal(this.publicKey, that.publicKey)
- && Objects.equal(this.privateKey, that.privateKey)
- && Objects.equal(this.userId, that.userId)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.fingerprint, that.fingerprint);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper("")
- .omitNullValues()
- .add("public_key", publicKey)
- .add("private_key", privateKey)
- .add("user_id", userId)
- .add("name", name)
- .add("fingerprint", fingerprint);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
deleted file mode 100644
index 516f6e1..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-/**
- * Nova (or Neutron) network definition
- * Used to provide support for network, port, and fixed_ip when booting Nova servers.
- * OpenStack will support either a Nova Network or Neutron, but not both at the same time.
- * Specifying a port is only possible with Neutron.
- * @author Zack Shoylev
- */
-public class Network implements Comparable<Network> {
- private final String networkUuid;
- private final String portUuid;
- private final String fixedIp;
-
- @ConstructorProperties({
- "networkUuid", "portUuid", "fixedIp"
- })
- protected Network(String networkUuid, String portUuid, String fixedIp) {
- checkArgument(networkUuid != null || portUuid != null, "At least one of networkUuid or portUuid should be specified");
- this.networkUuid = networkUuid;
- this.portUuid = portUuid;
- this.fixedIp = fixedIp;
- }
-
- /**
- * @return the network uuid - Neutron or Nova
- */
- public String getNetworkUuid() {
- return this.networkUuid;
- }
-
- /**
- * @return the port uuid - Neutron only
- */
- public String getPortUuid() {
- return this.portUuid;
- }
-
- /**
- * @return the fixed IP address - Neutron or Nova
- */
- public String getFixedIp() {
- return this.fixedIp;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(networkUuid, portUuid, fixedIp);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Network that = Network.class.cast(obj);
- return Objects.equal(this.networkUuid, that.networkUuid) &&
- Objects.equal(this.portUuid, that.portUuid) &&
- Objects.equal(this.fixedIp, that.fixedIp);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("networkUuid", networkUuid)
- .add("portUuid", portUuid)
- .add("fixedIp", fixedIp);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- /**
- * @return A new builder object
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * @return A new Builder object from another Network
- */
- public Builder toBuilder() {
- return new Builder().fromNetwork(this);
- }
-
- /**
- * Implements the Builder pattern for this class
- */
- public static class Builder {
- protected String networkUuid;
- protected String portUuid;
- protected String fixedIp;
-
- /**
- * @param networkUuid The UUID for the Nova network or Neutron subnet to be attached.
- * @return The builder object.
- * @see Network#getNetworkUuid()
- */
- public Builder networkUuid(String networkUuid) {
- this.networkUuid = networkUuid;
- return this;
- }
-
- /**
- * @param portUuid The port UUID for this Neutron Network.
- * @return The builder object.
- * @see Network#getPortUuid()
- */
- public Builder portUuid(String portUuid) {
- this.portUuid = portUuid;
- return this;
- }
-
- /**
- * @param fixedIp The fixed IP address for this Network (if any).
- * Service automatically assigns IP address if this is not provided.
- * Fixed IP is compatible with both Nova Network and Neutron.
- * @return The builder object.
- * @see Network#getFixedIp()
- */
- public Builder fixedIp(String fixedIp) {
- this.fixedIp = fixedIp;
- return this;
- }
-
- /**
- * @return A new Network object.
- */
- public Network build() {
- return new Network(networkUuid, portUuid, fixedIp);
- }
-
- /**
- * @param in The target Network
- * @return A Builder from the provided Network
- */
- public Builder fromNetwork(Network in) {
- return this
- .networkUuid(in.getNetworkUuid())
- .portUuid(in.getPortUuid())
- .fixedIp(in.getFixedIp());
- }
- }
-
- @Override
- public int compareTo(Network that) {
- return this.toString().compareTo(that.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
deleted file mode 100644
index c16693e..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Represents the set of limits (quotas) returned by the Quota Extension
- *
- * @see org.jclouds.openstack.nova.v2_0.extensions.QuotaApi
-*/
-public class Quota {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromQuotas(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected int metadataItems;
- protected int injectedFileContentBytes;
- protected int volumes;
- protected int gigabytes;
- protected int ram;
- protected int floatingIps;
- protected int instances;
- protected int injectedFiles;
- protected int cores;
- protected int securityGroups;
- protected int securityGroupRules;
- protected int keyPairs;
-
- /**
- * @see Quota#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see Quota#getMetadatas()
- */
- public T metadataItems(int metadataItems) {
- this.metadataItems = metadataItems;
- return self();
- }
-
- /**
- * @see Quota#getInjectedFileContentBytes()
- */
- public T injectedFileContentBytes(int injectedFileContentBytes) {
- this.injectedFileContentBytes = injectedFileContentBytes;
- return self();
- }
-
- /**
- * @see Quota#getVolumes()
- */
- public T volumes(int volumes) {
- this.volumes = volumes;
- return self();
- }
-
- /**
- * @see Quota#getGigabytes()
- */
- public T gigabytes(int gigabytes) {
- this.gigabytes = gigabytes;
- return self();
- }
-
- /**
- * @see Quota#getRam()
- */
- public T ram(int ram) {
- this.ram = ram;
- return self();
- }
-
- /**
- * @see Quota#getFloatingIps()
- */
- public T floatingIps(int floatingIps) {
- this.floatingIps = floatingIps;
- return self();
- }
-
- /**
- * @see Quota#getInstances()
- */
- public T instances(int instances) {
- this.instances = instances;
- return self();
- }
-
- /**
- * @see Quota#getInjectedFiles()
- */
- public T injectedFiles(int injectedFiles) {
- this.injectedFiles = injectedFiles;
- return self();
- }
-
- /**
- * @see Quota#getCores()
- */
- public T cores(int cores) {
- this.cores = cores;
- return self();
- }
-
- /**
- * @see Quota#getSecurityGroups()
- */
- public T securityGroups(int securityGroups) {
- this.securityGroups = securityGroups;
- return self();
- }
-
- /**
- * @see Quota#getSecurityGroupRules()
- */
- public T securityGroupRules(int securityGroupRules) {
- this.securityGroupRules = securityGroupRules;
- return self();
- }
-
- /**
- * @see Quota#getKeyPairs()
- */
- public T keyPairs(int keyPairs) {
- this.keyPairs = keyPairs;
- return self();
- }
-
- public Quota build() {
- return new Quota(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
- }
-
- public T fromQuotas(Quota in) {
- return this
- .id(in.getId())
- .metadataItems(in.getMetadatas())
- .injectedFileContentBytes(in.getInjectedFileContentBytes())
- .volumes(in.getVolumes())
- .gigabytes(in.getGigabytes())
- .ram(in.getRam())
- .floatingIps(in.getFloatingIps())
- .instances(in.getInstances())
- .injectedFiles(in.getInjectedFiles())
- .cores(in.getCores())
- .securityGroups(in.getSecurityGroups())
- .securityGroupRules(in.getSecurityGroupRules())
- .keyPairs(in.getKeyPairs());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- @Named("metadata_items")
- private final int metadataItems;
- @Named("injected_file_content_bytes")
- private final int injectedFileContentBytes;
- private final int volumes;
- private final int gigabytes;
- private final int ram;
- @Named("floating_ips")
- private final int floatingIps;
- private final int instances;
- @Named("injected_files")
- private final int injectedFiles;
- private final int cores;
- @Named("security_groups")
- private final int securityGroups;
- @Named("security_group_rules")
- private final int securityGroupRules;
- @Named("key_pairs")
- private final int keyPairs;
-
- @ConstructorProperties({
- "id", "metadata_items", "injected_file_content_bytes", "volumes", "gigabytes", "ram", "floating_ips", "instances", "injected_files", "cores", "security_groups", "security_group_rules", "key_pairs"
- })
- protected Quota(String id, int metadataItems, int injectedFileContentBytes, int volumes, int gigabytes, int ram, int floatingIps, int instances, int injectedFiles, int cores, int securityGroups, int securityGroupRules, int keyPairs) {
- this.id = checkNotNull(id, "id");
- this.metadataItems = metadataItems;
- this.injectedFileContentBytes = injectedFileContentBytes;
- this.volumes = volumes;
- this.gigabytes = gigabytes;
- this.ram = ram;
- this.floatingIps = floatingIps;
- this.instances = instances;
- this.injectedFiles = injectedFiles;
- this.cores = cores;
- this.securityGroups = securityGroups;
- this.securityGroupRules = securityGroupRules;
- this.keyPairs = keyPairs;
- }
-
- /**
- * The id of the tenant this set of limits applies to
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * The limit of the number of metadata items for the tenant
- */
- public int getMetadatas() {
- return this.metadataItems;
- }
-
- public int getInjectedFileContentBytes() {
- return this.injectedFileContentBytes;
- }
-
- /**
- * The limit of the number of volumes that can be created for the tenant
- */
- public int getVolumes() {
- return this.volumes;
- }
-
- /**
- * The limit of the total size of all volumes for the tenant
- */
- public int getGigabytes() {
- return this.gigabytes;
- }
-
- /**
- * The limit of total ram available to the tenant
- */
- public int getRam() {
- return this.ram;
- }
-
- /**
- * The limit of the number of floating ips for the tenant
- */
- public int getFloatingIps() {
- return this.floatingIps;
- }
-
- /**
- * The limit of the number of instances that can be created for the tenant
- */
- public int getInstances() {
- return this.instances;
- }
-
- public int getInjectedFiles() {
- return this.injectedFiles;
- }
-
- /**
- * The limit of the number of cores that can be used by the tenant
- */
- public int getCores() {
- return this.cores;
- }
-
- /**
- * @return the limit of the number of security groups that can be created for the tenant
- * @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi
- */
- public int getSecurityGroups() {
- return this.securityGroups;
- }
-
- /**
- * @return the limit of the number of security group rules that can be created for the tenant
- * @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi
- */
- public int getSecurityGroupRules() {
- return this.securityGroupRules;
- }
-
- /**
- * @return the limit of the number of key pairs that can be created for the tenant
- * @see org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi
- */
- public int getKeyPairs() {
- return this.keyPairs;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Quota that = Quota.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.metadataItems, that.metadataItems)
- && Objects.equal(this.injectedFileContentBytes, that.injectedFileContentBytes)
- && Objects.equal(this.volumes, that.volumes)
- && Objects.equal(this.gigabytes, that.gigabytes)
- && Objects.equal(this.ram, that.ram)
- && Objects.equal(this.floatingIps, that.floatingIps)
- && Objects.equal(this.instances, that.instances)
- && Objects.equal(this.injectedFiles, that.injectedFiles)
- && Objects.equal(this.cores, that.cores)
- && Objects.equal(this.securityGroups, that.securityGroups)
- && Objects.equal(this.securityGroupRules, that.securityGroupRules)
- && Objects.equal(this.keyPairs, that.keyPairs);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("metadataItems", metadataItems).add("injectedFileContentBytes", injectedFileContentBytes).add("volumes", volumes).add("gigabytes", gigabytes).add("ram", ram).add("floatingIps", floatingIps).add("instances", instances).add("injectedFiles", injectedFiles).add("cores", cores).add("securityGroups", securityGroups).add("securityGroupRules", securityGroupRules).add("keyPairs", keyPairs);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
deleted file mode 100644
index 27199ef..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import java.beans.ConstructorProperties;
-
-/**
- * Represents the set of limits (quota class) returned by the Quota Class Extension
- *
- * @see org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi
-*/
-public class QuotaClass extends Quota {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromQuotaClass(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Quota.Builder<T> {
-
- public QuotaClass build() {
- return new QuotaClass(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
- }
-
- public T fromQuotaClass(QuotaClass in) {
- return super.fromQuotas(in);
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
-
- @ConstructorProperties({
- "id", "metadata_items", "injected_file_content_bytes", "volumes", "gigabytes", "ram", "floating_ips", "instances", "injected_files", "cores", "security_groups", "security_group_rules", "key_pairs"
- })
- protected QuotaClass(String id, int metadataItems, int injectedFileContentBytes, int volumes, int gigabytes, int ram, int floatingIps, int instances, int injectedFiles, int cores, int securityGroups, int securityGroupRules, int keyPairs) {
- super(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
deleted file mode 100644
index 453dd77..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-/**
- *
- * @author Adrian Cole
- */
-public enum RebootType {
-
- HARD, SOFT;
-
- public String value() {
- return name();
- }
-
- public static RebootType fromValue(String v) {
- return valueOf(v);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
deleted file mode 100644
index a0e2085..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Set;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Defines a security group
-*/
-public class SecurityGroup {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromSecurityGroup(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected String tenantId;
- protected String name;
- protected String description;
- protected Set<SecurityGroupRule> rules = ImmutableSet.of();
-
- /**
- * @see SecurityGroup#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see SecurityGroup#getTenantId()
- */
- public T tenantId(String tenantId) {
- this.tenantId = tenantId;
- return self();
- }
-
- /**
- * @see SecurityGroup#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see SecurityGroup#getDescription()
- */
- public T description(String description) {
- this.description = description;
- return self();
- }
-
- /**
- * @see SecurityGroup#getRules()
- */
- public T rules(Set<SecurityGroupRule> rules) {
- this.rules = ImmutableSet.copyOf(checkNotNull(rules, "rules"));
- return self();
- }
-
- public T rules(SecurityGroupRule... in) {
- return rules(ImmutableSet.copyOf(in));
- }
-
- public SecurityGroup build() {
- return new SecurityGroup(id, tenantId, name, description, rules);
- }
-
- public T fromSecurityGroup(SecurityGroup in) {
- return this
- .id(in.getId())
- .tenantId(in.getTenantId())
- .name(in.getName())
- .description(in.getDescription())
- .rules(in.getRules());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- @Named("tenant_id")
- private final String tenantId;
- private final String name;
- private final String description;
- private final Set<SecurityGroupRule> rules;
-
- @ConstructorProperties({
- "id", "tenant_id", "name", "description", "rules"
- })
- protected SecurityGroup(String id, @Nullable String tenantId, @Nullable String name, @Nullable String description, Set<SecurityGroupRule> rules) {
- this.id = checkNotNull(id, "id");
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- // if empty, leave null so this doesn't serialize to json
- this.rules = checkNotNull(rules, "rules").size() == 0 ? null : ImmutableSet.copyOf(rules);
- }
-
- public String getId() {
- return this.id;
- }
-
- @Nullable
- public String getTenantId() {
- return this.tenantId;
- }
-
- @Nullable
- public String getName() {
- return this.name;
- }
-
- @Nullable
- public String getDescription() {
- return this.description;
- }
-
- public Set<SecurityGroupRule> getRules() {
- return this.rules;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, tenantId, name, description, rules);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- SecurityGroup that = SecurityGroup.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.tenantId, that.tenantId)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.description, that.description)
- && Objects.equal(this.rules, that.rules);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("tenantId", tenantId).add("name", name).add("description", description).add("rules", rules);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
deleted file mode 100644
index 92d58f7..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.net.domain.IpProtocol;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ForwardingObject;
-
-/**
- * Defines a security group rule
- */
-public class SecurityGroupRule extends Ingress {
-
- public static class Cidr extends ForwardingObject {
- private String cidr;
-
- @ConstructorProperties("cidr")
- protected Cidr(String cidr) {
- this.cidr = checkNotNull(cidr);
- }
-
- @Override
- protected Object delegate() {
- return cidr;
- }
- }
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromSecurityGroupRule(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Ingress.Builder<T> {
- protected String id;
- protected TenantIdAndName group;
- protected String parentGroupId;
- protected String ipRange;
-
- /**
- * @see SecurityGroupRule#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see SecurityGroupRule#getGroup()
- */
- public T group(TenantIdAndName group) {
- this.group = group;
- return self();
- }
-
- /**
- * @see SecurityGroupRule#getParentGroupId()
- */
- public T parentGroupId(String parentGroupId) {
- this.parentGroupId = parentGroupId;
- return self();
- }
-
- /**
- * @see SecurityGroupRule#getIpRange()
- */
- public T ipRange(String ipRange) {
- this.ipRange = ipRange;
- return self();
- }
-
- public SecurityGroupRule build() {
- return new SecurityGroupRule(ipProtocol, fromPort, toPort, id, group, parentGroupId, ipRange == null ? null : new Cidr(ipRange));
- }
-
- public T fromSecurityGroupRule(SecurityGroupRule in) {
- return super.fromIngress(in)
- .id(in.getId())
- .group(in.getGroup())
- .parentGroupId(in.getParentGroupId())
- .ipRange(in.getIpRange());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- private final TenantIdAndName group;
- @Named("parent_group_id")
- private final String parentGroupId;
- @Named("ip_range")
- private final SecurityGroupRule.Cidr ipRange;
-
- @ConstructorProperties({
- "ip_protocol", "from_port", "to_port", "id", "group", "parent_group_id", "ip_range"
- })
- protected SecurityGroupRule(IpProtocol ipProtocol, int fromPort, int toPort, String id, @Nullable TenantIdAndName group, String parentGroupId, @Nullable Cidr ipRange) {
- super(ipProtocol, fromPort, toPort);
- this.id = checkNotNull(id, "id");
- this.group = group;
- this.parentGroupId = checkNotNull(parentGroupId, "parentGroupId");
- this.ipRange = ipRange;
- }
-
- public String getId() {
- return this.id;
- }
-
- @Nullable
- public TenantIdAndName getGroup() {
- return this.group;
- }
-
- public String getParentGroupId() {
- return this.parentGroupId;
- }
-
- @Nullable
- public String getIpRange() {
- return ipRange == null ? null : ipRange.cidr;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, group, parentGroupId, ipRange);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- SecurityGroupRule that = SecurityGroupRule.class.cast(obj);
- return super.equals(that) && Objects.equal(this.id, that.id)
- && Objects.equal(this.group, that.group)
- && Objects.equal(this.parentGroupId, that.parentGroupId)
- && Objects.equal(this.ipRange, that.ipRange);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("id", id).add("group", group).add("parentGroupId", parentGroupId).add("ipRange", ipRange);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
deleted file mode 100644
index a7b316a..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Date;
-import java.util.Map;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-
-/**
- * A server is a virtual machine instance in the compute system. Flavor and image are requisite
- * elements when creating a server.
- *
- * @author Adrian Cole
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
- * />
- */
-public class Server extends Resource {
- public static final String DISK_CONFIG_MANUAL = "MANUAL";
- public static final String DISK_CONFIG_AUTO = "AUTO";
-
- /**
- * Servers contain a status attribute that can be used as an indication of the current server
- * state. Servers with an ACTIVE status are available for use.
- * <p/>
- * Other possible values for the status attribute include: BUILD, REBUILD, SUSPENDED, RESIZE,
- * VERIFY_RESIZE, REVERT_RESIZE, PASSWORD, REBOOT, HARD_REBOOT, DELETED, UNKNOWN, and ERROR.
- *
- * @author Adrian Cole
- */
- public static enum Status {
-
- ACTIVE, BUILD, REBUILD, SUSPENDED, PAUSED, RESIZE, VERIFY_RESIZE, REVERT_RESIZE, PASSWORD, REBOOT, HARD_REBOOT, DELETED, UNKNOWN, ERROR, STOPPED, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static Status fromValue(String v) {
- try {
- return valueOf(v.replaceAll("\\(.*", ""));
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
- }
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromServer(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Resource.Builder<T> {
- protected String uuid;
- protected String tenantId;
- protected String userId;
- protected Date updated;
- protected Date created;
- protected String hostId;
- protected String accessIPv4;
- protected String accessIPv6;
- protected Server.Status status;
- protected Resource image;
- protected Resource flavor;
- protected String keyName;
- protected String configDrive;
- protected Multimap<String, Address> addresses = ImmutableMultimap.of();
- protected Map<String, String> metadata = ImmutableMap.of();
- protected ServerExtendedStatus extendedStatus;
- protected ServerExtendedAttributes extendedAttributes;
- protected String diskConfig;
-
- /**
- * @see Server#getUuid()
- */
- public T uuid(String uuid) {
- this.uuid = uuid;
- return self();
- }
-
- /**
- * @see Server#getTenantId()
- */
- public T tenantId(String tenantId) {
- this.tenantId = tenantId;
- return self();
- }
-
- /**
- * @see Server#getUserId()
- */
- public T userId(String userId) {
- this.userId = userId;
- return self();
- }
-
- /**
- * @see Server#getUpdated()
- */
- public T updated(Date updated) {
- this.updated = updated;
- return self();
- }
-
- /**
- * @see Server#getCreated()
- */
- public T created(Date created) {
- this.created = created;
- return self();
- }
-
- /**
- * @see Server#getHostId()
- */
- public T hostId(String hostId) {
- this.hostId = hostId;
- return self();
- }
-
- /**
- * @see Server#getAccessIPv4()
- */
- public T accessIPv4(String accessIPv4) {
- this.accessIPv4 = accessIPv4;
- return self();
- }
-
- /**
- * @see Server#getAccessIPv6()
- */
- public T accessIPv6(String accessIPv6) {
- this.accessIPv6 = accessIPv6;
- return self();
- }
-
- /**
- * @see Server#getStatus()
- */
- public T status(Server.Status status) {
- this.status = status;
- return self();
- }
-
- /**
- * @see Server#getImage()
- */
- public T image(Resource image) {
- this.image = image;
- return self();
- }
-
- /**
- * @see Server#getFlavor()
- */
- public T flavor(Resource flavor) {
- this.flavor = flavor;
- return self();
- }
-
- /**
- * @see Server#getKeyName()
- */
- public T keyName(String keyName) {
- this.keyName = keyName;
- return self();
- }
-
- /**
- * @see Server#getConfigDrive()
- */
- public T configDrive(String configDrive) {
- this.configDrive = configDrive;
- return self();
- }
-
- /**
- * @see Server#getAddresses()
- */
- public T addresses(Multimap<String, Address> addresses) {
- this.addresses = addresses;
- return self();
- }
-
- /**
- * @see Server#getMetadata()
- */
- public T metadata(Map<String, String> metadata) {
- this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
- return self();
- }
-
- /**
- * @see Server#getExtendedStatus()
- */
- public T extendedStatus(ServerExtendedStatus extendedStatus) {
- this.extendedStatus = extendedStatus;
- return self();
- }
-
- /**
- * @see Server#getExtendedAttributes()
- */
- public T extendedAttributes(ServerExtendedAttributes extendedAttributes) {
- this.extendedAttributes = extendedAttributes;
- return self();
- }
-
- /**
- * @see Server#getDiskConfig()
- */
- public T diskConfig(String diskConfig) {
- this.diskConfig = diskConfig;
- return self();
- }
-
- public Server build() {
- return new Server(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6,
- status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus,
- extendedAttributes, diskConfig);
- }
-
- public T fromServer(Server in) {
- return super.fromResource(in)
- .uuid(in.getUuid())
- .tenantId(in.getTenantId())
- .userId(in.getUserId())
- .updated(in.getUpdated())
- .created(in.getCreated())
- .hostId(in.getHostId())
- .accessIPv4(in.getAccessIPv4())
- .accessIPv6(in.getAccessIPv6())
- .status(in.getStatus())
- .image(in.getImage())
- .flavor(in.getFlavor())
- .keyName(in.getKeyName())
- .configDrive(in.getConfigDrive())
- .addresses(in.getAddresses())
- .metadata(in.getMetadata())
- .extendedStatus(in.getExtendedStatus().orNull())
- .extendedAttributes(in.getExtendedAttributes().orNull())
- .diskConfig(in.getDiskConfig().orNull());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String uuid;
- @Named("tenant_id")
- private final String tenantId;
- @Named("user_id")
- private final String userId;
- private final Date updated;
- private final Date created;
- private final String hostId;
- private final String accessIPv4;
- private final String accessIPv6;
- private final Server.Status status;
- private final Resource image;
- private final Resource flavor;
- @Named("key_name")
- private final String keyName;
- @Named("config_drive")
- private final String configDrive;
- private final Multimap<String, Address> addresses;
- private final Map<String, String> metadata;
- private final Optional<ServerExtendedStatus> extendedStatus;
- private final Optional<ServerExtendedAttributes> extendedAttributes;
- @Named("OS-DCF:diskConfig")
- private final Optional<String> diskConfig;
-
- @ConstructorProperties({
- "id", "name", "links", "uuid", "tenant_id", "user_id", "updated", "created", "hostId", "accessIPv4", "accessIPv6", "status", "image", "flavor", "key_name", "config_drive", "addresses", "metadata", "extendedStatus", "extendedAttributes", "OS-DCF:diskConfig"
- })
- protected Server(String id, @Nullable String name, java.util.Set<Link> links, @Nullable String uuid, String tenantId,
- String userId, @Nullable Date updated, Date created, @Nullable String hostId, @Nullable String accessIPv4,
- @Nullable String accessIPv6, Server.Status status, Resource image, Resource flavor, @Nullable String keyName,
- @Nullable String configDrive, Multimap<String, Address> addresses, Map<String, String> metadata,
- @Nullable ServerExtendedStatus extendedStatus, @Nullable ServerExtendedAttributes extendedAttributes,
- @Nullable String diskConfig) {
- super(id, name, links);
- this.uuid = uuid;
- this.tenantId = checkNotNull(tenantId, "tenantId");
- this.userId = checkNotNull(userId, "userId");
- this.updated = updated;
- this.created = checkNotNull(created, "created");
- this.hostId = Strings.emptyToNull(hostId);
- this.accessIPv4 = Strings.emptyToNull(accessIPv4);
- this.accessIPv6 = Strings.emptyToNull(accessIPv6);
- this.status = checkNotNull(status, "status");
- this.image = checkNotNull(image, "image");
- this.flavor = checkNotNull(flavor, "flavor");
- this.keyName = Strings.emptyToNull(keyName);
- this.configDrive = Strings.emptyToNull(configDrive);
- this.addresses = ImmutableMultimap.copyOf(checkNotNull(addresses, "addresses"));
- this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
- this.extendedStatus = Optional.fromNullable(extendedStatus);
- this.extendedAttributes = Optional.fromNullable(extendedAttributes);
- this.diskConfig = Optional.fromNullable(diskConfig);
- }
-
- /**
- * only present until the id is in uuid form
- *
- * @return uuid, if id is an integer val
- */
- @Nullable
- public String getUuid() {
- return this.uuid;
- }
-
- public String getTenantId() {
- return this.tenantId;
- }
-
- public String getUserId() {
- return this.userId;
- }
-
- @Nullable
- public Date getUpdated() {
- return this.updated;
- }
-
- public Date getCreated() {
- return this.created;
- }
-
- /**
- * @return host identifier, or null if in {@link Status#BUILD}
- */
- @Nullable
- public String getHostId() {
- return this.hostId;
- }
-
- @Nullable
- public String getAccessIPv4() {
- return this.accessIPv4;
- }
-
- @Nullable
- public String getAccessIPv6() {
- return this.accessIPv6;
- }
-
- public Status getStatus() {
- return this.status;
- }
-
- @Nullable
- public String getConfigDrive() {
- return this.configDrive;
- }
-
- public Resource getImage() {
- return this.image;
- }
-
- public Resource getFlavor() {
- return this.flavor;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- /**
- * @return the ip addresses assigned to the server
- */
- public Multimap<String, Address> getAddresses() {
- return addresses;
- }
-
- /**
- * @return keyName if extension is present and there is a value for this server
- * @see KeyPairApi
- */
- @Nullable
- public String getKeyName() {
- return keyName;
- }
-
- /**
- * Retrieves the extended server status fields (alias "OS-EXT-STS")
- * <p/>
- * NOTE: This field is only present if the Extended Status extension is installed.
- *
- * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
- * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
- */
- public Optional<ServerExtendedStatus> getExtendedStatus() {
- return this.extendedStatus;
- }
-
- /**
- * Retrieves the extended server attributes fields (alias "OS-EXT-SRV-ATTR")
- * <p/>
- * NOTE: This field is only present if the The Extended Server Attributes API extension is installed.
- *
- * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
- * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
- */
- public Optional<ServerExtendedAttributes> getExtendedAttributes() {
- return this.extendedAttributes;
- }
-
- /**
- * Disk config attribute from the Disk Config Extension (alias "OS-DCF").
- * One of {@link Server#DISK_CONFIG_AUTO} or {@link Server#DISK_CONFIG_MANUAL}.
- * This field is only present if the Disk Config extension is installed.
- * <p/>
- * NOTE: Typically a field like this would be implemented as an enum but this field was
- * originally implmented as a String and {@link Server#DISK_CONFIG_AUTO} and
- * {@link Server#DISK_CONFIG_MANUAL} were added later as Strings to preserve backwards
- * compatibility.
- *
- * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
- * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#DISK_CONFIG
- * @see CreateServerOptions#getDiskConfig()
- */
- public Optional<String> getDiskConfig() {
- return this.diskConfig;
- }
-
-
- // hashCode/equals from super is ok
-
- @Override
- protected ToStringHelper string() {
- return super.string()
- .add("uuid", uuid).add("tenantId", tenantId).add("userId", userId).add("updated", updated).add("created", created)
- .add("hostId", hostId).add("accessIPv4", accessIPv4).add("accessIPv6", accessIPv6).add("status", status).add("image", image)
- .add("flavor", flavor).add("keyName", keyName).add("configDrive", configDrive).add("addresses", addresses)
- .add("metadata", metadata).add("extendedStatus", extendedStatus).add("extendedAttributes", extendedAttributes)
- .add("diskConfig", diskConfig);
- }
-
-}
[05/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
deleted file mode 100644
index b135e19..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.options;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.base.Strings.emptyToNull;
-import static com.google.common.io.BaseEncoding.base64;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.Network;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-import com.google.common.collect.ForwardingObject;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-/**
- * @author Adrian Cole
- * @author Inbar Stolberg
- * @author Zack Shoylev
- */
-public class CreateServerOptions implements MapBinder {
- @Inject
- private BindToJsonPayload jsonBinder;
-
- static class File {
- private final String path;
- private final String contents;
-
- public File(String path, byte[] contents) {
- this.path = checkNotNull(path, "path");
- this.contents = base64().encode(checkNotNull(contents, "contents"));
- checkArgument(
- path.getBytes().length < 255,
- String.format("maximum length of path is 255 bytes. Path specified %s is %d bytes", path,
- path.getBytes().length));
- checkArgument(contents.length < 10 * 1024,
- String.format("maximum size of the file is 10KB. Contents specified is %d bytes", contents.length));
- }
-
- public String getContents() {
- return contents;
- }
-
- public String getPath() {
- return path;
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof File) {
- final File other = File.class.cast(object);
- return equal(path, other.path);
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(path);
- }
-
- @Override
- public String toString() {
- return toStringHelper("file").add("path", path).toString();
- }
-
- }
-
- private String keyName;
- private String adminPass;
- private Set<String> securityGroupNames = ImmutableSet.of();
- private Map<String, String> metadata = ImmutableMap.of();
- private List<File> personality = Lists.newArrayList();
- private byte[] userData;
- private String diskConfig;
- private Set<String> networks = ImmutableSet.of();
- private Set<Network> novaNetworks = ImmutableSet.of();
- private String availabilityZone;
- private boolean configDrive;
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof CreateServerOptions) {
- final CreateServerOptions other = CreateServerOptions.class.cast(object);
- return equal(keyName, other.keyName) && equal(securityGroupNames, other.securityGroupNames)
- && equal(metadata, other.metadata) && equal(personality, other.personality)
- && equal(adminPass, other.adminPass) && equal(diskConfig, other.diskConfig)
- && equal(adminPass, other.adminPass) && equal(networks, other.networks)
- && equal(availabilityZone, other.availabilityZone);
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(keyName, securityGroupNames, metadata, personality, adminPass, networks, availabilityZone);
- }
-
- protected ToStringHelper string() {
- ToStringHelper toString = Objects.toStringHelper("").omitNullValues();
- toString.add("keyName", keyName);
- if (securityGroupNames.size() > 0)
- toString.add("securityGroupNames", securityGroupNames);
- if (metadata.size() > 0)
- toString.add("metadata", metadata);
- if (personality.size() > 0)
- toString.add("personality", personality);
- if (adminPass != null)
- toString.add("adminPassPresent", true);
- if (diskConfig != null)
- toString.add("diskConfig", diskConfig);
- toString.add("userData", userData == null ? null : new String(userData));
- if (!networks.isEmpty())
- toString.add("networks", networks);
- toString.add("availability_zone", availabilityZone == null ? null : availabilityZone);
- return toString;
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- static class ServerRequest {
- final String name;
- final String imageRef;
- final String flavorRef;
- @Named("availability_zone")
- String availabilityZone;
- String adminPass;
- Map<String, String> metadata;
- List<File> personality;
- String key_name;
- @Named("security_groups")
- Set<NamedThingy> securityGroupNames;
- String user_data;
- @Named("OS-DCF:diskConfig")
- String diskConfig;
- Set<Map<String, String>> networks;
-
- private ServerRequest(String name, String imageRef, String flavorRef) {
- this.name = name;
- this.imageRef = imageRef;
- this.flavorRef = flavorRef;
- }
-
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- ServerRequest server = new ServerRequest(checkNotNull(postParams.get("name"), "name parameter not present").toString(),
- checkNotNull(postParams.get("imageRef"), "imageRef parameter not present").toString(),
- checkNotNull(postParams.get("flavorRef"), "flavorRef parameter not present").toString());
- if (metadata.size() > 0)
- server.metadata = metadata;
- if (personality.size() > 0)
- server.personality = personality;
- if (keyName != null)
- server.key_name = keyName;
- if (availabilityZone != null)
- server.availabilityZone = availabilityZone;
- if (userData != null)
- server.user_data = base64().encode(userData);
- if (securityGroupNames.size() > 0) {
- server.securityGroupNames = Sets.newLinkedHashSet();
- for (String groupName : securityGroupNames) {
- server.securityGroupNames.add(new NamedThingy(groupName));
- }
- }
- if (adminPass != null) {
- server.adminPass = adminPass;
- }
-
- if (diskConfig != null) {
- server.diskConfig = diskConfig;
- }
-
- if (!networks.isEmpty() || !novaNetworks.isEmpty()) {
- server.networks = Sets.newLinkedHashSet(); // ensures ordering is preserved - helps testing and more intuitive for users.
- for (Network network : novaNetworks) {
- // Avoid serializing null values, which are common here.
- ImmutableMap.Builder<String, String> networkMap = new ImmutableMap.Builder<String, String>();
- if(network.getNetworkUuid() != null) {
- networkMap.put("uuid", network.getNetworkUuid());
- }
- if(network.getPortUuid() != null) {
- networkMap.put("port", network.getPortUuid());
- }
- if(network.getFixedIp() != null) {
- networkMap.put("fixed_ip", network.getFixedIp());
- }
- server.networks.add(networkMap.build());
- }
- for (String network : networks) {
- server.networks.add(ImmutableMap.of("uuid", network));
- }
- }
-
- return bindToRequest(request, ImmutableMap.of("server", server));
- }
-
- private static class NamedThingy extends ForwardingObject {
- private String name;
-
- private NamedThingy(String name) {
- this.name = name;
- }
-
- @Override
- protected Object delegate() {
- return name;
- }
- }
-
- /**
- * You may further customize a cloud server by injecting data into the file
- * system of the cloud server itself. This is useful, for example, for
- * inserting ssh keys, setting configuration files, or storing data that you
- * want to retrieve from within the instance itself. It is intended to
- * provide a minimal amount of launch-time personalization. If significant
- * customization is required, a custom image should be created. The max size
- * of the file path data is 255 bytes while the max size of the file contents
- * is 10KB. Note that the file contents should be encoded as a Base64 string
- * and the 10KB limit refers to the number of bytes in the decoded data not
- * the number of characters in the encoded data. The maximum number of file
- * path/content pairs that can be supplied is 5. Any existing files that
- * match the specified file will be renamed to include the extension bak
- * followed by a time stamp. For example, the file /etc/passwd will be backed
- * up as /etc/passwd.bak.1246036261.5785. All files will have root and the
- * root group as owner and group owner, respectively and will allow user and
- * group read access only (-r--r-----).
- */
- public CreateServerOptions writeFileToPath(byte[] contents, String path) {
- checkState(personality.size() < 5, "maximum number of files allowed is 5");
- personality.add(new File(path, contents));
- return this;
- }
-
- public CreateServerOptions adminPass(String adminPass) {
- checkNotNull(adminPass, "adminPass");
- this.adminPass = adminPass;
- return this;
- }
-
- /**
- * Custom cloud server metadata can also be supplied at launch time. This
- * metadata is stored in the API system where it is retrievable by querying
- * the API for server status. The maximum size of the metadata key and value
- * is each 255 bytes and the maximum number of key-value pairs that can be
- * supplied per server is 5.
- */
- public CreateServerOptions metadata(Map<String, String> metadata) {
- checkNotNull(metadata, "metadata");
- checkArgument(metadata.size() <= 5,
- "you cannot have more then 5 metadata values. You specified: " + metadata.size());
- for (Entry<String, String> entry : metadata.entrySet()) {
- checkArgument(
- entry.getKey().getBytes().length < 255,
- String.format("maximum length of metadata key is 255 bytes. Key specified %s is %d bytes",
- entry.getKey(), entry.getKey().getBytes().length));
- checkArgument(entry.getKey().getBytes().length < 255, String.format(
- "maximum length of metadata value is 255 bytes. Value specified for %s (%s) is %d bytes",
- entry.getKey(), entry.getValue(), entry.getValue().getBytes().length));
- }
- this.metadata = ImmutableMap.copyOf(metadata);
- return this;
- }
-
- /**
- * Custom user-data can be also be supplied at launch time.
- * It is retrievable by the instance and is often used for launch-time configuration
- * by instance scripts.
- */
- public CreateServerOptions userData(byte[] userData) {
- this.userData = userData;
- return this;
- }
-
- /**
- * Set to true to use a config drive for metadata.
- * This is a separate configuration drive that can be used separately from the metadata service.
- * This needs to be set to "true" when trying to use user data for cloud-init.
- * @see http://docs.openstack.org/grizzly/openstack-compute/admin/content/config-drive.html
- */
- public CreateServerOptions configDrive(boolean configDrive) {
- this.configDrive = configDrive;
- return this;
- }
-
- /**
- * A keypair name can be defined when creating a server. This key will be
- * linked to the server and used to SSH connect to the machine
- */
- public String getKeyPairName() {
- return keyName;
- }
-
- public String getAvailabilityZone() {
- return availabilityZone;
- }
-
- /**
- * @see #getKeyPairName()
- */
- public CreateServerOptions keyPairName(String keyName) {
- this.keyName = keyName;
- return this;
- }
-
- /**
- * @see #getAvailabilityZone()
- */
- public CreateServerOptions availabilityZone(String availabilityZone) {
- this.availabilityZone = availabilityZone;
- return this;
- }
-
- /**
- * Security groups the user specified to run servers with.
- * <p/>
- * <h3>Note</h3>
- * <p/>
- * This requires that {@link NovaApi#getSecurityGroupExtensionForZone(String)} to return
- * {@link Optional#isPresent present}
- */
- public Set<String> getSecurityGroupNames() {
- return securityGroupNames;
- }
-
- /**
- * Get custom networks specified for the server.
- *
- * @return A set of uuids defined by Neutron (previously Quantum)
- * @see <a href="https://wiki.openstack.org/wiki/Neutron/APIv2-specification#Network">Neutron Networks<a/>
- */
- public Set<String> getNetworks() {
- return networks;
- }
-
- /**
- * Get custom networks specified for the server.
- *
- * @return A set of uuids defined by Neutron (previously Quantum)
- * @see <a href="https://wiki.openstack.org/wiki/Neutron/APIv2-specification#Network">Neutron Networks<a/>
- */
- public Set<Network> getNovaNetworks() {
- return novaNetworks;
- }
-
- /**
- * @see #getSecurityGroupNames
- */
- public CreateServerOptions securityGroupNames(String... securityGroupNames) {
- return securityGroupNames(ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames")));
- }
-
- /**
- * @see #getSecurityGroupNames
- */
- public CreateServerOptions securityGroupNames(Iterable<String> securityGroupNames) {
- for (String groupName : checkNotNull(securityGroupNames, "securityGroupNames"))
- checkNotNull(emptyToNull(groupName), "all security groups must be non-empty");
- this.securityGroupNames = ImmutableSet.copyOf(securityGroupNames);
- return this;
- }
-
- /**
- * When you create a server from an image with the diskConfig value set to
- * {@link Server#DISK_CONFIG_AUTO}, the server is built with a single partition that is expanded to
- * the disk size of the flavor selected. When you set the diskConfig attribute to
- * {@link Server#DISK_CONFIG_MANUAL}, the server is built by using the partition scheme and file
- * system that is in the source image.
- * <p/>
- * If the target flavor disk is larger, remaining disk space is left unpartitioned. A server inherits the diskConfig
- * attribute from the image from which it is created. However, you can override the diskConfig value when you create
- * a server. This field is only present if the Disk Config extension is installed in your OpenStack deployment.
- */
- public String getDiskConfig() {
- return diskConfig;
- }
-
- /**
- * @see #getDiskConfig
- */
- public CreateServerOptions diskConfig(String diskConfig) {
- this.diskConfig = diskConfig;
- return this;
- }
-
- /**
- * Determines if a configuration drive will be attached to the server or not.
- * This can be used for cloud-init or other configuration purposes.
- */
- public boolean getConfigDrive() {
- return configDrive;
- }
-
- /**
- * @see #getNetworks
- */
- public CreateServerOptions networks(Iterable<String> networks) {
- this.networks = ImmutableSet.copyOf(networks);
- return this;
- }
-
- /**
- * @see #getNetworks
- * Overwrites networks supplied by {@link #networks(Iterable)}
- */
- public CreateServerOptions novaNetworks(Iterable<Network> networks) {
- this.novaNetworks = ImmutableSet.copyOf(networks);
- return this;
- }
-
- /**
- * @see #getNetworks
- */
- public CreateServerOptions networks(String... networks) {
- return networks(ImmutableSet.copyOf(networks));
- }
-
- public static class Builder {
-
- /**
- * @see CreateServerOptions#writeFileToPath
- */
- public static CreateServerOptions writeFileToPath(byte[] contents, String path) {
- CreateServerOptions options = new CreateServerOptions();
- return options.writeFileToPath(contents, path);
- }
-
- public static CreateServerOptions adminPass(String adminPass) {
- CreateServerOptions options = new CreateServerOptions();
- return options.adminPass(adminPass);
- }
-
- /**
- * @see CreateServerOptions#metadata(Map<String, String>)
- */
- public static CreateServerOptions metadata(Map<String, String> metadata) {
- CreateServerOptions options = new CreateServerOptions();
- return options.metadata(metadata);
- }
-
- /**
- * @see #getKeyPairName()
- */
- public static CreateServerOptions keyPairName(String keyName) {
- CreateServerOptions options = new CreateServerOptions();
- return options.keyPairName(keyName);
- }
-
- /**
- * @see CreateServerOptions#getSecurityGroupNames
- */
- public static CreateServerOptions securityGroupNames(String... groupNames) {
- CreateServerOptions options = new CreateServerOptions();
- return CreateServerOptions.class.cast(options.securityGroupNames(groupNames));
- }
-
- /**
- * @see CreateServerOptions#getSecurityGroupNames
- */
- public static CreateServerOptions securityGroupNames(Iterable<String> groupNames) {
- CreateServerOptions options = new CreateServerOptions();
- return CreateServerOptions.class.cast(options.securityGroupNames(groupNames));
- }
-
- /**
- * @see CreateServerOptions#getDiskConfig
- */
- public static CreateServerOptions diskConfig(String diskConfig) {
- CreateServerOptions options = new CreateServerOptions();
- return CreateServerOptions.class.cast(options.diskConfig(diskConfig));
- }
-
- /**
- * @see CreateServerOptions#getNetworks
- */
- public static CreateServerOptions networks(String... networks) {
- CreateServerOptions options = new CreateServerOptions();
- return CreateServerOptions.class.cast(options.networks(networks));
- }
-
- /**
- * @see CreateServerOptions#getNetworks
- */
- public static CreateServerOptions networks(Iterable<String> networks) {
- CreateServerOptions options = new CreateServerOptions();
- return CreateServerOptions.class.cast(options.networks(networks));
- }
-
- /**
- * @see CreateServerOptions#getNetworks
- */
- public static CreateServerOptions novaNetworks(Iterable<Network> networks) {
- CreateServerOptions options = new CreateServerOptions();
- return CreateServerOptions.class.cast(options.novaNetworks(networks));
- }
-
- /**
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getAvailabilityZone()
- */
- public static CreateServerOptions availabilityZone(String availabilityZone) {
- CreateServerOptions options = new CreateServerOptions();
- return options.availabilityZone(availabilityZone);
- }
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- return jsonBinder.bindToRequest(request, input);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
deleted file mode 100644
index 921a4c8..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.options;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-/**
- * @author Adam Lowe
- */
-public class CreateVolumeOptions implements MapBinder {
- public static final CreateVolumeOptions NONE = new CreateVolumeOptions();
-
- @Inject
- private BindToJsonPayload jsonBinder;
-
- protected String name;
- protected String description;
- protected String volumeType;
- protected String availabilityZone;
- protected String snapshotId;
- protected Map<String, String> metadata = ImmutableMap.of();
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- Map<String, Object> image = Maps.newHashMap();
- image.putAll(postParams);
- if (name != null)
- image.put("display_name", name);
- if (description != null)
- image.put("display_description", description);
- if (volumeType != null)
- image.put("volume_type", volumeType);
- if (availabilityZone != null)
- image.put("availability_zone", availabilityZone);
- if (snapshotId != null)
- image.put("snapshot_id", snapshotId);
- if (!metadata.isEmpty())
- image.put("metadata", metadata);
- return jsonBinder.bindToRequest(request, ImmutableMap.of("volume", image));
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
- throw new IllegalStateException("CreateVolume is a POST operation");
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (!(object instanceof CreateVolumeOptions)) return false;
- final CreateVolumeOptions other = CreateVolumeOptions.class.cast(object);
- return equal(volumeType, other.volumeType) && equal(availabilityZone, other.availabilityZone) && equal(snapshotId, other.snapshotId)
- && equal(name, other.name) && equal(description, other.description) && equal(metadata, other.metadata);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(volumeType, availabilityZone, snapshotId, name, description, metadata);
- }
-
- protected ToStringHelper string() {
- return toStringHelper("").add("volumeType", volumeType).add("availabilityZone", availabilityZone)
- .add("snapshotId", snapshotId).add("name", name).add("description", description).add("metadata", metadata);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- /**
- * Custom cloud server metadata can also be supplied at launch time. This
- * metadata is stored in the API system where it is retrievable by querying
- * the API for server status. The maximum size of the metadata key and value
- * is each 255 bytes and the maximum number of key-value pairs that can be
- * supplied per volume is 5.
- */
- public CreateVolumeOptions metadata(Map<String, String> metadata) {
- checkNotNull(metadata, "metadata");
- checkArgument(metadata.size() <= 5,
- "you cannot have more then 5 metadata values. You specified: " + metadata.size());
- for (Entry<String, String> entry : metadata.entrySet()) {
- checkArgument(
- entry.getKey().getBytes().length < 255,
- String.format("maximum length of metadata key is 255 bytes. Key specified %s is %d bytes",
- entry.getKey(), entry.getKey().getBytes().length));
- checkArgument(entry.getKey().getBytes().length < 255, String.format(
- "maximum length of metadata value is 255 bytes. Value specified for %s (%s) is %d bytes",
- entry.getKey(), entry.getValue(), entry.getValue().getBytes().length));
- }
- this.metadata = ImmutableMap.copyOf(metadata);
- return this;
- }
-
- public CreateVolumeOptions name(String name) {
- this.name = name;
- return this;
- }
-
- public CreateVolumeOptions description(String description) {
- this.description = description;
- return this;
- }
-
- public CreateVolumeOptions volumeType(String volumeType) {
- this.volumeType = volumeType;
- return this;
- }
-
- public CreateVolumeOptions availabilityZone(String availabilityZone) {
- this.availabilityZone = availabilityZone;
- return this;
- }
-
- public CreateVolumeOptions snapshotId(String snapshotId) {
- this.snapshotId = snapshotId;
- return this;
- }
-
- public String getVolumeType() {
- return volumeType;
- }
-
- public String getAvailabilityZone() {
- return availabilityZone;
- }
-
- public String getSnapshotId() {
- return snapshotId;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public static class Builder {
- /**
- * @see CreateVolumeOptions#getName()
- */
- public static CreateVolumeOptions name(String name) {
- return new CreateVolumeOptions().name(name);
- }
- /**
- * @see CreateVolumeOptions#getDescription()
- */
- public static CreateVolumeOptions description(String description) {
- return new CreateVolumeOptions().description(description);
- }
-
- /**
- * @see CreateVolumeOptions#getVolumeType()
- */
- public static CreateVolumeOptions volumeType(String volumeType) {
- return new CreateVolumeOptions().volumeType(volumeType);
- }
-
- /**
- * @see CreateVolumeOptions#getAvailabilityZone()
- */
- public static CreateVolumeOptions availabilityZone(String availabilityZone) {
- return new CreateVolumeOptions().availabilityZone(availabilityZone);
- }
-
- /**
- * @see CreateVolumeOptions#getSnapshotId()
- */
- public static CreateVolumeOptions snapshotId(String snapshotId) {
- return new CreateVolumeOptions().snapshotId(snapshotId);
- }
-
- /**
- * @see CreateVolumeOptions#getMetadata()
- */
- public static CreateVolumeOptions metadata(Map<String, String> metadata) {
- return new CreateVolumeOptions().metadata(metadata);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
deleted file mode 100644
index b159367..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.options;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-/**
- * @author Adam Lowe
- */
-public class CreateVolumeSnapshotOptions implements MapBinder {
- public static final CreateVolumeSnapshotOptions NONE = new CreateVolumeSnapshotOptions();
-
- @Inject
- private BindToJsonPayload jsonBinder;
-
- private String name;
- private String description;
- private boolean force = false;
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- Map<String, Object> data = Maps.newHashMap(postParams);
- if (name != null)
- data.put("display_name", name);
- if (description != null)
- data.put("display_description", description);
- if (force)
- data.put("force", "true");
- return jsonBinder.bindToRequest(request, ImmutableMap.of("snapshot", data));
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
- throw new IllegalStateException("CreateSnapshot is a POST operation");
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (!(object instanceof CreateVolumeSnapshotOptions)) return false;
- final CreateVolumeSnapshotOptions other = CreateVolumeSnapshotOptions.class.cast(object);
- return equal(name, other.name) && equal(description, other.description);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name, description);
- }
-
- protected ToStringHelper string() {
- return toStringHelper("").add("name", name).add("description", description);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- public CreateVolumeSnapshotOptions name(String name) {
- this.name = name;
- return this;
- }
-
- public CreateVolumeSnapshotOptions description(String description) {
- this.description = description;
- return this;
- }
-
- public CreateVolumeSnapshotOptions force() {
- this.force = true;
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public boolean isForce() {
- return force;
- }
-
- public static class Builder {
- /**
- * @see CreateVolumeSnapshotOptions#getName()
- */
- public static CreateVolumeSnapshotOptions name(String name) {
- return new CreateVolumeSnapshotOptions().name(name);
- }
- /**
- * @see CreateVolumeSnapshotOptions#getDescription()
- */
- public static CreateVolumeSnapshotOptions description(String description) {
- return new CreateVolumeSnapshotOptions().description(description);
- }
-
- /**
- * @see CreateVolumeSnapshotOptions#isForce()
- */
- public static CreateVolumeSnapshotOptions force() {
- return new CreateVolumeSnapshotOptions().force();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
deleted file mode 100644
index 7ab6460..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.options;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-/**
- * @author Adam Lowe
- */
-public class CreateVolumeTypeOptions implements MapBinder {
- public static final CreateVolumeTypeOptions NONE = new CreateVolumeTypeOptions();
-
- @Inject
- protected BindToJsonPayload jsonBinder;
-
- protected Map<String, String> specs = ImmutableMap.of();
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- Map<String, Object> data = Maps.newHashMap();
- data.putAll(postParams);
- data.put("extra_specs", specs);
- return jsonBinder.bindToRequest(request, ImmutableMap.of("volume_type", data));
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
- throw new IllegalStateException("CreateWithExtraSpecs are POST operations");
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (!(object instanceof CreateVolumeTypeOptions)) return false;
- final CreateVolumeTypeOptions other = CreateVolumeTypeOptions.class.cast(object);
- return equal(specs, other.specs);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(specs);
- }
-
- protected ToStringHelper string() {
- return toStringHelper("").add("specs", specs);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- public CreateVolumeTypeOptions specs(Map<String, String> specs) {
- this.specs = specs;
- return this;
- }
-
- public Map<String, String> getSpecs() {
- return specs;
- }
-
- public static class Builder {
- /**
- * @see CreateVolumeTypeOptions#getSpecs()
- */
- public static CreateVolumeTypeOptions specs(Map<String, String> specs) {
- return new CreateVolumeTypeOptions().specs(specs);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
deleted file mode 100644
index 23eb5f3..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.options;
-
-import java.util.Date;
-
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * Options used to control the amount of detail in the request.
- *
- * @see PaginationOptions
- * @see <a href="http://wiki.openstack.org/OpenStackAPI_1-1" />
- * @author Adrian Cole
- */
-public class ListOptions extends PaginationOptions {
-
- public static final ListOptions NONE = new ListOptions();
-
- /**
- * unless used, only the name and id will be returned per row.
- *
- * @return
- */
- public ListOptions withDetails() {
- this.pathSuffix = "/detail";
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListOptions changesSince(Date ifModifiedSince) {
- super.changesSince(ifModifiedSince);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListOptions limit(int limit) {
- super.limit(limit);
- return this;
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListOptions marker(String marker) {
- super.marker(marker);
- return this;
- }
-
- public static class Builder {
-
- /**
- * @see ListOptions#withDetails()
- */
- public static ListOptions withDetails() {
- ListOptions options = new ListOptions();
- return options.withDetails();
- }
-
- /**
- * @see PaginationOptions#marker(String)
- */
- public static ListOptions marker(String marker) {
- ListOptions options = new ListOptions();
- return options.marker(marker);
- }
-
- /**
- * @see PaginationOptions#limit(long)
- */
- public static ListOptions maxResults(int maxKeys) {
- ListOptions options = new ListOptions();
- return options.limit(maxKeys);
- }
-
- /**
- * @see PaginationOptions#changesSince(Date)
- */
- public static ListOptions changesSince(Date since) {
- ListOptions options = new ListOptions();
- return options.changesSince(since);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
deleted file mode 100644
index e1f0d08..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.options;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-/**
- * @author Adrian Cole
- * @author Inbar Stolberg
- */
-public class RebuildServerOptions implements MapBinder {
- @Inject
- private BindToJsonPayload jsonBinder;
- String imageRef;
- String name;
- String adminPass;
- String accessIPv4;
- String accessIPv6;
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- Map<String, String> image = Maps.newHashMap();
- if (imageRef != null)
- image.put("imageRef", imageRef);
- if (name != null)
- image.put("name", name);
- if (adminPass != null)
- image.put("adminPass", adminPass);
- if (accessIPv4 != null)
- image.put("accessIPv4", accessIPv4);
- if (accessIPv6 != null)
- image.put("accessIPv6", accessIPv6);
-
-
- return jsonBinder.bindToRequest(request, ImmutableMap.of("rebuild", image));
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
- throw new IllegalStateException("RebuildServer is a POST operation");
- }
-
- /**
- * @param ref
- * - reference of the image to rebuild the server with.
- */
- public RebuildServerOptions withImage(String ref) {
- checkNotNull(ref, "image reference should not be null");
- checkArgument(!ref.isEmpty(), "image reference should not be empty");
- this.imageRef = ref;
- return this;
- }
-
- public RebuildServerOptions name(String name) {
- this.name = name;
- return this;
- }
-
- public RebuildServerOptions adminPass(String adminPass) {
- this.adminPass = adminPass;
- return this;
- }
-
- public RebuildServerOptions ipv4Address(String ipv4Address) {
- this.accessIPv4 = ipv4Address;
- return this;
- }
-
- public RebuildServerOptions ipv6Address(String iPv6Address) {
- this.accessIPv6 = iPv6Address;
- return this;
- }
-
- public static class Builder {
-
- /**
- * @see RebuildServerOptions#withImage(String)
- */
- public static RebuildServerOptions withImage(String ref) {
- RebuildServerOptions options = new RebuildServerOptions();
- return options.withImage(ref);
- }
-
- /**
- * @see RebuildServerOptions#name(String)
- */
- public static RebuildServerOptions name(String name) {
- RebuildServerOptions options = new RebuildServerOptions();
- return options.name(name);
- }
-
- /**
- * @see RebuildServerOptions#adminPass(String)
- */
- public static RebuildServerOptions adminPass(String adminPass) {
- RebuildServerOptions options = new RebuildServerOptions();
- return options.adminPass(adminPass);
- }
-
- /**
- * @see RebuildServerOptions#ipv4Address(String)
- */
- public static RebuildServerOptions ipv4Address(String ipv4Address) {
- RebuildServerOptions options = new RebuildServerOptions();
- return options.ipv4Address(ipv4Address);
- }
-
- /**
- * @see RebuildServerOptions#ipv6Address(String)
- */
- public static RebuildServerOptions ipv6Address(String ipv6Address) {
- RebuildServerOptions options = new RebuildServerOptions();
- return options.ipv6Address(ipv6Address);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
deleted file mode 100644
index a44b502..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.predicates;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.NoSuchElementException;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.annotation.Resource;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
-import org.jclouds.rest.ResourceNotFoundException;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
-
-/**
- * AtomicReference is so that we can return the securityGroup that matched.
- *
- * @author Adrian Cole
- */
-@Singleton
-public class FindSecurityGroupWithNameAndReturnTrue implements Predicate<AtomicReference<ZoneAndName>> {
-
- private final NovaApi novaApi;
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- @Inject
- public FindSecurityGroupWithNameAndReturnTrue(NovaApi novaApi) {
- this.novaApi = checkNotNull(novaApi, "novaApi");
- }
-
- public boolean apply(AtomicReference<ZoneAndName> securityGroupInZoneRef) {
- checkNotNull(securityGroupInZoneRef, "securityGroupRef");
- final ZoneAndName securityGroupInZone = checkNotNull(securityGroupInZoneRef.get(), "securityGroupInZone");
-
- Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone());
- checkArgument(api.isPresent(), "Security groups are required, but the extension is not available!");
-
- logger.trace("looking for security group %s", securityGroupInZone.slashEncode());
- try {
- SecurityGroup returnVal = Iterables.find(api.get().list(), new Predicate<SecurityGroup>() {
-
- @Override
- public boolean apply(SecurityGroup input) {
- return input.getName().equals(securityGroupInZone.getName());
- }
-
- });
- securityGroupInZoneRef.set(new SecurityGroupInZone(returnVal, securityGroupInZone.getZone()));
- return true;
- } catch (ResourceNotFoundException e) {
- return false;
- } catch (NoSuchElementException e) {
- return false;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
deleted file mode 100644
index aa8cad7..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-import org.jclouds.openstack.nova.v2_0.domain.Image.Status;
-
-import com.google.common.base.Predicate;
-
-/**
- * Predicates handy when working with Images
- *
- * @author Adrian Cole
- */
-
-public class ImagePredicates {
-
- /**
- * matches status of the given image
- *
- * @param status
- * @return predicate that matches status
- */
- public static Predicate<Image> statusEquals(final Status status) {
- checkNotNull(status, "status must be defined");
-
- return new Predicate<Image>() {
- @Override
- public boolean apply(Image image) {
- return status.equals(image.getStatus());
- }
-
- @Override
- public String toString() {
- return "statusEquals(" + status + ")";
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
deleted file mode 100644
index ec511bb..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-
-import com.google.common.base.Predicate;
-
-/**
- * Predicates handy when working with KeyPairs
- *
- * @author Adam Lowe
- */
-
-public class KeyPairPredicates {
-
-
- /**
- * matches name of the given key pair
- *
- * @param name
- * @return predicate that matches name
- */
- public static Predicate<KeyPair> nameMatches(final Predicate<String> name) {
- checkNotNull(name, "name must be defined");
-
- return new Predicate<KeyPair>() {
- @Override
- public boolean apply(KeyPair ext) {
- return name.apply(ext.getName());
- }
-
- @Override
- public String toString() {
- return "nameMatches(" + name + ")";
- }
- };
- }
-
- /**
- * matches name of the given keypair starts with the specified prefix
- *
- * @param name the prefix you are looking for
- * @return the predicate
- */
- public static Predicate<KeyPair> nameEquals(final String name) {
- checkNotNull(name, "name must be defined");
-
- return new Predicate<KeyPair>() {
- @Override
- public boolean apply(KeyPair ext) {
- return ext.getName() != null && ext.getName().equals(name);
- }
-
- @Override
- public String toString() {
- return "nameEquals(" + name + ")";
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
deleted file mode 100644
index 412e37f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import org.jclouds.net.domain.IpProtocol;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-/**
- * Predicates handy when working with SecurityGroups
- *
- * @author Adrian Cole
- */
-
-public class SecurityGroupPredicates {
-
- /**
- * matches name of the given security group
- *
- * @param name
- * @return predicate that matches name
- */
- public static Predicate<SecurityGroup> nameEquals(final String name) {
- checkNotNull(name, "name must be defined");
-
- return new Predicate<SecurityGroup>() {
- @Override
- public boolean apply(SecurityGroup ext) {
- return name.equals(ext.getName());
- }
-
- @Override
- public String toString() {
- return "nameEquals(" + name + ")";
- }
- };
- }
-
- /**
- * matches name of the given security group against a list
- *
- * @param names
- * @return predicate that matches one of the names
- */
- public static Predicate<SecurityGroup> nameIn(final Set<String> names) {
- checkNotNull(names, "names must be defined");
-
- return new Predicate<SecurityGroup>() {
- @Override
- public boolean apply(SecurityGroup ext) {
- return Predicates.in(names).apply(ext.getName());
- }
-
- @Override
- public String toString() {
- return "nameIn(" + names + ")";
- }
- };
- }
-
- /**
- * matches name of the given security group
- *
- * @param name
- * @return predicate that matches name
- */
- public static Predicate<SecurityGroup> nameMatches(final Predicate<String> name) {
- checkNotNull(name, "name must be defined");
-
- return new Predicate<SecurityGroup>() {
- @Override
- public boolean apply(SecurityGroup ext) {
- return name.apply(ext.getName());
- }
-
- @Override
- public String toString() {
- return "nameMatches(" + name + ")";
- }
- };
- }
-
- /**
- * matches a security group rule by its cidr
- *
- * @param cidr
- * @return predicate that matches cidr
- */
- public static Predicate<SecurityGroupRule> ruleCidr(final String cidr) {
- checkNotNull(cidr, "cidr must be defined");
-
- return new Predicate<SecurityGroupRule>() {
- @Override
- public boolean apply(SecurityGroupRule ext) {
- return cidr.equals(ext.getIpRange());
- }
-
- @Override
- public String toString() {
- return "cidr(" + cidr + ")";
- }
- };
- }
-
- /**
- * matches a security group rule by the security group it allows
- *
- * @param groupName
- * @return predicate that matches group
- */
- public static Predicate<SecurityGroupRule> ruleGroup(final String groupName) {
- checkNotNull(groupName, "groupName must be defined");
-
- return new Predicate<SecurityGroupRule>() {
- @Override
- public boolean apply(SecurityGroupRule ext) {
- return ext.getGroup() != null && groupName.equals(ext.getGroup().getName());
- }
-
- @Override
- public String toString() {
- return "ruleGroup(" + groupName + ")";
- }
- };
- }
-
- /**
- * matches a security group rule by the protocol
- *
- * @param protocol
- * @return predicate that matches protocol
- */
- public static Predicate<SecurityGroupRule> ruleProtocol(final IpProtocol protocol) {
- checkNotNull(protocol, "protocol must be defined");
-
- return new Predicate<SecurityGroupRule>() {
- @Override
- public boolean apply(SecurityGroupRule ext) {
- return protocol.equals(ext.getIpProtocol());
- }
-
- @Override
- public String toString() {
- return "ruleProtocol(" + protocol + ")";
- }
- };
- }
-
- /**
- * matches a security group rule by the start port
- *
- * @param startPort
- * @return predicate that matches startPort
- */
- public static Predicate<SecurityGroupRule> ruleStartPort(final int startPort) {
- checkNotNull(startPort, "startPort must be defined");
-
- return new Predicate<SecurityGroupRule>() {
- @Override
- public boolean apply(SecurityGroupRule ext) {
- return startPort == ext.getFromPort();
- }
-
- @Override
- public String toString() {
- return "ruleStartPort(" + startPort + ")";
- }
- };
- }
-
- /**
- * matches a security group rule by the end port
- *
- * @param endPort
- * @return predicate that matches endPort
- */
- public static Predicate<SecurityGroupRule> ruleEndPort(final int endPort) {
- checkNotNull(endPort, "endPort must be defined");
-
- return new Predicate<SecurityGroupRule>() {
- @Override
- public boolean apply(SecurityGroupRule ext) {
- return endPort == ext.getToPort();
- }
-
- @Override
- public String toString() {
- return "ruleEndPort(" + endPort + ")";
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
deleted file mode 100644
index 67c3d34..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.openstack.nova.v2_0.NovaApiMetadata
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
deleted file mode 100644
index 9e6c46b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- *
- * @see KeystoneProperties#CREDENTIAL_TYPE
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest")
-public class AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest extends BaseNovaApiExpectTest {
- public AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest() {
- identity = identityWithTenantId;
- }
-
- /**
- * this reflects the properties that a user would pass to createContext
- */
- @Override
- protected Properties setupProperties() {
- Properties contextProperties = super.setupProperties();
- contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
- contextProperties.setProperty("jclouds.keystone.tenant-id", KeystoneFixture.INSTANCE.getTenantId());
- return contextProperties;
- }
-
- public void testListServersWhenResponseIs2xx() throws Exception {
- HttpRequest listServers = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/server_list.json")).build();
-
- NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantId,
- responseWithKeystoneAccess, listServers, listServersResponse);
-
- assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
- new ParseServerListTest().expected().toString());
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java
deleted file mode 100644
index 740c5e8..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- *
- * @see KeystoneProperties#CREDENTIAL_TYPE
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest")
-public class AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest extends BaseNovaApiExpectTest {
- public AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest() {
- identity = "identity";
- }
-
- /**
- * this reflects the properties that a user would pass to createContext
- */
- @Override
- protected Properties setupProperties() {
- Properties contextProperties = super.setupProperties();
- contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
- contextProperties.setProperty("jclouds.keystone.tenant-name", KeystoneFixture.INSTANCE.getTenantName());
- return contextProperties;
- }
-
- public void testListServersWhenResponseIs2xx() throws Exception {
- HttpRequest listServers = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/server_list.json")).build();
-
- NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
- responseWithKeystoneAccess, listServers, listServersResponse);
-
- assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
- new ParseServerListTest().expected().toString());
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAuthenticationExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAuthenticationExpectTest.java
deleted file mode 100644
index 0784a7b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAuthenticationExpectTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- *
- * @see KeystoneProperties#CREDENTIAL_TYPE
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAuthenticationExpectTest")
-public class AccessKeyAndSecretKeyAuthenticationExpectTest extends BaseNovaApiExpectTest {
-
- /**
- * this reflects the properties that a user would pass to createContext
- */
- @Override
- protected Properties setupProperties() {
- Properties contextProperties = super.setupProperties();
- contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
- return contextProperties;
- }
-
- public void testListServersWhenResponseIs2xx() throws Exception {
- HttpRequest listServers = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/server_list.json")).build();
-
- NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
- responseWithKeystoneAccess, listServers, listServersResponse);
-
- assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
- new ParseServerListTest().expected().toString());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/EndpointIdIsRandomExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/EndpointIdIsRandomExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/EndpointIdIsRandomExpectTest.java
deleted file mode 100644
index a158875..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/EndpointIdIsRandomExpectTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import static org.jclouds.Constants.PROPERTY_ENDPOINT;
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Tests to ensure that we can pick the only endpoint of a service
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "EndpointIdIsRandomExpectTest")
-public class EndpointIdIsRandomExpectTest extends BaseNovaApiExpectTest {
-
- public EndpointIdIsRandomExpectTest() {
- this.identity = "demo:demo";
- this.credential = "password";
- }
-
- @Override
- protected Properties setupProperties() {
- Properties overrides = super.setupProperties();
- overrides.setProperty(PROPERTY_ENDPOINT, "http://10.10.10.10:5000/v2.0/");
- return overrides;
- }
-
- public void testVersionMatchOnConfiguredZonesWhenResponseIs2xx() {
-
- HttpRequest authenticate = HttpRequest
- .builder()
- .method("POST")
- .endpoint("http://10.10.10.10:5000/v2.0/tokens")
- .addHeader("Accept", "application/json")
- .payload(
- payloadFromStringWithContentType(
- "{\"auth\":{\"passwordCredentials\":{\"username\":\"demo\",\"password\":\"password\"},\"tenantName\":\"demo\"}}",
- "application/json")).build();
-
- HttpResponse authenticationResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResourceWithContentType("/access_version_uids.json", "application/json")).build();
-
- NovaApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
-
- assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("RegionOne"));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadataTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadataTest.java
deleted file mode 100644
index fbca404..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadataTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "NovaApiMetadataTest")
-public class NovaApiMetadataTest extends BaseComputeServiceApiMetadataTest {
-
- public NovaApiMetadataTest() {
- super(new NovaApiMetadata());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationExpectTest.java
deleted file mode 100644
index ad7bf9a..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationExpectTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- *
- * @see KeystoneProperties#CREDENTIAL_TYPE
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "PasswordAuthenticationExpectTest")
-public class PasswordAuthenticationExpectTest extends BaseNovaApiExpectTest {
- public PasswordAuthenticationExpectTest() {
- identity = "identity";
- }
-
- public void testListServersWhenResponseIs2xx() throws Exception {
- HttpRequest listServers = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/server_list.json")).build();
-
- NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
- responseWithKeystoneAccess, listServers, listServersResponse);
-
- assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
- new ParseServerListTest().expected().toString());
- }
-
-}
[26/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
new file mode 100755
index 0000000..a072298
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
@@ -0,0 +1,202 @@
+/*
+ * 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.vcloud.domain.network.internal;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.network.Features;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.IpScope;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class OrgNetworkImpl extends ReferenceTypeImpl implements OrgNetwork {
+ @Nullable
+ private final ReferenceType org;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final Configuration configuration;
+ @Nullable
+ private final ReferenceType networkPool;
+ private final Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet();
+
+ public OrgNetworkImpl(String name, String type, URI id, @Nullable ReferenceType org, @Nullable String description,
+ Iterable<Task> tasks, Configuration configuration, @Nullable ReferenceType networkPool,
+ Iterable<String> allowedExternalIpAddresses) {
+ super(name, type, id);
+ this.org = org;
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.configuration = checkNotNull(configuration, "configuration");
+ this.networkPool = networkPool;
+ Iterables.addAll(this.allowedExternalIpAddresses, checkNotNull(allowedExternalIpAddresses,
+ "allowedExternalIpAddresses"));
+ }
+
+ public static class ConfigurationImpl implements Configuration {
+
+ @Nullable
+ private final IpScope ipScope;
+ @Nullable
+ private final ReferenceType parentNetwork;
+ private final FenceMode fenceMode;
+ private final Features features;
+
+ public ConfigurationImpl(@Nullable IpScope ipScope, @Nullable ReferenceType parentNetwork, FenceMode fenceMode,
+ @Nullable Features features) {
+ this.ipScope = ipScope;
+ this.parentNetwork = parentNetwork;
+ this.fenceMode = checkNotNull(fenceMode, "fenceMode");
+ this.features = features;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IpScope getIpScope() {
+ return ipScope;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getParentNetwork() {
+ return parentNetwork;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public FenceMode getFenceMode() {
+ return fenceMode;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Nullable
+ public Features getFeatures() {
+ return features;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ConfigurationImpl that = ConfigurationImpl.class.cast(o);
+ return equal(this.ipScope, that.ipScope) && equal(this.parentNetwork, that.parentNetwork)
+ && equal(this.fenceMode, that.fenceMode) && equal(this.features, that.features);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ipScope, parentNetwork, fenceMode, features);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("ipScope", ipScope).add("parentNetwork", parentNetwork)
+ .add("fenceMode", fenceMode).add("features", features).toString();
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getOrg() {
+ return org;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getNetworkPool() {
+ return networkPool;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getAllowedExternalIpAddresses() {
+ return allowedExternalIpAddresses;
+ }
+
+ @Override
+ public ToStringHelper string() {
+ ToStringHelper helper = super.string().add("org", org).add("description", description)
+ .add("configuration", configuration).add("networkPool", networkPool);
+ if (allowedExternalIpAddresses.size() > 0)
+ helper.add("allowedExternalIpAddresses", allowedExternalIpAddresses);
+ if (tasks.size() > 0)
+ helper.add("tasks", tasks);
+ return helper;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
new file mode 100755
index 0000000..c1e2319
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
@@ -0,0 +1,54 @@
+/*
+ * 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.vcloud.domain.network.nat;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * The Policy element of a NatService element specifies how packets are handled by the NAT service.
+ *
+ */
+public enum NatPolicy {
+ /**
+ * packets of this type pass through the firewall in both directions
+ */
+ ALLOW_TRAFFIC,
+ /**
+ * only inbound packets of this type pass through the firewall
+ */
+ ALLOW_TRAFFIC_IN, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static NatPolicy fromValue(String policy) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(policy, "policy")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
new file mode 100755
index 0000000..00d89ad
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
@@ -0,0 +1,48 @@
+/*
+ * 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.vcloud.domain.network.nat;
+
+
+/**
+ *
+ * The Protocol specifies the network protocol to which this rule applies
+ *
+ * @since vcloud api 0.9
+ *
+ * @author Adrian Cole
+ */
+public enum NatProtocol {
+ /**
+ * the rule applies to the TCP protocol
+ *
+ * @since vcloud api 0.9
+ */
+ TCP,
+ /**
+ * the rule applies to the UDP protocol
+ *
+ * @since vcloud api 0.9
+ */
+ UDP,
+ /**
+ * the rule applies to the TCP and UDP protocols.
+ *
+ * @since vcloud api 0.9
+ */
+ TCP_UDP;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
new file mode 100755
index 0000000..71f50a2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
@@ -0,0 +1,35 @@
+/*
+ * 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.vcloud.domain.network.nat;
+
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ *
+ * Defines a rule associated with Nat
+ *
+ * @since vcloud api 0.9
+ *
+ * @author Adrian Cole
+ */
+public interface NatRule {
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the InternalIp element.
+ */
+ @Nullable
+ String getExternalIP();
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
new file mode 100755
index 0000000..c1ed970
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
@@ -0,0 +1,61 @@
+/*
+ * 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.vcloud.domain.network.nat;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ *
+ * The NatType element specifies how network address translation is implemented by the NAT service.
+ *
+ * @since vcloud api 0.9
+ *
+ * @author Adrian Cole
+ */
+public enum NatType {
+ /**
+ * NAT service implemented by IP address translation
+ *
+ * @since vcloud api 0.9
+ */
+ IP_TRANSLATION,
+ /**
+ * NAT service implemented by network port forwarding
+ *
+ * @since vcloud api 0.9
+ */
+ PORT_FORWARDING, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static NatType fromValue(String natType) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(natType, "natType")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
new file mode 100755
index 0000000..e579c51
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
@@ -0,0 +1,54 @@
+/*
+ * 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.vcloud.domain.network.nat.rules;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * The MappingMode element specifies how IP address mapping is implemented by the NAT service.
+ *
+ */
+public enum MappingMode {
+ /**
+ * the external IP address is specified in the ExternalIP element
+ */
+ MANUAL,
+ /**
+ * the external IP address is assigned automatically
+ */
+ AUTOMATIC, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static MappingMode fromValue(String mode) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(mode, "mode")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
new file mode 100755
index 0000000..890c17a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
@@ -0,0 +1,110 @@
+/*
+ * 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.vcloud.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The OneToOneVmRule element describes a NAT rule that specifies network address translation
+ * details for a single virtual machine. The external IP address can be specified manually or
+ * assigned automatically at deployment time. The internal IP address is discovered by looking up
+ * the specified VmReference and NIC ID.
+ *
+ * @since vcloud 0.9
+ * @author Adrian Cole
+ */
+public class OneToOneVmRule implements NatRule {
+ private final MappingMode mappingMode;
+ @Nullable
+ private final String externalIP;
+ @Nullable
+ private final String vAppScopedVmId;
+ private final int vmNicId;
+
+ public OneToOneVmRule(MappingMode mappingMode, @Nullable String externalIp, @Nullable String vAppScopedVmId,
+ int vmNicId) {
+ this.mappingMode = checkNotNull(mappingMode, "mappingMode");
+ this.externalIP = externalIp;
+ this.vAppScopedVmId = vAppScopedVmId;
+ this.vmNicId = vmNicId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ OneToOneVmRule that = OneToOneVmRule.class.cast(o);
+ return equal(this.mappingMode, that.mappingMode) && equal(this.externalIP, that.externalIP)
+ && equal(this.vAppScopedVmId, that.vAppScopedVmId) && equal(this.vmNicId, that.vmNicId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(mappingMode, externalIP, vAppScopedVmId, vmNicId);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("mappingMode", mappingMode).add("externalIP", externalIP)
+ .add("vAppScopedVmId", vAppScopedVmId).add("vmNicId", vmNicId).toString();
+ }
+
+ /**
+ * @return how IP address mapping is implemented by the NAT service
+ * @since vcloud 0.9
+ */
+ public MappingMode getMappingMode() {
+ return mappingMode;
+ }
+
+ /**
+ * @return if MappingMode is manual, specifies the external IP address of this Vm, otherwise
+ * null.
+ * @since vcloud 0.9
+ */
+ @Nullable
+ @Override
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * @return read‐only identifier created on import
+ * @since vcloud 0.9
+ */
+ @Nullable
+ public String getVAppScopedVmId() {
+ return vAppScopedVmId;
+ }
+
+ /**
+ * @return device number of the NIC on the referenced virtual machine
+ * @since vcloud 0.9
+ */
+ public int getVmNicId() {
+ return vmNicId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
new file mode 100755
index 0000000..f176bc6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
@@ -0,0 +1,111 @@
+/*
+ * 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.vcloud.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.vcloud.domain.network.nat.NatProtocol;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The PortForwardingRule element describes a NAT rule that maps an IP address and port in an
+ * organization network to an external IP address and port.
+ *
+ * @since vcloud 0.8
+ * @author Adrian Cole
+ */
+public class PortForwardingRule implements NatRule {
+ private final String externalIP;
+ private final int externalPort;
+ private final String internalIP;
+ private final int internalPort;
+ private final NatProtocol protocol;
+
+ public PortForwardingRule(String externalIP, int externalPort, String internalIP, int internalPort,
+ NatProtocol protocol) {
+ this.externalIP = checkNotNull(externalIP, "externalIP");
+ this.externalPort = externalPort;
+ this.internalIP = checkNotNull(internalIP, "internalIP");
+ this.internalPort = internalPort;
+ this.protocol = checkNotNull(protocol, "protocol");
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the InternalIp element.
+ */
+ @Override
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the InternalPort element
+ */
+ public int getExternalPort() {
+ return externalPort;
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the ExternalIp element.
+ */
+ public String getInternalIP() {
+ return internalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the ExternalPort
+ * element.
+ */
+ public int getInternalPort() {
+ return internalPort;
+ }
+
+ /**
+ * specifies the network protocol to which this rule applies
+ */
+ public NatProtocol getProtocol() {
+ return protocol;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ PortForwardingRule that = PortForwardingRule.class.cast(o);
+ return equal(this.externalIP, that.externalIP) && equal(this.externalPort, that.externalPort)
+ && equal(this.internalIP, that.internalIP) && equal(this.internalPort, that.internalPort)
+ && equal(this.protocol, that.protocol);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(externalIP, externalPort, internalIP, internalPort, protocol);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("externalIP", externalIP)
+ .add("externalPort", externalPort).add("internalIP", internalIP).add("internalPort", internalPort)
+ .add("protocol", protocol).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
new file mode 100755
index 0000000..5aa74a7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
@@ -0,0 +1,128 @@
+/*
+ * 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.vcloud.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatProtocol;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The VmRule element describes a NAT rule that maps an IP address and port in a vApp network to an
+ * external IP address and port. The external IP address, external port, and internal port are
+ * specified in the element. The internal IP address is discovered by looking up the specified
+ * VmReference and VmNicId.
+ *
+ * @since vcloud 0.9
+ * @author Adrian Cole
+ */
+public class VmRule implements NatRule {
+ @Nullable
+ private final String externalIP;
+ private final int externalPort;
+ @Nullable
+ private final String vAppScopedLocalId;
+ private final int vmNicId;
+ private final int internalPort;
+ private final NatProtocol protocol;
+
+ public VmRule(@Nullable String externalIP, int externalPort, @Nullable String vAppScopedLocalId, int vmNicId,
+ int internalPort, NatProtocol protocol) {
+ this.externalIP = externalIP;
+ this.externalPort = externalPort;
+ this.vAppScopedLocalId = vAppScopedLocalId;
+ this.vmNicId = vmNicId;
+ this.internalPort = internalPort;
+ this.protocol = checkNotNull(protocol, "protocol");
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the vAppScopedLocalId element.
+ */
+ @Nullable
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the InternalPort element
+ */
+ public Integer getExternalPort() {
+ return externalPort;
+ }
+
+ /**
+ * @return read‐only identifier created on import
+ * @since vcloud 0.9
+ */
+ @Nullable
+ public String getVAppScopedLocalId() {
+ return vAppScopedLocalId;
+ }
+
+ /**
+ * @return device number of the NIC on the referenced virtual machine
+ * @since vcloud 0.9
+ */
+ public int getVmNicId() {
+ return vmNicId;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the ExternalPort
+ * element.
+ */
+ public Integer getInternalPort() {
+ return internalPort;
+ }
+
+ /**
+ * specifies the network protocol to which this rule applies
+ */
+ public NatProtocol getProtocol() {
+ return protocol;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ VmRule that = VmRule.class.cast(o);
+ return equal(this.externalIP, that.externalIP) && equal(this.externalPort, that.externalPort)
+ && equal(this.vAppScopedLocalId, that.vAppScopedLocalId) && equal(this.vmNicId, that.vmNicId)
+ && equal(this.internalPort, that.internalPort) && equal(this.protocol, that.protocol);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(externalIP, externalPort, vAppScopedLocalId, vmNicId, internalPort, protocol);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("externalIP", externalIP)
+ .add("externalPort", externalPort).add("vAppScopedLocalId", vAppScopedLocalId).add("vmNicId", vmNicId)
+ .add("internalPort", internalPort).add("protocol", protocol).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java
new file mode 100755
index 0000000..35d0934
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java
@@ -0,0 +1,302 @@
+/*
+ * 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.vcloud.domain.ovf;
+
+import java.util.List;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+/**
+ * @author Adrian Cole
+ *
+ */
+public class EditableResourceAllocationSettingData extends ResourceAllocationSettingData {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder toBuilder() {
+ return builder().fromEditableResourceAllocationSettingData(this);
+ }
+
+ public static class Builder extends ResourceAllocationSettingData.Builder {
+ private ReferenceType edit;
+
+ /**
+ * @see EditableResourceAllocationSettingData#getEdit
+ */
+ public Builder edit(ReferenceType edit) {
+ this.edit = edit;
+ return this;
+ }
+
+ public EditableResourceAllocationSettingData build() {
+ return new EditableResourceAllocationSettingData(elementName, instanceID, caption, description, address,
+ addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
+ mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
+ virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, edit);
+ }
+
+ public Builder fromEditableResourceAllocationSettingData(EditableResourceAllocationSettingData in) {
+ return edit(in.getEdit()).fromResourceAllocationSettingData(in);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder caption(String caption) {
+ return Builder.class.cast(super.caption(caption));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder description(String description) {
+ return Builder.class.cast(super.description(description));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder elementName(String elementName) {
+ return Builder.class.cast(super.elementName(elementName));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder instanceID(String instanceID) {
+ return Builder.class.cast(super.instanceID(instanceID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder address(String address) {
+ return Builder.class.cast(super.address(address));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder addressOnParent(String addressOnParent) {
+ return Builder.class.cast(super.addressOnParent(addressOnParent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder allocationUnits(String allocationUnits) {
+ return Builder.class.cast(super.allocationUnits(allocationUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticAllocation(Boolean automaticAllocation) {
+ return Builder.class.cast(super.automaticAllocation(automaticAllocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticDeallocation(Boolean automaticDeallocation) {
+ return Builder.class.cast(super.automaticDeallocation(automaticDeallocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connection(String connection) {
+ return Builder.class.cast(super.connection(connection));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connections(List<String> connections) {
+ return Builder.class.cast(super.connections(connections));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder consumerVisibility(ConsumerVisibility consumerVisibility) {
+ return Builder.class.cast(super.consumerVisibility(consumerVisibility));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResource(String hostResource) {
+ return Builder.class.cast(super.hostResource(hostResource));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResources(List<String> hostResources) {
+ return Builder.class.cast(super.hostResources(hostResources));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder limit(Long limit) {
+ return Builder.class.cast(super.limit(limit));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder mappingBehavior(MappingBehavior mappingBehavior) {
+ return Builder.class.cast(super.mappingBehavior(mappingBehavior));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder otherResourceType(String otherResourceType) {
+ return Builder.class.cast(super.otherResourceType(otherResourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder parent(String parent) {
+ return Builder.class.cast(super.parent(parent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder poolID(String poolID) {
+ return Builder.class.cast(super.poolID(poolID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder reservation(Long reservation) {
+ return Builder.class.cast(super.reservation(reservation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceSubType(String resourceSubType) {
+ return Builder.class.cast(super.resourceSubType(resourceSubType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) {
+ return Builder.class.cast(super.resourceType(resourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantity(Long virtualQuantity) {
+ return Builder.class.cast(super.virtualQuantity(virtualQuantity));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantityUnits(String virtualQuantityUnits) {
+ return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder weight(Integer weight) {
+ return Builder.class.cast(super.weight(weight));
+ }
+
+ @Override
+ public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
+ return Builder.class.cast(super.fromResourceAllocationSettingData(in));
+ }
+
+ }
+
+ private final ReferenceType edit;
+
+ public EditableResourceAllocationSettingData(String elementName, String instanceID, String caption,
+ String description, String address, String addressOnParent, String allocationUnits,
+ Boolean automaticAllocation, Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit,
+ MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation,
+ String resourceSubType, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType,
+ Long virtualQuantity, String virtualQuantityUnits, Integer weight, List<String> connections,
+ List<String> hostResources, ReferenceType edit) {
+ super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType,
+ parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight,
+ connections, hostResources);
+ this.edit = edit;
+ }
+
+ public ReferenceType getEdit() {
+ return edit;
+ }
+
+ @Override
+ public String toString() {
+ return String
+ .format(
+ "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, edit=%s]",
+ elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit,
+ mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
+ virtualQuantity, virtualQuantityUnits, weight, edit);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java
new file mode 100755
index 0000000..c1d9430
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java
@@ -0,0 +1,330 @@
+/*
+ * 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.vcloud.domain.ovf;
+
+import java.util.List;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+
+/**
+ * @author Adrian Cole
+ *
+ */
+public class VCloudHardDisk extends ResourceAllocationSettingData {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder toBuilder() {
+ return builder().fromVCloudHardDisk(this);
+ }
+
+ public static class Builder extends ResourceAllocationSettingData.Builder {
+ private long capacity;
+ private int busType;
+ private String busSubType;
+
+ /**
+ * @see VCloudHardDisk#getCapacity
+ */
+ public Builder capacity(long capacity) {
+ this.capacity = capacity;
+ return this;
+ }
+
+ /**
+ * @see VCloudHardDisk#getBusType
+ */
+ public Builder busType(int busType) {
+ this.busType = busType;
+ return this;
+ }
+
+ /**
+ * @see VCloudHardDisk#getBusSubType
+ */
+ public Builder busSubType(String busSubType) {
+ this.busSubType = busSubType;
+ return this;
+ }
+
+ public VCloudHardDisk build() {
+ return new VCloudHardDisk(elementName, instanceID, caption, description, address, addressOnParent,
+ allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior,
+ otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity,
+ virtualQuantityUnits, weight, connections, hostResources, capacity, busType, busSubType);
+ }
+
+ public Builder fromVCloudHardDisk(VCloudHardDisk in) {
+ return capacity(in.getCapacity()).busType(in.getBusType()).busSubType(in.getBusSubType())
+ .fromResourceAllocationSettingData(in);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder caption(String caption) {
+ return Builder.class.cast(super.caption(caption));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder description(String description) {
+ return Builder.class.cast(super.description(description));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder elementName(String elementName) {
+ return Builder.class.cast(super.elementName(elementName));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder instanceID(String instanceID) {
+ return Builder.class.cast(super.instanceID(instanceID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder address(String address) {
+ return Builder.class.cast(super.address(address));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder addressOnParent(String addressOnParent) {
+ return Builder.class.cast(super.addressOnParent(addressOnParent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder allocationUnits(String allocationUnits) {
+ return Builder.class.cast(super.allocationUnits(allocationUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticAllocation(Boolean automaticAllocation) {
+ return Builder.class.cast(super.automaticAllocation(automaticAllocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticDeallocation(Boolean automaticDeallocation) {
+ return Builder.class.cast(super.automaticDeallocation(automaticDeallocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connection(String connection) {
+ return Builder.class.cast(super.connection(connection));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connections(List<String> connections) {
+ return Builder.class.cast(super.connections(connections));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder consumerVisibility(ConsumerVisibility consumerVisibility) {
+ return Builder.class.cast(super.consumerVisibility(consumerVisibility));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResource(String hostResource) {
+ return Builder.class.cast(super.hostResource(hostResource));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResources(List<String> hostResources) {
+ return Builder.class.cast(super.hostResources(hostResources));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder limit(Long limit) {
+ return Builder.class.cast(super.limit(limit));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder mappingBehavior(MappingBehavior mappingBehavior) {
+ return Builder.class.cast(super.mappingBehavior(mappingBehavior));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder otherResourceType(String otherResourceType) {
+ return Builder.class.cast(super.otherResourceType(otherResourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder parent(String parent) {
+ return Builder.class.cast(super.parent(parent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder poolID(String poolID) {
+ return Builder.class.cast(super.poolID(poolID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder reservation(Long reservation) {
+ return Builder.class.cast(super.reservation(reservation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceSubType(String resourceSubType) {
+ return Builder.class.cast(super.resourceSubType(resourceSubType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) {
+ return Builder.class.cast(super.resourceType(resourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantity(Long virtualQuantity) {
+ return Builder.class.cast(super.virtualQuantity(virtualQuantity));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantityUnits(String virtualQuantityUnits) {
+ return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder weight(Integer weight) {
+ return Builder.class.cast(super.weight(weight));
+ }
+
+ @Override
+ public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
+ return Builder.class.cast(super.fromResourceAllocationSettingData(in));
+ }
+ }
+
+ private final long capacity;
+ private final int busType;
+ private final String busSubType;
+
+ public VCloudHardDisk(String elementName, String instanceID, String caption, String description, String address,
+ String addressOnParent, String allocationUnits, Boolean automaticAllocation, Boolean automaticDeallocation,
+ ConsumerVisibility consumerVisibility, Long limit, MappingBehavior mappingBehavior, String otherResourceType,
+ String parent, String poolID, Long reservation, String resourceSubType,
+ org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, Long virtualQuantity,
+ String virtualQuantityUnits, Integer weight, List<String> connections, List<String> hostResources,
+ long capacity, int busType, String busSubType) {
+ super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType,
+ parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight,
+ connections, hostResources);
+ this.capacity = capacity;
+ this.busType = busType;
+ this.busSubType = busSubType;
+ }
+
+ public long getCapacity() {
+ return capacity;
+ }
+
+ public int getBusType() {
+ return busType;
+ }
+
+ public String getBusSubType() {
+ return busSubType;
+ }
+
+ @Override
+ public String toString() {
+ return String
+ .format(
+ "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, busSubType=%s, busType=%s, capacity=%s]",
+ elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit,
+ mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
+ virtualQuantity, virtualQuantityUnits, weight, busSubType, busType, capacity);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java
new file mode 100755
index 0000000..6280f10
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java
@@ -0,0 +1,332 @@
+/*
+ * 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.vcloud.domain.ovf;
+
+import java.util.List;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+
+/**
+ * @author Adrian Cole
+ *
+ */
+public class VCloudNetworkAdapter extends ResourceAllocationSettingData {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder toBuilder() {
+ return builder().fromVCloudNetworkAdapter(this);
+ }
+
+ public static class Builder extends ResourceAllocationSettingData.Builder {
+ private String ipAddress;
+ private boolean primaryNetworkConnection;
+ private String ipAddressingMode;
+
+ /**
+ * @see VCloudNetworkAdapter#getCapacity
+ */
+ public Builder ipAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ /**
+ * @see VCloudNetworkAdapter#getBusType
+ */
+ public Builder primaryNetworkConnection(boolean primaryNetworkConnection) {
+ this.primaryNetworkConnection = primaryNetworkConnection;
+ return this;
+ }
+
+ /**
+ * @see VCloudNetworkAdapter#getBusSubType
+ */
+ public Builder ipAddressingMode(String ipAddressingMode) {
+ this.ipAddressingMode = ipAddressingMode;
+ return this;
+ }
+
+ public VCloudNetworkAdapter build() {
+ return new VCloudNetworkAdapter(elementName, instanceID, caption, description, address, addressOnParent,
+ allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
+ mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
+ virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, ipAddress,
+ primaryNetworkConnection, ipAddressingMode);
+ }
+
+ public Builder fromVCloudNetworkAdapter(VCloudNetworkAdapter in) {
+ return ipAddress(in.getIpAddress()).primaryNetworkConnection(in.isPrimaryNetworkConnection())
+ .ipAddressingMode(in.getIpAddressingMode()).fromResourceAllocationSettingData(in);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder caption(String caption) {
+ return Builder.class.cast(super.caption(caption));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder description(String description) {
+ return Builder.class.cast(super.description(description));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder elementName(String elementName) {
+ return Builder.class.cast(super.elementName(elementName));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder instanceID(String instanceID) {
+ return Builder.class.cast(super.instanceID(instanceID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder address(String address) {
+ return Builder.class.cast(super.address(address));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder addressOnParent(String addressOnParent) {
+ return Builder.class.cast(super.addressOnParent(addressOnParent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder allocationUnits(String allocationUnits) {
+ return Builder.class.cast(super.allocationUnits(allocationUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticAllocation(Boolean automaticAllocation) {
+ return Builder.class.cast(super.automaticAllocation(automaticAllocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticDeallocation(Boolean automaticDeallocation) {
+ return Builder.class.cast(super.automaticDeallocation(automaticDeallocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connection(String connection) {
+ return Builder.class.cast(super.connection(connection));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connections(List<String> connections) {
+ return Builder.class.cast(super.connections(connections));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder consumerVisibility(ConsumerVisibility consumerVisibility) {
+ return Builder.class.cast(super.consumerVisibility(consumerVisibility));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResource(String hostResource) {
+ return Builder.class.cast(super.hostResource(hostResource));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResources(List<String> hostResources) {
+ return Builder.class.cast(super.hostResources(hostResources));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder limit(Long limit) {
+ return Builder.class.cast(super.limit(limit));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder mappingBehavior(MappingBehavior mappingBehavior) {
+ return Builder.class.cast(super.mappingBehavior(mappingBehavior));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder otherResourceType(String otherResourceType) {
+ return Builder.class.cast(super.otherResourceType(otherResourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder parent(String parent) {
+ return Builder.class.cast(super.parent(parent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder poolID(String poolID) {
+ return Builder.class.cast(super.poolID(poolID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder reservation(Long reservation) {
+ return Builder.class.cast(super.reservation(reservation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceSubType(String resourceSubType) {
+ return Builder.class.cast(super.resourceSubType(resourceSubType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) {
+ return Builder.class.cast(super.resourceType(resourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantity(Long virtualQuantity) {
+ return Builder.class.cast(super.virtualQuantity(virtualQuantity));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantityUnits(String virtualQuantityUnits) {
+ return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder weight(Integer weight) {
+ return Builder.class.cast(super.weight(weight));
+ }
+
+ @Override
+ public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
+ return Builder.class.cast(super.fromResourceAllocationSettingData(in));
+ }
+ }
+
+ private final String ipAddress;
+ private final boolean primaryNetworkConnection;
+ private final String ipAddressingMode;
+
+ public VCloudNetworkAdapter(String elementName, String instanceID, String caption, String description,
+ String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation,
+ Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit,
+ MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation,
+ String resourceSubType, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType,
+ Long virtualQuantity, String virtualQuantityUnits, Integer weight, List<String> connections,
+ List<String> hostResources, String ipAddress, boolean primaryNetworkConnection, String ipAddressingMode) {
+ super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior,
+ otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity,
+ virtualQuantityUnits, weight, connections, hostResources);
+ this.ipAddress = ipAddress;
+ this.primaryNetworkConnection = primaryNetworkConnection;
+ this.ipAddressingMode = ipAddressingMode;
+ }
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public boolean isPrimaryNetworkConnection() {
+ return primaryNetworkConnection;
+ }
+
+ public String getIpAddressingMode() {
+ return ipAddressingMode;
+ }
+
+ @Override
+ public String toString() {
+ return String
+ .format(
+ "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, ipAddressingMode=%s, primaryNetworkConnection=%s, ipAddress=%s]",
+ elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources,
+ limit, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType,
+ resourceType, virtualQuantity, virtualQuantityUnits, weight, ipAddressingMode,
+ primaryNetworkConnection, ipAddress);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java
new file mode 100755
index 0000000..64dddc5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java
@@ -0,0 +1,80 @@
+/*
+ * 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.vcloud.domain.ovf;
+
+import java.net.URI;
+
+import org.jclouds.ovf.Network;
+import org.jclouds.ovf.NetworkSection;
+
+/**
+ * VCloud extension
+ */
+public class VCloudNetworkSection extends NetworkSection {
+ protected final String type;
+ protected final URI href;
+
+ public VCloudNetworkSection(String type, URI href, String info, Iterable<Network> networks) {
+ super(info, networks);
+ this.type = type;
+ this.href = href;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public URI getHref() {
+ return href;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VCloudNetworkSection other = (VCloudNetworkSection) obj;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", networks=" + getNetworks() + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java
new file mode 100755
index 0000000..052eadd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java
@@ -0,0 +1,118 @@
+/*
+ * 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.vcloud.domain.ovf;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.ovf.OperatingSystemSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+/**
+ * A description of the operating system supported by a virtual machine.
+ */
+public class VCloudOperatingSystemSection extends OperatingSystemSection {
+ protected final String type;
+ protected final URI href;
+ @Nullable
+ protected final String vmwOsType;
+ protected final ReferenceType edit;
+
+ public VCloudOperatingSystemSection(@Nullable Integer id, @Nullable String info, @Nullable String description, String type,
+ URI href, @Nullable String vmwOsType, ReferenceType edit) {
+ super(id, info, description);
+ this.type = type;
+ this.href = href;
+ this.vmwOsType = vmwOsType;
+ this.edit = checkNotNull(edit, "edit");
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public URI getHref() {
+ return href;
+ }
+
+ /**
+ *
+ * @return VMware osType, if running on VMware
+ */
+ public String getVmwOsType() {
+ return vmwOsType;
+ }
+
+ /**
+ *
+ * @return edit link
+ */
+ public ReferenceType getEdit() {
+ return edit;
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", type=" + getType() + ", id=" + getId() + ", vmwOsType=" + getVmwOsType()
+ + ", description=" + getDescription() + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((edit == null) ? 0 : edit.hashCode());
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((vmwOsType == null) ? 0 : vmwOsType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VCloudOperatingSystemSection other = (VCloudOperatingSystemSection) obj;
+ if (edit == null) {
+ if (other.edit != null)
+ return false;
+ } else if (!edit.equals(other.edit))
+ return false;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ if (vmwOsType == null) {
+ if (other.vmwOsType != null)
+ return false;
+ } else if (!vmwOsType.equals(other.vmwOsType))
+ return false;
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java
new file mode 100755
index 0000000..6d89b95
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java
@@ -0,0 +1,179 @@
+/*
+ * 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.vcloud.domain.ovf;
+
+import java.net.URI;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.VirtualSystemSettingData;
+import org.jclouds.ovf.Section;
+import org.jclouds.ovf.VirtualHardwareSection;
+
+/**
+ * A description of the virtual hardware supported by a virtual machine.
+ */
+public class VCloudVirtualHardwareSection extends VirtualHardwareSection {
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder toBuilder() {
+ return builder().fromVCloudVirtualHardwareSection(this);
+ }
+
+ public static class Builder extends VirtualHardwareSection.Builder {
+ protected String type;
+ protected URI href;
+
+ /**
+ * @see VCloudVirtualHardware#getType
+ */
+ public Builder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * @see VCloudVirtualHardware#getHref
+ */
+ public Builder href(URI href) {
+ this.href = href;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder system(VirtualSystemSettingData virtualSystem) {
+ return Builder.class.cast(super.system(virtualSystem));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder transport(String transport) {
+ return Builder.class.cast(super.transport(transport));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder transports(Iterable<String> transports) {
+ return Builder.class.cast(super.transports(transports));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder item(ResourceAllocationSettingData item) {
+ return Builder.class.cast(super.item(item));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder items(Iterable<? extends ResourceAllocationSettingData> items) {
+ return Builder.class.cast(super.items(items));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudVirtualHardwareSection build() {
+ return new VCloudVirtualHardwareSection(type, href, info, transports, virtualSystem, items);
+ }
+
+ public Builder fromVCloudVirtualHardwareSection(VCloudVirtualHardwareSection in) {
+ return fromVirtualHardwareSection(in).type(in.getType()).href(in.getHref());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder fromVirtualHardwareSection(VirtualHardwareSection in) {
+ return Builder.class.cast(super.fromVirtualHardwareSection(in));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder fromSection(Section<VirtualHardwareSection> in) {
+ return Builder.class.cast(super.fromSection(in));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder info(String info) {
+ return Builder.class.cast(super.info(info));
+ }
+ }
+
+ protected final String type;
+ protected final URI href;
+
+ public VCloudVirtualHardwareSection(String type, URI href, String info, Iterable<String> transports,
+ VirtualSystemSettingData virtualSystem, Iterable<? extends ResourceAllocationSettingData> resourceAllocations) {
+ super(info, transports, virtualSystem, resourceAllocations);
+ this.type = type;
+ this.href = href;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public URI getHref() {
+ return href;
+ }
+
+ @Override
+ public int hashCode() {
+ return href.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VCloudVirtualHardwareSection other = (VCloudVirtualHardwareSection) obj;
+ return href.equals(other.href);
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", virtualSystem=" + getSystem()
+ + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
new file mode 100755
index 0000000..99fcead
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud Catalog.
+ *
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface Catalog {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java
new file mode 100755
index 0000000..ae6a6b7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud Network.
+ *
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface Network {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java
new file mode 100755
index 0000000..6385df8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud express Org.
+ *
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface Org {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java
new file mode 100755
index 0000000..5090e32
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud express Org List.
+ *
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface OrgList {
+
+}
[31/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java
new file mode 100755
index 0000000..84e5fef
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java
@@ -0,0 +1,79 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindCPUCountToXmlPayload extends BindToStringPayload {
+ protected final String ns;
+ protected final String schema;
+
+ @Inject
+ public BindCPUCountToXmlPayload(BindToStringPayload stringBinder, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
+ @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ }
+
+ private static final String RESOURCE_ALLOCATION_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(checkNotNull(payload, "cpuCount") instanceof Integer, "this binder is only valid for Integers!");
+ Integer cpuCount = Integer.class.cast(payload);
+ XMLBuilder cpuItem;
+ try {
+ cpuItem = XMLBuilder.create("Item").a("xmlns", ns).a("xmlns:rasd", RESOURCE_ALLOCATION_NS);
+ cpuItem.e("rasd:AllocationUnits").t("hertz * 10^6");
+ cpuItem.e("rasd:Description").t("Number of Virtual CPUs");
+ cpuItem.e("rasd:ElementName").t(cpuCount.toString() + " virtual CPU(s)");
+ cpuItem.e("rasd:InstanceID").t("4");
+ cpuItem.e("rasd:ResourceType").t(ResourceType.PROCESSOR.value());
+ cpuItem.e("rasd:VirtualQuantity").t(cpuCount.toString());
+ cpuItem.e("rasd:Weight").t("0");
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ request = super.bindToRequest(request, cpuItem.asString(outputProperties));
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java
new file mode 100755
index 0000000..268f0f4
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java
@@ -0,0 +1,124 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.options.CaptureVAppOptions;
+
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindCaptureVAppParamsToXmlPayload implements MapBinder {
+
+ protected final String ns;
+ protected final String schema;
+ private final BindToStringPayload stringBinder;
+
+ @Inject
+ public BindCaptureVAppParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ this.stringBinder = stringBinder;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+ String templateName = checkNotNull(postParams.remove("templateName"), "templateName").toString();
+ String vApp = checkNotNull(postParams.remove("vApp"), "vApp").toString();
+
+ CaptureVAppOptions options = findOptionsInArgsOrNull(gRequest);
+ if (options == null) {
+ options = new CaptureVAppOptions();
+ }
+ try {
+ return stringBinder.bindToRequest(request, generateXml(templateName, vApp, options));
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ protected String generateXml(String templateName, String vApp, CaptureVAppOptions options)
+ throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
+ XMLBuilder rootBuilder = buildRoot(templateName);
+ if (options.getDescription() != null)
+ rootBuilder.e("Description").text(options.getDescription());
+ rootBuilder.e("Source").a("href", vApp).a("type", VCloudMediaType.VAPP_XML);
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ return rootBuilder.asString(outputProperties);
+ }
+
+ protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
+ XMLBuilder rootBuilder = XMLBuilder.create("CaptureVAppParams").a("name", name).a("xmlns", ns)
+ .a("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema);
+ return rootBuilder;
+ }
+
+ protected CaptureVAppOptions findOptionsInArgsOrNull(GeneratedHttpRequest gRequest) {
+ for (Object arg : gRequest.getInvocation().getArgs()) {
+ if (arg instanceof CaptureVAppOptions) {
+ return (CaptureVAppOptions) arg;
+ } else if (arg instanceof CaptureVAppOptions[]) {
+ CaptureVAppOptions[] options = (CaptureVAppOptions[]) arg;
+ return (options.length > 0) ? options[0] : null;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException("CaptureVAppParams is needs parameters");
+ }
+
+ protected String ifNullDefaultTo(String value, String defaultValue) {
+ return value != null ? value : checkNotNull(defaultValue, "defaultValue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java
new file mode 100755
index 0000000..5e91a79
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java
@@ -0,0 +1,126 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindCatalogItemToXmlPayload implements MapBinder {
+
+ protected final String ns;
+ protected final String schema;
+ private final BindToStringPayload stringBinder;
+
+ @Inject
+ public BindCatalogItemToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ this.stringBinder = stringBinder;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+ String name = checkNotNull(postParams.get("name"), "name").toString();
+ URI entity = URI.create(checkNotNull(postParams.get("Entity"), "Entity").toString());
+
+ CatalogItemOptions options = findOptionsInArgsOrNew(gRequest);
+ try {
+ return stringBinder.bindToRequest(request, generateXml(name, entity, options));
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ protected String generateXml(String templateName, URI entity, CatalogItemOptions options)
+ throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
+ XMLBuilder rootBuilder = buildRoot(templateName);
+ if (options.getDescription() != null)
+ rootBuilder.e("Description").t(options.getDescription());
+ rootBuilder.e("Entity").a("href", entity.toASCIIString());
+ for (Entry<String, String> entry : options.getProperties().entrySet()) {
+ rootBuilder.e("Property").a("key", entry.getKey()).t(entry.getValue());
+ }
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ return rootBuilder.asString(outputProperties);
+ }
+
+ protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
+ XMLBuilder rootBuilder = XMLBuilder.create("CatalogItem").a("name", name).a("xmlns", ns).a("xmlns:xsi",
+ "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema);
+ return rootBuilder;
+ }
+
+ protected CatalogItemOptions findOptionsInArgsOrNew(GeneratedHttpRequest gRequest) {
+ for (Object arg : gRequest.getInvocation().getArgs()) {
+ if (arg instanceof CatalogItemOptions) {
+ return CatalogItemOptions.class.cast(arg);
+ } else if (arg.getClass().isArray()) {
+ Object[] array = (Object[]) arg;
+ if (array.length > 0 && array[0] instanceof CatalogItemOptions)
+ return CatalogItemOptions.class.cast(array[0]);
+ }
+ }
+ return new CatalogItemOptions();
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException("CatalogItem is needs parameters");
+ }
+
+ protected String ifNullDefaultTo(String value, String defaultValue) {
+ return value != null ? value : checkNotNull(defaultValue, "defaultValue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java
new file mode 100755
index 0000000..47485de
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java
@@ -0,0 +1,133 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.options.CloneOptions;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public abstract class BindCloneParamsToXmlPayload<O extends CloneOptions> implements MapBinder {
+
+ protected final String ns;
+ protected final String schema;
+ private final BindToStringPayload stringBinder;
+
+ protected abstract String getRootElement();
+ protected abstract String getSourceMediaType();
+ protected abstract Class<O> getOptionClass();
+
+ @Inject
+ public BindCloneParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ this.stringBinder = stringBinder;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+ String name = checkNotNull(postParams.get("name"), "name").toString();
+ String source = checkNotNull(postParams.get("Source"), "Source").toString();
+ boolean isSourceDelete = Boolean.parseBoolean((String) postParams.get("IsSourceDelete"));
+
+ O options = findOptionsInArgsOrNew(gRequest);
+ return stringBinder.bindToRequest(request, generateXml(name, source, isSourceDelete, options));
+ }
+
+ protected String generateXml(String name, String source, boolean isSourceDelete, O options) {
+ XMLBuilder rootBuilder = buildRoot(name, options);
+ addElementsUnderRoot(rootBuilder, source, options, isSourceDelete);
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ try {
+ return rootBuilder.asString(outputProperties);
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ protected void addElementsUnderRoot(XMLBuilder rootBuilder, String source, O options, boolean isSourceDelete) {
+ if (options.getDescription() != null)
+ rootBuilder.e("Description").text(options.getDescription());
+ rootBuilder.e("Source").a("href", source).a("type", getSourceMediaType());
+ if (isSourceDelete)
+ rootBuilder.e("IsSourceDelete").t("true");
+ }
+
+ protected XMLBuilder buildRoot(String name, O options) {
+ try {
+ return XMLBuilder.create(getRootElement()).a("xmlns", ns).a("xmlns:xsi",
+ "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema).a("name",
+ name);
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected O findOptionsInArgsOrNew(GeneratedHttpRequest gRequest) {
+ for (Object arg : gRequest.getInvocation().getArgs()) {
+ if (getOptionClass().isInstance(arg)) {
+ return (O) arg;
+ } else if (arg.getClass().isArray()) {
+ Object[] array = (Object[]) arg;
+ if (array.length > 0 && getOptionClass().isInstance(array[0]))
+ return (O) array[0];
+ }
+ }
+ try {
+ return getOptionClass().newInstance();
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException("CloneParams is needs parameters");
+ }
+
+ protected String ifNullDefaultTo(String value, String defaultValue) {
+ return value != null ? value : checkNotNull(defaultValue, "defaultValue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java
new file mode 100755
index 0000000..3f6ddd6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.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.vcloud.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindCloneVAppParamsToXmlPayload extends BindCloneParamsToXmlPayload<CloneVAppOptions> {
+
+ @Inject
+ public BindCloneVAppParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ super(stringBinder, ns, schema);
+ }
+
+ @Override
+ protected Class<CloneVAppOptions> getOptionClass() {
+ return CloneVAppOptions.class;
+ }
+
+ @Override
+ protected String getRootElement() {
+ return "CloneVAppParams";
+ }
+
+ @Override
+ protected String getSourceMediaType() {
+ return VCloudMediaType.VAPP_XML;
+ }
+
+ protected XMLBuilder buildRoot(String name, CloneVAppOptions options) {
+ return super.buildRoot(name, options).a("deploy", options.isDeploy() + "").a("powerOn", options.isPowerOn() + "");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java
new file mode 100755
index 0000000..018a009
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java
@@ -0,0 +1,60 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+
+import com.google.inject.Inject;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindCloneVAppTemplateParamsToXmlPayload extends BindCloneParamsToXmlPayload<CloneVAppTemplateOptions> {
+
+ @Inject
+ public BindCloneVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ super(stringBinder, schema, schema);
+ }
+
+ @Override
+ protected Class<CloneVAppTemplateOptions> getOptionClass() {
+ return CloneVAppTemplateOptions.class;
+ }
+
+ @Override
+ protected String getRootElement() {
+ return "CloneVAppTemplateParams";
+ }
+
+ @Override
+ protected String getSourceMediaType() {
+ return VCloudMediaType.VAPPTEMPLATE_XML;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java
new file mode 100755
index 0000000..4d7f117
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java
@@ -0,0 +1,42 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.inject.Inject;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindDeployVAppParamsToXmlPayload extends BindParamsToXmlPayload {
+
+ @Inject
+ public BindDeployVAppParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
+ super("DeployVAppParams", stringBinder, ns);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java
new file mode 100755
index 0000000..bf40731
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java
@@ -0,0 +1,112 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Properties;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindGuestCustomizationSectionToXmlPayload extends BindToStringPayload {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ protected final String ns;
+ protected final String schema;
+
+ @Inject
+ public BindGuestCustomizationSectionToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(checkNotNull(payload, "GuestCustomizationSection") instanceof GuestCustomizationSection,
+ "this binder is only valid for GuestCustomizationSection!");
+ GuestCustomizationSection guest = GuestCustomizationSection.class.cast(payload);
+ XMLBuilder guestCustomizationSection;
+ try {
+ guestCustomizationSection = XMLBuilder.create("GuestCustomizationSection").a("xmlns", ns).a("xmlns:ovf",
+ "http://schemas.dmtf.org/ovf/envelope/1").a("type", guest.getType()).a("href",
+ guest.getHref().toASCIIString()).a("ovf:required", "false");
+ guestCustomizationSection.e("ovf:Info").t(guest.getInfo());
+
+ if (guest.isEnabled() != null)
+ guestCustomizationSection.e("Enabled").t(guest.isEnabled().toString());
+ if (guest.shouldChangeSid() != null)
+ guestCustomizationSection.e("ChangeSid").t(guest.shouldChangeSid().toString());
+ if (guest.getVirtualMachineId() != null)
+ guestCustomizationSection.e("VirtualMachineId").t(guest.getVirtualMachineId().toString());
+ if (guest.isJoinDomainEnabled() != null)
+ guestCustomizationSection.e("JoinDomainEnabled").t(guest.isJoinDomainEnabled().toString());
+ if (guest.shouldUseOrgSettings() != null)
+ guestCustomizationSection.e("UseOrgSettings").t(guest.shouldUseOrgSettings().toString());
+ if (guest.getDomainName() != null)
+ guestCustomizationSection.e("DomainName").t(guest.getDomainName().toString());
+ if (guest.getDomainUserName() != null)
+ guestCustomizationSection.e("DomainUserName").t(guest.getDomainUserName().toString());
+ if (guest.getDomainUserPassword() != null)
+ guestCustomizationSection.e("DomainUserPassword").t(guest.getDomainUserPassword().toString());
+ if (guest.isAdminPasswordEnabled() != null)
+ guestCustomizationSection.e("AdminPasswordEnabled").t(guest.isAdminPasswordEnabled().toString());
+ if (guest.isAdminPasswordAuto() != null)
+ guestCustomizationSection.e("AdminPasswordAuto").t(guest.isAdminPasswordAuto().toString());
+ // if (guest.getAdminPassword() != null)
+ // guestCustomizationSection.e("AdminPassword").t(guest.getAdminPassword().toString());
+ if (guest.isResetPasswordRequired() != null)
+ guestCustomizationSection.e("ResetPasswordRequired").t(guest.isResetPasswordRequired().toString());
+ if (guest.getCustomizationScript() != null)
+ guestCustomizationSection.e("CustomizationScript").t(guest.getCustomizationScript());
+ if (guest.getComputerName() != null)
+ guestCustomizationSection.e("ComputerName").t(guest.getComputerName().toString());
+ if (guest.getEdit() != null)
+ guestCustomizationSection.e("Link").a("rel", "edit").a("type", guest.getType()).a("href",
+ guest.getHref().toASCIIString());
+
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ request = super.bindToRequest(request, guestCustomizationSection.asString(outputProperties));
+ request.getPayload().getContentMetadata().setContentType(guest.getType());
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
new file mode 100755
index 0000000..bd80bae
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
@@ -0,0 +1,221 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.transform;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableSet;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder {
+
+ protected final String ns;
+ protected final String schema;
+ protected final BindToStringPayload stringBinder;
+ protected final Supplier<ReferenceType> defaultNetwork;
+ protected final FenceMode defaultFenceMode;
+ protected final LoadingCache<URI, VAppTemplate> templateCache;
+ protected final Function<VAppTemplate, String> defaultNetworkNameInTemplate;
+
+ @Inject
+ public BindInstantiateVAppTemplateParamsToXmlPayload(LoadingCache<URI, VAppTemplate> templateCache,
+ @Network Function<VAppTemplate, String> defaultNetworkNameInTemplate, BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema,
+ @Network Supplier<ReferenceType> network, FenceMode fenceMode) {
+ this.templateCache = templateCache;
+ this.defaultNetworkNameInTemplate = defaultNetworkNameInTemplate;
+ this.ns = ns;
+ this.schema = schema;
+ this.stringBinder = stringBinder;
+ this.defaultNetwork = network;
+ this.defaultFenceMode = fenceMode;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+ String name = checkNotNull(postParams.remove("name"), "name").toString();
+ URI template = URI.create(checkNotNull(postParams.remove("template"), "template").toString());
+
+ Set<NetworkConfig> networkConfig = null;
+
+ NetworkConfigDecorator networkConfigDecorator = new NetworkConfigDecorator(templateCache.getUnchecked(template),
+ defaultNetwork.get().getHref(), defaultFenceMode, defaultNetworkNameInTemplate);
+
+ InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
+
+ if (options != null) {
+ if (options.getNetworkConfig().size() > 0)
+ networkConfig = ImmutableSet
+ .copyOf(transform(options.getNetworkConfig(), networkConfigDecorator));
+ } else {
+ options = new InstantiateVAppTemplateOptions();
+ }
+
+ if (networkConfig == null)
+ networkConfig = ImmutableSet.of(networkConfigDecorator.apply(null));
+
+ try {
+ return stringBinder.bindToRequest(request, generateXml(name, options.getDescription(), options.shouldDeploy(),
+ options.shouldPowerOn(), template, networkConfig));
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ @VisibleForTesting
+ Set<Vm> ifCustomizationScriptIsSetGetVmsInTemplate(String customizationScript, final URI template) {
+ Set<Vm> vms = ImmutableSet.of();
+ if (customizationScript != null) {
+ VAppTemplate vAppTemplate = templateCache.getUnchecked(template);
+ checkArgument(vAppTemplate != null, "vAppTemplate %s not found!", template);
+ vms = vAppTemplate.getChildren();
+ checkArgument(vms.size() > 0, "no vms found in vAppTemplate %s", vAppTemplate);
+ }
+ return vms;
+ }
+
+ protected static final class NetworkConfigDecorator implements Function<NetworkConfig, NetworkConfig> {
+ private final VAppTemplate template;
+ private final URI defaultNetwork;
+ private final FenceMode defaultFenceMode;
+ private final Function<VAppTemplate, String> defaultNetworkNameInTemplate;
+
+ protected NetworkConfigDecorator(VAppTemplate template, URI defaultNetwork, FenceMode defaultFenceMode,
+ Function<VAppTemplate, String> defaultNetworkNameInTemplate) {
+ this.template = checkNotNull(template, "template");
+ this.defaultNetwork = checkNotNull(defaultNetwork, "defaultNetwork");
+ this.defaultFenceMode = checkNotNull(defaultFenceMode, "defaultFenceMode");
+ this.defaultNetworkNameInTemplate = checkNotNull(defaultNetworkNameInTemplate, "defaultNetworkNameInTemplate");
+ }
+
+ @Override
+ public NetworkConfig apply(NetworkConfig from) {
+ if (from == null)
+ return new NetworkConfig(defaultNetworkNameInTemplate.apply(template), defaultNetwork, defaultFenceMode);
+ URI network = ifNullDefaultTo(from.getParentNetwork(), defaultNetwork);
+ FenceMode fenceMode = ifNullDefaultTo(from.getFenceMode(), defaultFenceMode);
+ // using conditional statement instead of ifNullDefaultTo so that we lazy invoke the
+ // function, as it is an expensive one.
+ String networkName = from.getNetworkName() != null ? from.getNetworkName() : defaultNetworkNameInTemplate
+ .apply(template);
+ return new NetworkConfig(networkName, network, fenceMode);
+ }
+ }
+
+ protected String generateXml(String name, @Nullable String description, boolean deploy, boolean powerOn,
+ URI template, Iterable<NetworkConfig> networkConfig)
+ throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
+ XMLBuilder rootBuilder = buildRoot(name).a("deploy", deploy + "").a("powerOn", powerOn + "");
+ if (description != null)
+ rootBuilder.e("Description").t(description);
+ XMLBuilder instantiationParamsBuilder = rootBuilder.e("InstantiationParams");
+ addNetworkConfig(instantiationParamsBuilder, networkConfig);
+ rootBuilder.e("Source").a("href", template.toASCIIString());
+ rootBuilder.e("AllEULAsAccepted").t("true");
+
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ return rootBuilder.asString(outputProperties);
+ }
+
+ protected void addNetworkConfig(XMLBuilder instantiationParamsBuilder,
+ Iterable<NetworkConfig> networkConfig) {
+ XMLBuilder networkConfigBuilder = instantiationParamsBuilder.e("NetworkConfigSection");
+ networkConfigBuilder.e("ovf:Info").t("Configuration parameters for logical networks");
+ for (NetworkConfig n : networkConfig) {
+ XMLBuilder configurationBuilder = networkConfigBuilder.e("NetworkConfig").a("networkName", n.getNetworkName())
+ .e("Configuration");
+ configurationBuilder.e("ParentNetwork").a("href", n.getParentNetwork().toASCIIString());
+ if (n.getFenceMode() != null) {
+ configurationBuilder.e("FenceMode").t(n.getFenceMode().toString());
+ }
+ }
+ }
+
+ protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
+ return XMLBuilder.create("InstantiateVAppTemplateParams").a("name", name).a("xmlns", ns)
+ .a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1");
+ }
+
+ protected InstantiateVAppTemplateOptions findOptionsInArgsOrNull(GeneratedHttpRequest gRequest) {
+ for (Object arg : gRequest.getInvocation().getArgs()) {
+ if (arg instanceof InstantiateVAppTemplateOptions) {
+ return (InstantiateVAppTemplateOptions) arg;
+ } else if (arg instanceof InstantiateVAppTemplateOptions[]) {
+ InstantiateVAppTemplateOptions[] options = (InstantiateVAppTemplateOptions[]) arg;
+ return (options.length > 0) ? options[0] : null;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException("InstantiateVAppTemplateParams is needs parameters");
+ }
+
+ public static <T> T ifNullDefaultTo(T value, T defaultValue) {
+ return value != null ? value : checkNotNull(defaultValue, "defaultValue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java
new file mode 100755
index 0000000..778bd6e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java
@@ -0,0 +1,80 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindMemoryToXmlPayload extends BindToStringPayload {
+ protected final String ns;
+ protected final String schema;
+
+ @Inject
+ public BindMemoryToXmlPayload(BindToStringPayload stringBinder, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
+ @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ }
+
+ private static final String RESOURCE_ALLOCATION_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(checkNotNull(payload, "memoryInMB") instanceof Integer, "this binder is only valid for Integers!");
+ Integer memoryInMB = Integer.class.cast(payload);
+ XMLBuilder cpuItem;
+ try {
+ cpuItem = XMLBuilder.create("Item").a("xmlns", ns).a("xmlns:rasd", RESOURCE_ALLOCATION_NS);
+ cpuItem.e("rasd:AllocationUnits").t("byte * 2^20");
+ cpuItem.e("rasd:Description").t("Memory Size");
+ cpuItem.e("rasd:ElementName").t(memoryInMB.toString() + " MB of memory");
+ cpuItem.e("rasd:InstanceID").t("5");
+ cpuItem.e("rasd:Reservation").t("0");
+ cpuItem.e("rasd:ResourceType").t(ResourceType.MEMORY.value());
+ cpuItem.e("rasd:VirtualQuantity").t(memoryInMB.toString());
+ cpuItem.e("rasd:Weight").t("0");
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ request = super.bindToRequest(request, cpuItem.asString(outputProperties));
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java
new file mode 100755
index 0000000..731bbd9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java
@@ -0,0 +1,106 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Properties;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindNetworkConnectionSectionToXmlPayload extends BindToStringPayload {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ protected final String ns;
+ protected final String schema;
+
+ @Inject
+ public BindNetworkConnectionSectionToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(checkNotNull(payload, "NetworkConnectionSection") instanceof NetworkConnectionSection,
+ "this binder is only valid for NetworkConnectionSection!");
+ NetworkConnectionSection net = NetworkConnectionSection.class.cast(payload);
+ XMLBuilder networkConnectionSection;
+ try {
+ networkConnectionSection = XMLBuilder.create("NetworkConnectionSection").a("xmlns", ns)
+ .a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1").a("type", net.getType())
+ .a("href", net.getHref().toASCIIString()).a("ovf:required", "false");
+ networkConnectionSection.e("ovf:Info").t(net.getInfo());
+
+ if (net.getPrimaryNetworkConnectionIndex() != null)
+ networkConnectionSection.e("PrimaryNetworkConnectionIndex").t(
+ net.getPrimaryNetworkConnectionIndex().toString());
+ for (NetworkConnection networkConnection : net.getConnections()) {
+ XMLBuilder networkConnectionSectionChild = networkConnectionSection.e("NetworkConnection").a("network",
+ networkConnection.getNetwork());
+ networkConnectionSectionChild.e("NetworkConnectionIndex").t(
+ networkConnection.getNetworkConnectionIndex() + "");
+ if (networkConnection.getExternalIpAddress() != null)
+ networkConnectionSectionChild.e("ExternalIpAddress").t(networkConnection.getExternalIpAddress());
+ if (networkConnection.getIpAddress() != null)
+ networkConnectionSectionChild.e("IpAddress").t(networkConnection.getIpAddress());
+ networkConnectionSectionChild.e("IsConnected").t(networkConnection.isConnected() + "");
+ if (networkConnection.getMACAddress() != null)
+ networkConnectionSectionChild.e("MACAddress").t(networkConnection.getMACAddress());
+ if (networkConnection.getIpAddressAllocationMode() != null)
+ networkConnectionSectionChild.e("IpAddressAllocationMode").t(
+ networkConnection.getIpAddressAllocationMode().toString());
+ }
+
+ if (net.getEdit() != null)
+ networkConnectionSection.e("Link").a("rel", "edit").a("type", net.getType())
+ .a("href", net.getHref().toASCIIString());
+
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ request = super.bindToRequest(request, networkConnectionSection.asString(outputProperties));
+ request.getPayload().getContentMetadata().setContentType(net.getType());
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java
new file mode 100755
index 0000000..99c0f68
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java
@@ -0,0 +1,81 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindParamsToXmlPayload implements MapBinder {
+
+ protected final String ns;
+ protected final BindToStringPayload stringBinder;
+ protected final String element;
+
+ @Inject
+ public BindParamsToXmlPayload(String element, BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
+ this.element = element;
+ this.ns = ns;
+ this.stringBinder = stringBinder;
+ }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ try {
+ return stringBinder.bindToRequest(request, generateXml(postParams));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private String generateXml(Map<String, Object> postParams) throws ParserConfigurationException,
+ FactoryConfigurationError, TransformerException {
+ XMLBuilder rootBuilder = XMLBuilder.create(element);
+ for (Entry<String, Object> entry : postParams.entrySet())
+ rootBuilder.a(entry.getKey(), (String) entry.getValue());
+ rootBuilder.a("xmlns", ns);
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ return rootBuilder.asString(outputProperties);
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalArgumentException("incorrect usage");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java
new file mode 100755
index 0000000..7f51f68
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java
@@ -0,0 +1,42 @@
+/*
+ * 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.vcloud.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.inject.Inject;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class BindUndeployVAppParamsToXmlPayload extends BindParamsToXmlPayload {
+
+ @Inject
+ public BindUndeployVAppParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
+ super("UndeployVAppParams", stringBinder, ns);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java
new file mode 100755
index 0000000..28c362b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java
@@ -0,0 +1,79 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Catalog;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Iterables;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgNameAndCatalogNameToEndpoint implements MapBinder {
+ private final Supplier<Map<String, Org>> orgMap;
+ private final Supplier<ReferenceType> defaultOrg;
+ private final Supplier<ReferenceType> defaultCatalog;
+
+ @Inject
+ public OrgNameAndCatalogNameToEndpoint(Supplier<Map<String, Org>> orgMap,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg,
+ @Catalog Supplier<ReferenceType> defaultCatalog) {
+ this.orgMap = orgMap;
+ this.defaultOrg = defaultOrg;
+ this.defaultCatalog = defaultCatalog;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object catalog = postParams.get("catalogName");
+ if (org == null && catalog == null)
+ return (R) request.toBuilder().endpoint(defaultCatalog.get().getHref()).build();
+ else if (org == null)
+ org = defaultOrg.get().getName();
+
+ try {
+ Map<String, ReferenceType> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
+ URI endpoint = catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref();
+ return (R) request.toBuilder().endpoint(endpoint).build();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException(org + "/" + catalog + " not found in " + orgMap.get());
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndVDCNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndVDCNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndVDCNameToEndpoint.java
new file mode 100755
index 0000000..fbef2fe
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndVDCNameToEndpoint.java
@@ -0,0 +1,78 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Iterables;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgNameAndVDCNameToEndpoint implements MapBinder {
+ private final Supplier<Map<String, Org>> orgNameToVDCEndpoint;
+ private final Supplier<ReferenceType> defaultOrg;
+ private final Supplier<ReferenceType> defaultVDC;
+
+ @Inject
+ public OrgNameAndVDCNameToEndpoint(Supplier<Map<String, Org>> orgNameToVDCEndpoint,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
+ this.orgNameToVDCEndpoint = orgNameToVDCEndpoint;
+ this.defaultOrg = defaultOrg;
+ this.defaultVDC = defaultVDC;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object vdc = postParams.get("vdcName");
+ if (org == null && vdc == null)
+ return (R) request.toBuilder().endpoint(defaultVDC.get().getHref()).build();
+ else if (org == null)
+ org = defaultOrg.get().getName();
+
+ try {
+ Map<String, ReferenceType> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
+ URI endpoint = vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref();
+ return (R) request.toBuilder().endpoint(endpoint).build();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException(org + "/" + vdc + " not found in " + orgNameToVDCEndpoint.get());
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameItemNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameItemNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameItemNameToEndpoint.java
new file mode 100755
index 0000000..fe842de
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameItemNameToEndpoint.java
@@ -0,0 +1,77 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgNameCatalogNameItemNameToEndpoint implements MapBinder {
+ private final Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> orgCatalogMap;
+ private final Supplier<ReferenceType> defaultOrg;
+ private final Supplier<ReferenceType> defaultCatalog;
+
+ @Inject
+ public OrgNameCatalogNameItemNameToEndpoint(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> orgCatalogMap,
+ @Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
+ this.orgCatalogMap = orgCatalogMap;
+ this.defaultOrg = defaultOrg;
+ this.defaultCatalog = defaultCatalog;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object catalog = postParams.get("catalogName");
+ Object catalogItem = postParams.get("itemName");
+ if (org == null)
+ org = defaultOrg.get().getName();
+ if (catalog == null)
+ catalog = defaultCatalog.get().getName();
+ try {
+ Map<String, org.jclouds.vcloud.domain.Catalog> catalogs = checkNotNull(orgCatalogMap.get().get(org));
+ return (R) request.toBuilder().endpoint(catalogs.get(catalog).get(catalogItem).getHref()).build();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in "
+ + orgCatalogMap.get());
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java
new file mode 100755
index 0000000..6241467
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements MapBinder {
+ private final Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> orgCatalogItemMap;
+ private final Supplier<ReferenceType> defaultOrg;
+ private final Supplier<ReferenceType> defaultCatalog;
+
+ @Inject
+ public OrgNameCatalogNameVAppTemplateNameToEndpoint(
+ Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> orgCatalogItemMap,
+ @Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
+ this.orgCatalogItemMap = orgCatalogItemMap;
+ this.defaultOrg = defaultOrg;
+ this.defaultCatalog = defaultCatalog;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object catalog = postParams.get("catalogName");
+ Object catalogItem = postParams.get("itemName");
+ if (org == null)
+ org = defaultOrg.get().getName();
+ if (catalog == null)
+ catalog = defaultCatalog.get().getName();
+ Map<String, Map<String, Map<String, CatalogItem>>> orgCatalogItemMap = this.orgCatalogItemMap.get();
+
+ if (!orgCatalogItemMap.containsKey(org))
+ throw new NoSuchElementException("org: " + org + " not found in " + orgCatalogItemMap.keySet());
+ Map<String, Map<String, CatalogItem>> catalogs = orgCatalogItemMap.get(org);
+
+ if (!catalogs.containsKey(catalog))
+ throw new NoSuchElementException("catalog: " + org + "/" + catalog + " not found in " + catalogs.keySet());
+ Map<String, CatalogItem> catalogMap = catalogs.get(catalog);
+
+ if (!catalogMap.containsKey(catalogItem))
+ throw new NoSuchElementException("item: " + org + "/" + catalog + "/" + catalogItem + " not found in "
+ + catalogMap.keySet());
+ CatalogItem item = catalogMap.get(catalogItem);
+
+ URI endpoint = checkNotNull(item.getEntity(),
+ "item: " + org + "/" + catalog + "/" + catalogItem + " has no entity").getHref();
+ return (R) request.toBuilder().endpoint(endpoint).build();
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameNetworkNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameNetworkNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameNetworkNameToEndpoint.java
new file mode 100755
index 0000000..3003a77
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameNetworkNameToEndpoint.java
@@ -0,0 +1,54 @@
+/*
+ * 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.vcloud.binders;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgNameVDCNameNetworkNameToEndpoint extends OrgNameVDCNameResourceNameToEndpoint {
+ @Inject
+ public OrgNameVDCNameNetworkNameToEndpoint(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
+ @Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
+ super(orgVDCMap, defaultOrg, defaultVDC);
+ }
+
+ protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
+ org.jclouds.vcloud.domain.VDC vDCObject) {
+ ReferenceType resourceEntity = vDCObject.getAvailableNetworks().get(resource);
+ if (resourceEntity == null)
+ throw new NoSuchElementException("network " + resource + " in vdc " + vDC + ", org " + org + " not found in "
+ + vDCObject.getAvailableNetworks().keySet());
+ return resourceEntity.getHref();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
new file mode 100755
index 0000000..c52e66f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
@@ -0,0 +1,54 @@
+/*
+ * 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.vcloud.binders;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class OrgNameVDCNameResourceEntityNameToEndpoint extends OrgNameVDCNameResourceNameToEndpoint {
+ @Inject
+ public OrgNameVDCNameResourceEntityNameToEndpoint(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
+ @Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
+ super(orgVDCMap, defaultOrg, defaultVDC);
+ }
+
+ protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
+ org.jclouds.vcloud.domain.VDC vDCObject) {
+ ReferenceType resourceEntity = vDCObject.getResourceEntities().get(resource);
+ if (resourceEntity == null)
+ throw new NoSuchElementException("entity " + resource + " in vdc " + vDC + ", org " + org + " not found in "
+ + vDCObject.getResourceEntities().keySet());
+ return resourceEntity.getHref();
+ }
+
+}
[15/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-ubuntu-off-dhcp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-ubuntu-off-dhcp.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-ubuntu-off-dhcp.xml
new file mode 100755
index 0000000..d8406fc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-ubuntu-off-dhcp.xml
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="false" status="8" name="vApp_acole_1" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1
http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/power/action/powerOn"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/deploy"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/controlAccess"/>
+ <Link rel="recompose" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/recomposeVApp"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
+ <Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
+ <Description/>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/leaseSettingsSection/"/>
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Ubuntu1004"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/startupSection/"/>
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="internet01">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkConfigSection/"/>
+ <NetworkConfig networkName="internet01">
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>174.47.101.161</Gateway>
+ <Netmask>255.255.255.224</Netmask>
+ <Dns1>24.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>174.47.101.164</StartAddress>
+ <EndAddress>174.47.101.190</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="internet01" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723"/>
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>174.47.101.162</StartAddress>
+ <EndAddress>174.47.101.163</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="false" status="8" name="Ubuntu1004" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975">
+ <Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/power/action/powerOn"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/action/deploy"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975"/>
+ <Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975"/>
+ <Link rel="screen:thumbnail" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/screen"/>
+ <Link rel="screen:acquireTicket" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/screen/action/acquireTicket"/>
+ <Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/media/action/insertMedia"/>
+ <Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/media/action/ejectMedia"/>
+ <Description/>
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>Ubuntu1004</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:01:f1</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="DHCP">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="30720" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>512 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>512</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
+ </ovf:Item>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/disks"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/disks"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/media"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/networkCards"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/networkCards"/>
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="94" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="ubuntu64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Ubuntu Linux (64-bit)</ovf:Description>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/operatingSystemSection/"/>
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f1</MACAddress>
+ <IpAddressAllocationMode>DHCP</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/networkConnectionSection/"/>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>2093098975</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <AdminPassword>%3eD%gmF</AdminPassword>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>#regenerate keys /bin/rm /etc/ssh/ssh_host_* /usr/sbin/dpkg-reconfigure openssh-server</CustomizationScript>
+ <ComputerName>Ubuntu1004</ComputerName>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/guestCustomizationSection/"/>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>02_ubuntu_template</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-unresolved.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-unresolved.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-unresolved.xml
new file mode 100755
index 0000000..995bc29
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-unresolved.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VApp xmlns="http://www.vmware.com/vcloud/v1" deployed="false"
+ status="0" name="vApp_acole_2" type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
+ <Description />
+ <Tasks>
+ <Task status="running" startTime="2010-08-23T02:09:52.443-04:00"
+ operation="Creating Virtual Application vApp_acole_2(607806320)"
+ expiryTime="2010-11-21T02:09:52.443-05:00" endTime="9999-12-31T23:59:59.999-05:00"
+ type="application/vnd.vmware.vcloud.task+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/task/3cc08ir8oczbze3n1a3">
+ <Owner type="application/vnd.vmware.vcloud.vApp+xml"
+ name="vApp_acole_2"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ </Task>
+ </Tasks>
+</VApp>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-win-off-static.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-win-off-static.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-win-off-static.xml
new file mode 100755
index 0000000..6282766
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-win-off-static.xml
@@ -0,0 +1,219 @@
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="false" status="8" name="vApp_acole_4" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 h
ttp://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/power/action/powerOn"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/deploy"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/controlAccess"/>
+ <Link rel="recompose" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/recomposeVApp"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
+ <Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
+ <Description/>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/leaseSettingsSection/"/>
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Windows2008R2"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/startupSection/"/>
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="internet01">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkConfigSection/"/>
+ <NetworkConfig networkName="internet01">
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>174.47.101.161</Gateway>
+ <Netmask>255.255.255.224</Netmask>
+ <Dns1>24.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>174.47.101.164</StartAddress>
+ <EndAddress>174.47.101.190</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="internet01" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723"/>
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>174.47.101.162</StartAddress>
+ <EndAddress>174.47.101.163</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ <NatRule>
+ <OneToOneVmRule>
+ <MappingMode>automatic</MappingMode>
+ <VAppScopedVmId>04_windows_template</VAppScopedVmId>
+ <VmNicId>0</VmNicId>
+ </OneToOneVmRule>
+ </NatRule>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="false" status="8" name="Windows2008R2" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461">
+ <Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/power/action/powerOn"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/action/deploy"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461"/>
+ <Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461"/>
+ <Link rel="screen:thumbnail" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/screen"/>
+ <Link rel="screen:acquireTicket" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/screen/action/acquireTicket"/>
+ <Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/media/action/insertMedia"/>
+ <Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/media/action/ejectMedia"/>
+ <Description/>
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>Windows2008R2</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:02:33</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="174.47.101.165" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="40960" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>4096 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>4096</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
+ </ovf:Item>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/disks"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/disks"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/media"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/networkCards"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/networkCards"/>
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="102" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="windows7Server64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Microsoft Windows Server 2008 R2 (64-bit)</ovf:Description>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/operatingSystemSection/"/>
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.165</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:02:33</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/networkConnectionSection/"/>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>true</ChangeSid>
+ <VirtualMachineId>904484461</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript/>
+ <ComputerName>Windows2008R2</ComputerName>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/guestCustomizationSection/"/>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>04_windows_template</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-1.0.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-1.0.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-1.0.xml
new file mode 100755
index 0000000..286e42c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-1.0.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Vdc xmlns="http://www.vmware.com/vcloud/v1" status="1" name="Jclouds-Commit-compG1xstorA01" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://
+vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcenterprise.bluelock.com/api/v1.0/org/9566014"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/uploadVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.media+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/media"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/instantiateVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/cloneVApp"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/cloneVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneMediaParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/cloneMedia"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.captureVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/captureVApp"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.composeVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/composeVApp"/>
+ <Link rel="move" type="application/vnd.vmware.vcloud.moveMediaParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/moveMedia"/>
+ <Link rel="move" type="application/vnd.vmware.vcloud.moveVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/moveVApp"/>
+ <Link rel="move" type="application/vnd.vmware.vcloud.moveVAppTemplateParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/moveVAppTemplate"/>
+ <AllocationModel>AllocationPool</AllocationModel>
+ <StorageCapacity>
+ <Units>MB</Units>
+ <Allocated>1024000</Allocated>
+ <Limit>1024000</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </StorageCapacity>
+ <ComputeCapacity>
+ <Cpu>
+ <Units>MHz</Units>
+ <Allocated>20000</Allocated>
+ <Limit>20000</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </Cpu>
+ <Memory>
+ <Units>MB</Units>
+ <Allocated>30720</Allocated>
+ <Limit>30720</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </Memory>
+ </ComputeCapacity>
+ <ResourceEntities/>
+ <AvailableNetworks>
+ <Network type="application/vnd.vmware.vcloud.network+xml" name="isolation01" href="https://vcenterprise.bluelock.com/api/v1.0/network/990419644"/>
+ <Network type="application/vnd.vmware.vcloud.network+xml" name="internet01" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723"/>
+ </AvailableNetworks>
+ <NicQuota>0</NicQuota>
+ <NetworkQuota>100</NetworkQuota>
+ <VmQuota>50</VmQuota>
+ <IsEnabled>true</IsEnabled>
+</Vdc>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-hosting.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-hosting.xml
new file mode 100755
index 0000000..6254112
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-hosting.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Vdc href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"
+ name="vDC Name" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/vdc.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Link rel="add"
+ href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/vApps"
+ type="application/vnd.vmware.vcloud.vApp+xml" />
+ <Link rel="add"
+ href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/vAppTemplates"
+ type="application/vnd.vmware.vcloud.catalogItem+xml" />
+ <Link rel="add"
+ href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/media"
+ type="application/vnd.vmware.vcloud.media+xml" />
+ <Description>vDC Name</Description>
+ <StorageCapacity>
+ <Units>bytes * 10^9</Units>
+ <Allocated>0</Allocated>
+ <Used>40960</Used>
+ </StorageCapacity>
+ <ComputeCapacity>
+ <Cpu>
+ <Units>hz * 10^6</Units>
+ <Allocated>0</Allocated>
+ <Used>2400</Used>
+ </Cpu>
+ <Memory>
+ <Units>bytes * 10^9</Units>
+ <Allocated>0</Allocated>
+ <Used>2</Used>
+ </Memory>
+ <InstantiatedVmsQuota>
+ <Limit>0</Limit>
+ <Used>2</Used>
+ </InstantiatedVmsQuota>
+ <DeployedVmsQuota>
+ <Limit>0</Limit>
+ <Used>2</Used>
+ </DeployedVmsQuota>
+ </ComputeCapacity>
+ <ResourceEntities>
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Plesk (Linux) 64-bit Template" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows 2008 Datacenter 64 Bit Template" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Cent OS 64 Bit Template" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="cPanel (Linux) 64 Bit Template" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="188849-1" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-2"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="188849-2" />
+ </ResourceEntities>
+</Vdc>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-nonet.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-nonet.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-nonet.xml
new file mode 100755
index 0000000..eebf132
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc-nonet.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Vdc href="http://10.150.4.49/api/v0.8/vdc/4" name="DWPCloud"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://10.150.4.49/api/v0.8/schemas/vcloud/vcloud/vdc.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Link rel="add" href="http://10.150.4.49/api/v0.8/vdc/4/vApps"
+ type="application/vnd.vmware.vcloud.vApp+xml" />
+ <Link rel="add" href="http://10.150.4.49/api/v0.8/vdc/4/vAppTemplates"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" />
+ <Link rel="add" href="http://10.150.4.49/api/v0.8/vdc/4/media"
+ type="application/vnd.vmware.vcloud.media+xml" />
+ <Description>Workand Pension Apps</Description>
+ <ResourceEntities>
+ <ResourceEntity href="http://10.150.4.49/api/v0.8/vAppTemplate/1"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ttylinux-4-ESX3" />
+ <ResourceEntity href="http://10.150.4.49/api/v0.8/vAppTemplate/3"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Win2K3" />
+ <ResourceEntity href="http://10.150.4.49/api/v0.8/vApp/7"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="OracleRAC" />
+ <ResourceEntity href="http://10.150.4.49/api/v0.8/vApp/4"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="Oracle" />
+ </ResourceEntities>
+</Vdc>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc.xml
new file mode 100755
index 0000000..d5df92f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc.xml
@@ -0,0 +1,36 @@
+<Vdc href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32" type="application/vnd.vmware.vcloud.vdc+xml" name="Miami Environment 1" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog" type="application/vnd.vmware.vcloud.catalog+xml" name="Miami Environment 1"/>
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/publicIps" type="application/xml" name="Public IPs"/>
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/internetServices" type="application/xml" name="Internet Services"/>
+ <Description/>
+ <StorageCapacity>
+ <Units>bytes * 10^9</Units>
+ <Allocated>100</Allocated>
+ <Used>8</Used>
+ </StorageCapacity>
+ <ComputeCapacity>
+ <Cpu>
+ <Units>hz * 10^6</Units>
+ <Allocated>5000</Allocated>
+ </Cpu>
+ <Memory>
+ <Units>bytes * 2^20</Units>
+ <Allocated>10240</Allocated>
+ </Memory>
+ <InstantiatedVmsQuota>
+ <Limit>-1</Limit>
+ <Used>-1</Used>
+ </InstantiatedVmsQuota>
+ <DeployedVmsQuota>
+ <Limit>-1</Limit>
+ <Used>-1</Used>
+ </DeployedVmsQuota>
+ </ComputeCapacity>
+ <ResourceEntities>
+ <ResourceEntity href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124" type="application/vnd.vmware.vcloud.vApp+xml" name="adriantest"/>
+ <ResourceEntity href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120" type="application/vnd.vmware.vcloud.vApp+xml" name="centos-53"/>
+ </ResourceEntities>
+ <AvailableNetworks>
+ <Network href="https://services.vcloudexpress.terremark.com/api/v0.8/network/1708" type="application/vnd.vmware.vcloud.network+xml" name="10.114.34.128/26"/>
+ </AvailableNetworks>
+</Vdc>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc1.0-vcd15.xml
new file mode 100755
index 0000000..d705891
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vdc1.0-vcd15.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Vdc xmlns="http://www.vmware.com/vcloud/v1" status="1" name="orgVDC-jclouds-Tier1-PAYG" type="application/vnd.vmware.vcloud.vdc+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/uploadVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.media+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/instantiateVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVApp"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneMediaParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.captureVAppParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.composeVAppParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/composeVApp"/>
+ <Description>Pay As You go resources for organization jclouds </Description>
+ <AllocationModel>AllocationVApp</AllocationModel>
+ <StorageCapacity>
+ <Units>MB</Units>
+ <Allocated>0</Allocated>
+ <Limit>0</Limit>
+ <Used>14336</Used>
+ <Overhead>0</Overhead>
+ </StorageCapacity>
+ <ComputeCapacity>
+ <Cpu>
+ <Units>MHz</Units>
+ <Allocated>0</Allocated>
+ <Limit>0</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </Cpu>
+ <Memory>
+ <Units>MB</Units>
+ <Allocated>0</Allocated>
+ <Limit>0</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </Memory>
+ </ComputeCapacity>
+ <ResourceEntities>
+ <ResourceEntity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="UbuntuServer-x64-2GB" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ </ResourceEntities>
+ <AvailableNetworks>
+ <Network type="application/vnd.vmware.vcloud.network+xml" name="orgNet-jclouds-External" href="https://zone.myvcloud.com/api/v1.0/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1"/>
+ </AvailableNetworks>
+ <NicQuota>0</NicQuota>
+ <NetworkQuota>10</NetworkQuota>
+ <VmQuota>10</VmQuota>
+ <IsEnabled>true</IsEnabled>
+</Vdc>
\ No newline at end of file
[45/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/SecurityGroupInZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/SecurityGroupInZone.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/SecurityGroupInZone.java
new file mode 100644
index 0000000..28e2b0f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/SecurityGroupInZone.java
@@ -0,0 +1,46 @@
+/*
+ * 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.openstack.nova.v2_0.domain.zonescoped;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+
+/**
+ * @author Adrian Cole
+ */
+public class SecurityGroupInZone extends ZoneAndName {
+ protected final SecurityGroup securityGroup;
+
+ public SecurityGroupInZone(SecurityGroup securityGroup, String zoneId) {
+ super(zoneId, checkNotNull(securityGroup, "securityGroup").getName());
+ this.securityGroup = securityGroup;
+ }
+
+ public SecurityGroup getSecurityGroup() {
+ return securityGroup;
+ }
+
+ // superclass hashCode/equals are good enough, and help us use ZoneAndName and ServerInZone
+ // interchangeably as Map keys
+
+ @Override
+ public String toString() {
+ return "[securityGroup=" + securityGroup + ", zoneId=" + zoneId + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ServerInZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ServerInZone.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ServerInZone.java
new file mode 100644
index 0000000..2249cf7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ServerInZone.java
@@ -0,0 +1,46 @@
+/*
+ * 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.openstack.nova.v2_0.domain.zonescoped;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+
+/**
+ * @author Adrian Cole
+ */
+public class ServerInZone extends ZoneAndId {
+ protected final Server server;
+
+ public ServerInZone(Server server, String zoneId) {
+ super(zoneId, checkNotNull(server, "server").getId());
+ this.server = server;
+ }
+
+ public Server getServer() {
+ return server;
+ }
+
+ // superclass hashCode/equals are good enough, and help us use ZoneAndId and ServerInZone
+ // interchangeably as Map keys
+
+ @Override
+ public String toString() {
+ return "[server=" + server + ", zoneId=" + zoneId + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndId.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndId.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndId.java
new file mode 100644
index 0000000..6c6f0c6
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndId.java
@@ -0,0 +1,86 @@
+/*
+ * 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.openstack.nova.v2_0.domain.zonescoped;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Adam Lowe
+ */
+public class ZoneAndId {
+ public static ZoneAndId fromSlashEncoded(String id) {
+ Iterable<String> parts = Splitter.on('/').split(checkNotNull(id, "id"));
+ checkArgument(Iterables.size(parts) == 2, "id must be in format zoneId/id");
+ return new ZoneAndId(Iterables.get(parts, 0), Iterables.get(parts, 1));
+ }
+
+ public static ZoneAndId fromZoneAndId(String zoneId, String id) {
+ return new ZoneAndId(zoneId, id);
+ }
+
+ private static String slashEncodeZoneAndId(String zoneId, String id) {
+ return checkNotNull(zoneId, "zoneId") + "/" + checkNotNull(id, "id");
+ }
+
+ public String slashEncode() {
+ return slashEncodeZoneAndId(zoneId, id);
+ }
+
+ protected final String zoneId;
+ protected final String id;
+
+ protected ZoneAndId(String zoneId, String id) {
+ this.zoneId = checkNotNull(zoneId, "zoneId");
+ this.id = checkNotNull(id, "id");
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(zoneId, id);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ZoneAndId other = (ZoneAndId) obj;
+ return Objects.equal(zoneId, other.zoneId) && Objects.equal(id, other.id);
+ }
+
+ public String getZone() {
+ return zoneId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ return "[zoneId=" + zoneId + ", id=" + id + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndName.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndName.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndName.java
new file mode 100644
index 0000000..fdb49e1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndName.java
@@ -0,0 +1,111 @@
+/*
+ * 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.openstack.nova.v2_0.domain.zonescoped;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Splitter;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+
+/**
+ * Helpful when looking for resources by zone and name
+ *
+ * @author Adrian Cole
+ */
+public class ZoneAndName {
+
+ public static final Function<ZoneAndName, String> NAME_FUNCTION = new Function<ZoneAndName, String>() {
+
+ @Override
+ public String apply(ZoneAndName input) {
+ return input.getName();
+ }
+
+ };
+
+ public static final Function<ZoneAndName, String> ZONE_FUNCTION = new Function<ZoneAndName, String>() {
+
+ @Override
+ public String apply(ZoneAndName input) {
+ return input.getZone();
+ }
+
+ };
+
+ public static ZoneAndName fromSlashEncoded(String name) {
+ Iterable<String> parts = Splitter.on('/').split(checkNotNull(name, "name"));
+ checkArgument(Iterables.size(parts) == 2, "name must be in format zoneId/name");
+ return new ZoneAndName(Iterables.get(parts, 0), Iterables.get(parts, 1));
+ }
+
+ public static ZoneAndName fromZoneAndName(String zoneId, String name) {
+ return new ZoneAndName(zoneId, name);
+ }
+
+ private static String slashEncodeZoneAndName(String zoneId, String name) {
+ return checkNotNull(zoneId, "zoneId") + "/" + checkNotNull(name, "name");
+ }
+
+ public String slashEncode() {
+ return slashEncodeZoneAndName(zoneId, name);
+ }
+
+ protected final String zoneId;
+ protected final String name;
+
+ protected ZoneAndName(String zoneId, String name) {
+ this.zoneId = checkNotNull(zoneId, "zoneId");
+ this.name = checkNotNull(name, "name");
+ }
+
+ public String getZone() {
+ return zoneId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ZoneAndName that = ZoneAndName.class.cast(o);
+ return equal(this.zoneId, that.zoneId) && equal(this.name, that.name);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(zoneId, name);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper("").add("zoneId", zoneId).add("name", name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneSecurityGroupNameAndPorts.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneSecurityGroupNameAndPorts.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneSecurityGroupNameAndPorts.java
new file mode 100644
index 0000000..4182d91
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneSecurityGroupNameAndPorts.java
@@ -0,0 +1,62 @@
+/*
+ * 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.openstack.nova.v2_0.domain.zonescoped;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Set;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Adrian Cole
+ */
+public class ZoneSecurityGroupNameAndPorts extends ZoneAndName {
+ protected final Set<Integer> ports;
+
+ public ZoneSecurityGroupNameAndPorts(String zoneId, String name, Iterable<Integer> ports) {
+ super(zoneId, name);
+ this.ports = ImmutableSet.<Integer> copyOf(checkNotNull(ports, "ports"));
+ }
+
+ public Set<Integer> getPorts() {
+ return ports;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ZoneSecurityGroupNameAndPorts that = ZoneSecurityGroupNameAndPorts.class.cast(o);
+ return super.equals(that) && equal(this.ports, that.ports);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), ports);
+ }
+
+ @Override
+ public ToStringHelper string() {
+ return super.string().add("ports", ports);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
new file mode 100644
index 0000000..c786095
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.domain.zonescoped;
+
+import com.google.common.base.Objects;
+
+/**
+ * @author Inbar Stolberg
+ */
+public class ZoneState {
+
+ private final boolean available;
+
+ protected ZoneState(boolean available) {
+ this.available = available;
+ }
+
+ public boolean available() {
+ return this.available;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(available);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this != obj) return false;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ZoneState that = ZoneState.class.cast(obj);
+ return Objects.equal(this.available, that.available);
+ }
+
+ protected Objects.ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("available", available);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
new file mode 100644
index 0000000..d248681
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.extensions;
+
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+/**
+ * @author Inbar Stolberg
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
+public interface AvailabilityZoneAPI {
+
+ /**
+ * @return all availability zones
+ */
+ FluentIterable<? extends AvailabilityZone> list();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
new file mode 100644
index 0000000..d85f305
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.extensions;
+
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.jclouds.Fallbacks;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author Inbar Stolberg
+ */
+
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
+@RequestFilters(AuthenticateRequest.class)
+public interface AvailabilityZoneAsyncApi {
+
+ /**
+ * @return all availability zones
+ */
+ @GET
+ @Path("/os-availability-zone")
+ @SelectJson("availabilityZoneInfo")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends AvailabilityZone>> list();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
new file mode 100644
index 0000000..a249190
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
@@ -0,0 +1,110 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+/**
+ * Extension namespaces
+ *
+ * @author Adrian Cole
+ * @see <a href= "http://nova.openstack.org/api_ext/" />
+ */
+public interface ExtensionNamespaces {
+ /**
+ * Keypair Support
+ */
+ public static final String KEYPAIRS = "http://docs.openstack.org/ext/keypairs/api/v1.1";
+ /**
+ * Volumes support
+ */
+ public static final String VOLUMES = "http://docs.openstack.org/ext/volumes/api/v1.1";
+ /**
+ * Volume types support
+ */
+ public static final String VOLUME_TYPES = "http://docs.openstack.org/ext/volume_types/api/v1.1";
+ /**
+ * Security group support
+ */
+ public static final String SECURITY_GROUPS = "http://docs.openstack.org/ext/securitygroups/api/v1.1";
+ /**
+ * Floating IPs support
+ */
+ public static final String FLOATING_IPS = "http://docs.openstack.org/ext/floating_ips/api/v1.1";
+ /**
+ * Multiple network support
+ */
+ public static final String MULTINIC = "http://docs.openstack.org/ext/multinic/api/v1.1";
+ /**
+ * Host administration
+ */
+ public static final String HOSTS = "http://docs.openstack.org/ext/hosts/api/v1.1";
+ /**
+ * Quotas management support
+ */
+ public static final String QUOTAS = "http://docs.openstack.org/ext/quotas-sets/api/v1.1";
+ /**
+ * Instance type (flavor) extra specs
+ */
+ public static final String FLAVOR_EXTRA_SPECS = "http://docs.openstack.org/ext/flavor_extra_specs/api/v1.1";
+ /**
+ * Provide additional data for flavors
+ */
+ public static final String FLAVOR_EXTRA_DATA = "http://docs.openstack.org/ext/flavor_extra_data/api/v1.1";
+ /**
+ * Virtual interface support
+ */
+ public static final String VIRTUAL_INTERFACES = "http://docs.openstack.org/ext/virtual_interfaces/api/v1.1";
+ /**
+ * Extended support to the Create Server v1.1 API
+ */
+ public static final String CREATESERVEREXT = "http://docs.openstack.org/ext/createserverext/api/v1.1";
+ /**
+ * Virtual Storage Arrays support
+ */
+ public static final String VSA = "http://docs.openstack.org/ext/vsa/api/v1.1";
+ /**
+ * Simple tenant usage extension
+ */
+ public static final String SIMPLE_TENANT_USAGE = "http://docs.openstack.org/ext/os-simple-tenant-usage/api/v1.1";
+ /**
+ * Instance rescue mode
+ */
+ public static final String RESCUE = "http://docs.openstack.org/ext/rescue/api/v1.1";
+ /**
+ * Admin Action extension
+ */
+ public static final String ADMIN_ACTIONS = "http://docs.openstack.org/ext/admin-actions/api/v1.1";
+
+ /**
+ * Extended Server Status extension
+ */
+ public static final String EXTENDED_STATUS = "http://docs.openstack.org/compute/ext/extended_status/api/v1.1";
+
+ /**
+ * Quota Classes extension
+ */
+ public static final String QUOTA_CLASSES = "http://docs.openstack.org/ext/quota-classes-sets/api/v1.1";
+
+ /**
+ * Disk Config extension
+ */
+ public static final String DISK_CONFIG = "http://docs.openstack.org/compute/ext/disk_config/api/v1.1";
+
+ /**
+ * Aggregates extension
+ */
+ public static final String AGGREGATES = "http://docs.openstack.org/ext/aggregates/api/v1.1";
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApi.java
new file mode 100644
index 0000000..946463c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApi.java
@@ -0,0 +1,77 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import java.util.Map;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Provide access to extra metadata for Nova flavors.
+ *
+ * @author Adam Lowe
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.flavorextraspecs.html"/>
+ * @see org.jclouds.openstack.nova.v2_0.features.FlavorApi
+ * @see org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLAVOR_EXTRA_SPECS)
+public interface FlavorExtraSpecsApi {
+
+ /**
+ * Retrieve all extra specs for a flavor
+ *
+ * @return the set of extra metadata for the flavor
+ */
+ Map<String, String> getMetadata(String flavorId);
+
+ /**
+ * Creates or updates the extra specs for a given flavor
+ *
+ * @param flavorId the id of the flavor to modify
+ * @param specs the extra specs to apply
+ */
+ Boolean updateMetadata(String flavorId, Map<String, String> specs);
+
+ /**
+ * Return a single extra spec value
+ *
+ * @param flavorId the id of the flavor to modify
+ * @param key the extra spec key to retrieve
+ */
+ String getMetadataKey(String flavorId, String key);
+
+ /**
+ * Creates or updates a single extra spec value
+ *
+ * @param flavorId the id of the flavor to modify
+ * @param key the extra spec key (when creating ensure this does not include whitespace or other difficult characters)
+ * @param value the value to associate with the key
+ */
+ Boolean updateMetadataEntry(String flavorId, String key, String value);
+
+ /**
+ * Deletes an extra spec
+ *
+ * @param flavorId the id of the flavor to modify
+ * @param key the extra spec key to delete
+ */
+ Boolean deleteMetadataKey(String flavorId, String key);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsAsyncApi.java
new file mode 100644
index 0000000..f788e6e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsAsyncApi.java
@@ -0,0 +1,118 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Unwrap;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.annotations.Beta;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provide access to extra metadata for Nova flavors.
+ *
+ * @author Adam Lowe
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.flavorextraspecs.html"/>
+ * @see org.jclouds.openstack.nova.v2_0.features.FlavorApi
+ * @see FlavorExtraSpecsApi
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLAVOR_EXTRA_SPECS)
+@RequestFilters(AuthenticateRequest.class)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface FlavorExtraSpecsAsyncApi {
+
+ /**
+ * @see FlavorExtraSpecsApi#getMetadata(String)
+ */
+ @Named("flavor:getmetadata")
+ @GET
+ @SelectJson("extra_specs")
+ @Path("/flavors/{flavor_id}/os-extra_specs")
+ @Fallback(EmptyMapOnNotFoundOr404.class)
+ ListenableFuture<Map<String, String>> getMetadata(@PathParam("flavor_id") String flavorId);
+
+ /**
+ * @see FlavorExtraSpecsApi#updateMetadataEntry(String, String, String)
+ */
+ @Named("flavor:updatemetadata")
+ @POST
+ @Path("/flavors/{flavor_id}/os-extra_specs")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ ListenableFuture<Boolean> updateMetadata(@PathParam("flavor_id") String flavorId, @PayloadParam("extra_specs") Map<String, String> specs);
+
+ /**
+ * @see FlavorExtraSpecsApi#getMetadataKey(String, String)
+ */
+ @Named("flavor:getmetadata")
+ @GET
+ @Path("/flavors/{flavor_id}/os-extra_specs/{key}")
+ @Unwrap
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<String> getMetadataKey(@PathParam("flavor_id") String flavorId, @PathParam("key") String key);
+
+ /**
+ * @see FlavorExtraSpecsApi#updateMetadataEntry(String, String, String)
+ */
+ @Named("flavor:updatemetadata")
+ @PUT
+ @Path("/flavors/{flavor_id}/os-extra_specs/{key}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Payload("%7B\"{key}\":\"{value}\"%7D")
+ ListenableFuture<Boolean> updateMetadataEntry(@PathParam("flavor_id") String flavorId,
+ @PathParam("key") @PayloadParam("key") String key,
+ @PayloadParam("value") String value);
+
+ /**
+ * @see FlavorExtraSpecsApi#deleteMetadataKey(String, String)
+ */
+ @Named("flavor:deletemetadata")
+ @DELETE
+ @Path("/flavors/{flavor_id}/os-extra_specs/{key}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> deleteMetadataKey(@PathParam("flavor_id") String flavorId,
+ @PathParam("key") String key);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java
new file mode 100644
index 0000000..ddf720f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java
@@ -0,0 +1,98 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides synchronous access to Floating IPs.
+ * <p/>
+ *
+ * @see FloatingIPAsyncApi
+ * @author Jeremy Daggett
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLOATING_IPS)
+public interface FloatingIPApi {
+
+ /**
+ * List all Floating IP addresses
+ *
+ * @return all Floating IPs
+ */
+ FluentIterable<? extends FloatingIP> list();
+
+ /**
+ * Get a specific Floating IP address
+ *
+ * @return all Floating IPs
+ */
+ FloatingIP get(String id);
+
+ /**
+ * Allocate a Floating IP address
+ *
+ * @return a newly created FloatingIP
+ */
+ FloatingIP create();
+
+ /**
+ * Allocate a Floating IP address from a pool
+ *
+ * @param pool
+ * Pool to allocate IP address from
+ * @return a newly created FloatingIP
+ */
+ FloatingIP allocateFromPool(String pool);
+
+ /**
+ * Decreate a Floating IP address
+ *
+ * @param id
+ * the Floating IP id
+ */
+ void delete(String id);
+
+ /**
+ * Add a Floating IP address to a Server
+ *
+ * @param serverId
+ * the serverId
+ * @param address
+ * the IP address to add
+ *
+ * NOTE: Possibly move this to ServerApi?
+ */
+ void addToServer(String address, String serverId);
+
+ /**
+ * Remove a Floating IP address from a Server
+ *
+ * @param serverId
+ * the serverId
+ * @param address
+ * the IP address to remove
+ *
+ * NOTE: Possibly move this to ServerApi?
+ */
+ void removeFromServer(String address, String serverId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java
new file mode 100644
index 0000000..f6cc543
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java
@@ -0,0 +1,145 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Floating IPs via the REST API.
+ * <p/>
+ *
+ * @see FloatingIPApi
+ * @author Jeremy Daggett
+ * @see ExtensionAsyncApi
+ * @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
+ * />
+ * @see <a href="http://nova.openstack.org/api_ext" />
+ * @see <a href="http://wiki.openstack.org/os_api_floating_ip"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLOATING_IPS)
+@RequestFilters(AuthenticateRequest.class)
+public interface FloatingIPAsyncApi {
+
+ /**
+ * @see FloatingIPApi#list
+ */
+ @Named("floatingip:list")
+ @GET
+ @Path("/os-floating-ips")
+ @SelectJson("floating_ips")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends FloatingIP>> list();
+
+ /**
+ * @see FloatingIPApi#get
+ */
+ @Named("floatingip:get")
+ @GET
+ @Path("/os-floating-ips/{id}")
+ @SelectJson("floating_ip")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends FloatingIP> get(@PathParam("id") String id);
+
+ /**
+ * @see FloatingIPApi#create
+ */
+ @Named("floatingip:create")
+ @POST
+ @Path("/os-floating-ips")
+ @SelectJson("floating_ip")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Payload("{}")
+ ListenableFuture<? extends FloatingIP> create();
+
+ /**
+ * @see org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi#allocateFromPool
+ */
+ @Named("floatingip:create")
+ @POST
+ @Path("/os-floating-ips")
+ @SelectJson("floating_ip")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Payload("%7B\"pool\":\"{pool}\"%7D")
+ ListenableFuture<? extends FloatingIP> allocateFromPool(@PayloadParam("pool") String pool);
+
+
+ /**
+ * @see FloatingIPApi#delete
+ */
+ @Named("floatingip:delete")
+ @DELETE
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Path("/os-floating-ips/{id}")
+ ListenableFuture<Void> delete(@PathParam("id") String id);
+
+ /**
+ * @see FloatingIPApi#addToServer
+ */
+ @Named("floatingip:add")
+ @POST
+ @Path("/servers/{server}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"addFloatingIp\":%7B\"address\":\"{address}\"%7D%7D")
+ ListenableFuture<Void> addToServer(@PayloadParam("address") String address,
+ @PathParam("server") String serverId);
+
+ /**
+ * @see FloatingIPApi#removeFromServer
+ */
+ @Named("floatingip:remove")
+ @POST
+ @Path("/servers/{server}/action")
+ @Consumes
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"removeFloatingIp\":%7B\"address\":\"{address}\"%7D%7D")
+ ListenableFuture<Void> removeFromServer(@PayloadParam("address") String address,
+ @PathParam("server") String serverId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java
new file mode 100644
index 0000000..95b8f42
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.Host;
+import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides asynchronous access to Host Administration features via the REST API.
+ * <p/>
+ *
+ * @author Adam Lowe
+ * @see HostAdministrationAsyncApi
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.HOSTS)
+public interface HostAdministrationApi {
+
+ /**
+ * Returns the list of hosts
+ *
+ * @return the usage information
+ */
+ FluentIterable<? extends Host> list();
+
+ /**
+ * Retrieves the physical/usage resource on a specific host
+ *
+ * @return the usage information
+ */
+ FluentIterable<? extends HostResourceUsage> listResourceUsage(String hostId);
+
+ /**
+ * Allow the specified host to accept new instances.
+ *
+ * @return true if successful
+ */
+ boolean enable(String hostId);
+
+ /**
+ * Prevent the specified host from accepting new instances.
+ *
+ * @return true if successful
+ */
+ boolean disable(String hostId);
+
+ /**
+ * Start host maintenance window.
+ * <p/>
+ * Note: this triggers guest VMs evacuation.
+ *
+ * @return true if successful
+ */
+ boolean startMaintenance(String hostId);
+
+ /**
+ * Stop host maintenance window.
+ *
+ * @return true if successful
+ */
+ boolean stopMaintenance(String hostId);
+
+ /**
+ * Startup a host.
+ *
+ * @return true if successful
+ */
+ boolean startup(String hostId);
+
+ /**
+ * Shutdown a host.
+ *
+ * @return true if successful
+ */
+ boolean shutdown(String hostId);
+
+ /**
+ * Reboot a host.
+ *
+ * @return true if successful
+ */
+ boolean reboot(String hostId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java
new file mode 100644
index 0000000..cf066c2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.Host;
+import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
+import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.MaintenanceModeDisabledResponseParser;
+import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.MaintenanceModeEnabledResponseParser;
+import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.PowerIsRebootResponseParser;
+import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.PowerIsShutdownResponseParser;
+import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.PowerIsStartupResponseParser;
+import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.StatusDisabledResponseParser;
+import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.StatusEnabledResponseParser;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Host Administration features via the REST API.
+ * <p/>
+ *
+ * @author Adam Lowe
+ * @see HostAdministrationApi
+ * @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"/>
+ * @see <a href="http://nova.openstack.org/api_ext" />
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.hosts.html" />
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.HOSTS)
+@RequestFilters(AuthenticateRequest.class)
+@Path("/os-hosts")
+@Consumes(MediaType.APPLICATION_JSON)
+public interface HostAdministrationAsyncApi {
+
+ /**
+ * @see HostAdministrationApi#list()
+ */
+ @Named("hostadmin:list")
+ @GET
+ @SelectJson("hosts")
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends Host>> list();
+
+ /**
+ * @see HostAdministrationApi#listResourceUsage(String)
+ */
+ @Named("hostadmin:listresource")
+ @GET
+ @Path("/{id}")
+ @SelectJson("host")
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends HostResourceUsage>> listResourceUsage(@PathParam("id") String hostId);
+
+ /**
+ * @see HostAdministrationApi#enable(String)
+ */
+ @Named("hostadmin:enable")
+ @PUT
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/{id}")
+ @Payload("{\"status\":\"enable\"}")
+ @ResponseParser(StatusEnabledResponseParser.class)
+ ListenableFuture<Boolean> enable(@PathParam("id") String hostId);
+
+ /**
+ * @see HostAdministrationApi#disable(String)
+ */
+ @Named("hostadmin:disable")
+ @PUT
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/{id}")
+ @Payload("{\"status\":\"disable\"}")
+ @ResponseParser(StatusDisabledResponseParser.class)
+ ListenableFuture<Boolean> disable(@PathParam("id") String hostId);
+
+ /**
+ * @see HostAdministrationApi#startMaintenance(String)
+ */
+ @Named("hostadmin:startmaintenance")
+ @PUT
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/{id}")
+ @Payload("{\"maintenance_mode\":\"enable\"}")
+ @ResponseParser(MaintenanceModeEnabledResponseParser.class)
+ ListenableFuture<Boolean> startMaintenance(@PathParam("id") String hostId);
+
+ /**
+ * @see HostAdministrationApi#stopMaintenance(String)
+ */
+ @Named("hostadmin:stopmaintenance")
+ @PUT
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/{id}")
+ @Payload("{\"maintenance_mode\":\"disable\"}")
+ @ResponseParser(MaintenanceModeDisabledResponseParser.class)
+ ListenableFuture<Boolean> stopMaintenance(@PathParam("id") String hostId);
+
+ /**
+ * @see HostAdministrationApi#startup(String)
+ */
+ @Named("hostadmin:startup")
+ @GET
+ @Path("/{id}/startup")
+ @ResponseParser(PowerIsStartupResponseParser.class)
+ ListenableFuture<Boolean> startup(@PathParam("id") String hostId);
+
+ /**
+ * @see HostAdministrationApi#shutdown(String)
+ */
+ @Named("hostadmin:shutdown")
+ @GET
+ @Path("/{id}/shutdown")
+ @ResponseParser(PowerIsShutdownResponseParser.class)
+ ListenableFuture<Boolean> shutdown(@PathParam("id") String hostId);
+
+ /**
+ * @see HostAdministrationApi#reboot(String)
+ */
+ @Named("hostadmin:reboot")
+ @GET
+ @Path("/{id}/reboot")
+ @ResponseParser(PowerIsRebootResponseParser.class)
+ ListenableFuture<Boolean> reboot(@PathParam("id") String hostId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java
new file mode 100644
index 0000000..a6461aa
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.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.openstack.nova.v2_0.extensions;
+
+import java.util.Map;
+import org.jclouds.openstack.nova.v2_0.domain.HostAggregate;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provide access to Host Aggregates in Nova (alias "OS-AGGREGATES")
+ *
+ * @author Adam Lowe
+ * @see HostAggregateAsyncApi
+ * @see <a href="http://nova.openstack.org/api_ext/ext_aggregates.html"/>
+ * @see <a href="http://wiki.openstack.org/host-aggregates"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.AGGREGATES)
+public interface HostAggregateApi {
+
+ /**
+ * @return the set of host aggregates.
+ */
+ FluentIterable<? extends HostAggregate> list();
+
+ /**
+ * Retrieves the details of an aggregate, hosts and metadata included.
+ *
+ * @return the details of the aggregate requested.
+ */
+ HostAggregate get(String id);
+
+ /**
+ * Creates an aggregate, given its name and availability zone.
+ *
+ * @return the newly created Aggregate
+ */
+ HostAggregate createInAvailabilityZone(String name, String availabilityZone);
+
+ /**
+ * Updates the name of an aggregate.
+ */
+ HostAggregate updateName(String id, String name);
+
+ /**
+ * Updates the availability zone an aggregate.
+ */
+ HostAggregate updateAvailabilityZone(String id, String availabilityZone);
+
+ /**
+ * Removes an aggregate.
+ */
+ Boolean delete(String id);
+
+ /**
+ * Adds a host to an aggregate
+ */
+ HostAggregate addHost(String id, String host);
+
+ /**
+ * Removes a host from an aggregate
+ */
+ HostAggregate removeHost(String id, String host);
+
+ /**
+ * Adds metadata to an aggregate
+ */
+ HostAggregate setMetadata(String id, Map<String, String> metadata);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java
new file mode 100644
index 0000000..1ee3dc7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java
@@ -0,0 +1,161 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.HostAggregate;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.WrapWith;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provide access to Aggregates in Nova.
+ *
+ * @author Adam Lowe
+ * @see HostAggregateApi
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.AGGREGATES)
+@RequestFilters(AuthenticateRequest.class)
+@Path("/os-aggregates")
+public interface HostAggregateAsyncApi {
+
+ /**
+ * @see HostAggregateApi#list()
+ */
+ @Named("hostaggregate:list")
+ @GET
+ @SelectJson("aggregates")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends HostAggregate>> list();
+
+ /**
+ * @see HostAggregateApi#get(String)
+ */
+ @Named("hostaggregate:get")
+ @GET
+ @Path("/{id}")
+ @SelectJson("aggregate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends HostAggregate> get(@PathParam("id") String id);
+
+ /**
+ * @see HostAggregateApi#createInAvailabilityZone(String, String)
+ */
+ @Named("hostaggregate:create")
+ @POST
+ @SelectJson("aggregate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @WrapWith("aggregate")
+ ListenableFuture<? extends HostAggregate> createInAvailabilityZone(@PayloadParam("name") String name,
+ @PayloadParam("availability_zone") String availabilityZone);
+
+ /**
+ * @see HostAggregateApi#updateName
+ */
+ @Named("hostaggregate:update")
+ @POST
+ @Path("/{id}")
+ @SelectJson("aggregate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @WrapWith("aggregate")
+ ListenableFuture<? extends HostAggregate> updateName(@PathParam("id") String id, @PayloadParam("name") String name);
+
+ /**
+ * @see HostAggregateApi#updateAvailabilityZone
+ */
+ @Named("hostaggregate:update")
+ @POST
+ @Path("/{id}")
+ @SelectJson("aggregate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @WrapWith("aggregate")
+ ListenableFuture<? extends HostAggregate> updateAvailabilityZone(@PathParam("id") String id, @PayloadParam("availability_zone") String availabilityZone);
+
+ /**
+ * @see HostAggregateApi#delete(String)
+ */
+ @Named("hostaggregate:delete")
+ @DELETE
+ @Path("/{id}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> delete(@PathParam("id") String id);
+
+ /**
+ * @see HostAggregateApi#addHost(String,String)
+ */
+ @Named("hostaggregate:addhost")
+ @POST
+ @Path("/{id}/action")
+ @SelectJson("aggregate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @WrapWith("add_host")
+ ListenableFuture<? extends HostAggregate> addHost(@PathParam("id") String id, @PayloadParam("host") String host);
+
+
+ /**
+ * @see HostAggregateApi#removeHost(String,String)
+ */
+ @Named("hostaggregate:removehost")
+ @POST
+ @Path("/{id}/action")
+ @SelectJson("aggregate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @WrapWith("remove_host")
+ ListenableFuture<? extends HostAggregate> removeHost(@PathParam("id") String id, @PayloadParam("host") String host);
+
+ /**
+ * @see HostAggregateApi#setMetadata
+ */
+ @Named("hostaggregate:setmetadata")
+ @POST
+ @Path("/{id}/action")
+ @SelectJson("aggregate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @WrapWith("set_metadata")
+ ListenableFuture<? extends HostAggregate> setMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map<String, String> metadata);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java
new file mode 100644
index 0000000..6b4af7b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides synchronous access to Security Groups.
+ * <p/>
+ *
+ * @see KeyPairAsyncApi
+ * @author Jeremy Daggett
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.KEYPAIRS)
+public interface KeyPairApi {
+
+ /**
+ * List all Key Pairs.
+ *
+ * @return all Key Pairs
+ */
+ FluentIterable<? extends KeyPair> list();
+
+ /**
+ * Create a Key Pair.
+ *
+ * @return a Key Pair
+ */
+ KeyPair create(String name);
+
+ /**
+ * Create a Key Pair with a public key.
+ *
+ * @return a Key Pair with a public key.
+ */
+ KeyPair createWithPublicKey(String name, String publicKey);
+
+ /**
+ * Delete a Key Pairs.
+ *
+ * @return
+ */
+ boolean delete(String name);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java
new file mode 100644
index 0000000..246aec8
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java
@@ -0,0 +1,101 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.binders.BindKeyPairToJsonPayload;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseKeyPairs;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Key Pairs via the REST API.
+ * <p/>
+ *
+ * @see KeyPairApi
+ * @author Jeremy Daggett
+ * @see ExtensionAsyncApi
+ * @see <a href=
+ * "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
+ * />
+ * @see <a href="http://nova.openstack.org/api_ext" />
+ * @see <a href="http://nova.openstack.org/api_ext/ext_keypairs.html" />
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.KEYPAIRS)
+@RequestFilters(AuthenticateRequest.class)
+public interface KeyPairAsyncApi {
+
+ @Named("keypair:list")
+ @GET
+ @Path("/os-keypairs")
+ @ResponseParser(ParseKeyPairs.class)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends KeyPair>> list();
+
+ @Named("keypair:create")
+ @POST
+ @Path("/os-keypairs")
+ @SelectJson("keypair")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"keypair\":%7B\"name\":\"{name}\"%7D%7D")
+ ListenableFuture<? extends KeyPair> create(@PayloadParam("name") String name);
+
+ @Named("keypair:create")
+ @POST
+ @Path("/os-keypairs")
+ @SelectJson("keypair")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @MapBinder(BindKeyPairToJsonPayload.class)
+ ListenableFuture<? extends KeyPair> createWithPublicKey(@PayloadParam("name") String name,
+ @PayloadParam("public_key") String publicKey);
+
+ @Named("keypair:delete")
+ @DELETE
+ @Path("/os-keypairs/{name}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Consumes
+ ListenableFuture<Boolean> delete(@PathParam("name") String name);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApi.java
new file mode 100644
index 0000000..ea59d0f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApi.java
@@ -0,0 +1,57 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.Quota;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * The quotas extension enables limiters placed on the resources used per tenant (project) for virtual instances. It is
+ * used with the OpenStack Compute API 1.1 for administrators who need to control the amount of volumes, memory, floating
+ * IP addresses, instances, or cores allowed within a defined tenant or project.
+ * <p/>
+ * To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas.
+ *
+ * @author Adam Lowe
+ * @see QuotaAsyncApi
+ * @see <a href="http://nova.openstack.org/api_ext/ext_quotas.html"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTAS)
+public interface QuotaApi {
+
+ /**
+ * @return the quota settings for the tenant
+ */
+ Quota getByTenant(String tenantId);
+
+ /**
+ * Update the quotas for a given tenant
+ *
+ * @return true if successful
+ */
+ boolean updateQuotaOfTenant(Quota quota, String tenantId);
+
+ /**
+ * @return the set of default quotas for the tenant
+ */
+ Quota getDefaultsForTenant(String tenantId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java
new file mode 100644
index 0000000..b364fcb
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java
@@ -0,0 +1,89 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.Quota;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.annotations.Beta;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provide access to Quota information for Nova tenants.
+ *
+ * @author Adam Lowe
+ * @see QuotaApi
+ * @see <a href="http://nova.openstack.org/api_ext/ext_quotas.html"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTAS)
+@RequestFilters(AuthenticateRequest.class)
+@Path("/os-quota-sets")
+public interface QuotaAsyncApi {
+
+ /**
+ * @see QuotaApi#getDefaultsForTenant(String)
+ */
+ @Named("quota:get")
+ @GET
+ @SelectJson("quota_set")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/{tenant_id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends Quota> getByTenant(@PathParam("tenant_id") String tenantId);
+
+ /**
+ * @see QuotaApi#updateQuotaOfTenant
+ */
+ @Named("quota:update")
+ @PUT
+ @Path("/{tenant_id}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @MapBinder(BindToJsonPayload.class)
+ ListenableFuture<Boolean> updateQuotaOfTenant(@PayloadParam("quota_set") Quota quota,
+ @PathParam("tenant_id") String tenantId);
+
+ /**
+ * @see QuotaApi#getDefaultsForTenant(String)
+ */
+ @Named("quota:get")
+ @GET
+ @SelectJson("quota_set")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/{tenant_id}/defaults")
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends Quota> getDefaultsForTenant(@PathParam("tenant_id") String tenantId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java
new file mode 100644
index 0000000..4a6c010
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java
@@ -0,0 +1,51 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.QuotaClass;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Provides synchronous access to Quota Classes via the REST API.
+ * <p/>
+ * To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas.
+ *
+ * @author Adam Lowe
+ * @see QuotaClassAsyncApi
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.quota_classes.html"/>
+ * @see <a href="http://wiki.openstack.org/QuotaClass"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTA_CLASSES)
+public interface QuotaClassApi {
+
+ /**
+ * @return the quota settings for the tenant
+ */
+ QuotaClass get(String id);
+
+ /**
+ * Update the quotas for a given tenant
+ *
+ * @return true if successful
+ */
+ boolean update(String id, QuotaClass quotas);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java
new file mode 100644
index 0000000..f07148f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java
@@ -0,0 +1,78 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.QuotaClass;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.annotations.Beta;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Quota Classes via the REST API.
+ *
+ * @author Adam Lowe
+ * @see QuotaClassApi
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.quota_classes.html"/>
+ * @see <a href="http://wiki.openstack.org/QuotaClass"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTA_CLASSES)
+@RequestFilters(AuthenticateRequest.class)
+@Path("/os-quota-class-sets")
+public interface QuotaClassAsyncApi {
+
+ /**
+ * @see QuotaClassApi#get
+ */
+ @Named("quotaclass:get")
+ @GET
+ @SelectJson("quota_class_set")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends QuotaClass> get(@PathParam("id") String id);
+
+ /**
+ * @see QuotaClassApi#update
+ */
+ @Named("quotaclass:update")
+ @PUT
+ @Path("/{id}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @MapBinder(BindToJsonPayload.class)
+ ListenableFuture<Boolean> update(@PathParam("id") String id, @PayloadParam("quota_class_set") QuotaClass quotas);
+
+}
[07/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java
deleted file mode 100644
index 867ccd3..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.Ingress;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Security Groups.
- * <p/>
- *
- * @see SecurityGroupAsyncApi
- * @author Jeremy Daggett
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SECURITY_GROUPS)
-public interface SecurityGroupApi {
-
- /**
- * List all Security Groups.
- *
- * @return all Security Groups
- */
- FluentIterable<? extends SecurityGroup> list();
-
- /**
- * Get a specific Security Group
- *
- * @return a specific Security Group
- */
- SecurityGroup get(String id);
-
- /**
- * Create a Security Group
- *
- * @return a new Security Group
- */
- SecurityGroup createWithDescription(String name, String description);
-
- /**
- * Delete a Security Group.
- *
- * @return
- */
- boolean delete(String id);
-
- /**
- * Create a Security Group Rule.
- *
- * @return a new Security Group Rule
- */
- SecurityGroupRule createRuleAllowingCidrBlock(String parentGroup, Ingress ingress, String sourceCidr);
-
- /**
- * Create a Security Group Rule.
- *
- * @return a new Security Group Rule
- */
- SecurityGroupRule createRuleAllowingSecurityGroupId(String parentGroup, Ingress ingress,
- String groupId);
-
- /**
- * Delete a Security Group Rule.
- *
- * @return
- */
- Boolean deleteRule(String id);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java
deleted file mode 100644
index 5e5a2de..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.binders.BindSecurityGroupRuleToJsonPayload;
-import org.jclouds.openstack.nova.v2_0.domain.Ingress;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Security Groups via the REST API.
- * <p/>
- *
- * @see SecurityGroupApi
- * @author Jeremy Daggett
- * @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
- * />
- * @see <a href="http://nova.openstack.org/api_ext" />
- * @see <a href="http://wiki.openstack.org/os-security-groups" />
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SECURITY_GROUPS)
-@RequestFilters(AuthenticateRequest.class)
-public interface SecurityGroupAsyncApi {
-
- /**
- * @see SecurityGroupApi#list
- */
- @Named("securitygroup:list")
- @GET
- @SelectJson("security_groups")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/os-security-groups")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends SecurityGroup>> list();
-
- /**
- * @see SecurityGroupApi#get
- */
- @Named("securitygroup:get")
- @GET
- @Path("/os-security-groups/{id}")
- @SelectJson("security_group")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends SecurityGroup> get(@PathParam("id") String id);
-
- /**
- * @see SecurityGroupApi#createWithDescription
- */
- @Named("securitygroup:create")
- @POST
- @Path("/os-security-groups")
- @SelectJson("security_group")
- @Fallback(NullOnNotFoundOr404.class)
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"security_group\":%7B\"name\":\"{name}\",\"description\":\"{description}\"%7D%7D")
- ListenableFuture<? extends SecurityGroup> createWithDescription(@PayloadParam("name") String name,
- @PayloadParam("description") String description);
-
- /**
- * @see SecurityGroupApi#delete
- */
- @Named("securitygroup:delete")
- @DELETE
- @Path("/os-security-groups/{id}")
- @Fallback(FalseOnNotFoundOr404.class)
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Boolean> delete(@PathParam("id") String id);
-
- /**
- * @see SecurityGroupApi#createRuleAllowingCidrBlock
- */
- @Named("securitygroup:create")
- @POST
- @Path("/os-security-group-rules")
- @SelectJson("security_group_rule")
- @Fallback(NullOnNotFoundOr404.class)
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @MapBinder(BindSecurityGroupRuleToJsonPayload.class)
- ListenableFuture<? extends SecurityGroupRule> createRuleAllowingCidrBlock(
- @PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol,
- @PayloadParam("cidr") String cidr);
-
- /**
- * @see SecurityGroupApi#createRuleOnSecurityGroupToCidrBlock
- */
- @Named("securitygroup:create")
- @POST
- @Path("/os-security-group-rules")
- @SelectJson("security_group_rule")
- @Fallback(NullOnNotFoundOr404.class)
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @MapBinder(BindSecurityGroupRuleToJsonPayload.class)
- ListenableFuture<? extends SecurityGroupRule> createRuleAllowingSecurityGroupId(
- @PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol,
- @PayloadParam("group_id") String group_id);
-
- /**
- * @see SecurityGroupApi#deleteRule
- */
- @Named("securitygroup:delete")
- @DELETE
- @Path("/os-security-group-rules/{security_group_rule_ID}")
- @Fallback(FalseOnNotFoundOr404.class)
- @Consumes
- ListenableFuture<Boolean> deleteRule(@PathParam("security_group_rule_ID") String security_group_rule_ID);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminApi.java
deleted file mode 100644
index 6ad70c2..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminApi.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.BackupType;
-import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Provide additional actions for servers:
- * 'suspend', 'resume', 'migrate', 'lock', 'unlock', 'resetNetwork', 'createBackup', 'pause', 'migrateLive',
- * 'injectNetworkInfo', 'unpause'
- *
- * @author Adam Lowe
- * @see org.jclouds.openstack.nova.v2_0.extensions.ServerAdminAsyncApi
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
-public interface ServerAdminApi {
-
- /**
- * Suspend a server.
- *
- * @param id id of the server
- */
- Boolean suspend(String id);
-
- /**
- * Resume a server.
- *
- * @param id id of the server
- */
- Boolean resume(String id);
-
- /**
- * Migrate a server.
- *
- * @param id id of the server
- */
- Boolean migrate(String id);
-
- /**
- * Lock a server.
- *
- * @param id id of the server
- */
- Boolean lock(String id);
-
- /**
- * Unlock a server.
- *
- * @param id id of the server
- */
- Boolean unlock(String id);
-
- /**
- * Reset network of a server.
- *
- * @param id id of the server
- */
- Boolean resetNetwork(String id);
-
- /**
- * Create backup of a server.
- *
- * @param id id of the server
- * @param imageName the name of the image to create
- * @param backupType the type of backup
- * @param rotation the number of images to retain (0 to simply overwrite)
- * @param options optional rotation and/or metadata parameters
- * @return the id of the newly created image
- */
- String createBackup(String id, String imageName, BackupType backupType, int rotation, CreateBackupOfServerOptions... options);
-
- /**
- * Pause a server.
- *
- * @param id id of the server
- */
- Boolean pause(String id);
-
- /**
- * Unpause a server.
- *
- * @param id id of the server
- */
- Boolean unpause(String id);
-
-
- /**
- * Live migrate a server.
- *
- * @param id id of the server
- */
- Boolean liveMigrate(String id, String host, boolean blockMigration, boolean diskOverCommit);
-
- /**
- * Inject network info into a server.
- *
- * @param id id of the server
- */
- Boolean injectNetworkInfo(String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminAsyncApi.java
deleted file mode 100644
index 1797a9d..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminAsyncApi.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.BackupType;
-import org.jclouds.openstack.nova.v2_0.functions.ParseImageIdFromLocationHeader;
-import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provide access to Admin Server Actions via REST API
- *
- * @author Adam Lowe
- * @see org.jclouds.openstack.nova.v2_0.extensions.ServerAdminApi
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
-@RequestFilters(AuthenticateRequest.class)
-@Path("/servers/{id}/action")
-public interface ServerAdminAsyncApi {
-
- /**
- * @see ServerAdminApi#suspend(String)
- */
- @Named("serveradmin:suspend")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"suspend\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> suspend(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#resume(String)
- */
- @Named("serveradmin:resume")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"resume\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> resume(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#migrate(String)
- */
- @Named("serveradmin:migrate")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"migrate\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> migrate(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#lock(String)
- */
- @Named("serveradmin:lock")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"lock\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> lock(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#unlock(String)
- */
- @Named("serveradmin:unlock")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"unlock\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> unlock(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#resetNetwork(String)
- */
- @Named("serveradmin:resetnetwork")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"resetNetwork\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> resetNetwork(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#createBackup
- */
- @Named("serveradmin:createbackup")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @WrapWith("createBackup")
- @Fallback(MapHttp4xxCodesToExceptions.class)
- @ResponseParser(ParseImageIdFromLocationHeader.class)
- ListenableFuture<String> createBackup(@PathParam("id") String id,
- @PayloadParam("name") String imageName,
- @PayloadParam("backup_type") BackupType backupType,
- @PayloadParam("rotation") int rotation,
- CreateBackupOfServerOptions... options);
-
- /**
- * @see ServerAdminApi#pause(String)
- */
- @Named("serveradmin:pause")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"pause\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> pause(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#unpause(String)
- */
- @Named("serveradmin:unpause")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"unpause\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> unpause(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#injectNetworkInfo(String)
- */
- @Named("serveradmin:injectnetwork")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"injectNetworkInfo\":null}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> injectNetworkInfo(@PathParam("id") String id);
-
- /**
- * @see ServerAdminApi#liveMigrate(String)
- */
- @Named("serveradmin:livemigrate")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- @WrapWith("os-migrateLive")
- ListenableFuture<Boolean> liveMigrate(@PathParam("id") String id,
- @PayloadParam("host") String host,
- @PayloadParam("block_migration") boolean blockMigration,
- @PayloadParam("disk_over_commit") boolean diskOverCommit);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApi.java
deleted file mode 100644
index f9c91ae..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApi.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Provides synchronous access to Server details including security group, referred to as the CREATESERVEREXT extension
- * in the nova documentation
- * <p/>
- * NOTE: the equivalent to listServersInDetail() isn't available at the other end, so not extending ServerApi at this
- * time.
- *
- * @author Adam Lowe
- * @see org.jclouds.openstack.nova.v2_0.features.ServerApi
- * @see ServerWithSecurityGroupsAsyncApi
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.createserverext.html"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.CREATESERVEREXT)
-public interface ServerWithSecurityGroupsApi {
-
- /**
- * Retrieve details of the specified server, including security groups
- *
- * @param id id of the server
- * @return server or null if not found
- */
- ServerWithSecurityGroups get(String id);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java
deleted file mode 100644
index 069d39b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides synchronous access to Servers with Security Groups.
- *
- * @author Adam Lowe
- * @see org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi
- * @see ServerWithSecurityGroupsApi
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.createserverext.html"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.CREATESERVEREXT)
-@RequestFilters(AuthenticateRequest.class)
-public interface ServerWithSecurityGroupsAsyncApi {
-
- /**
- * @see ServerWithSecurityGroupsApi#get(String)
- */
- @Named("server:get")
- @GET
- @SelectJson("server")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/os-create-server-ext/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends ServerWithSecurityGroups> get(@PathParam("id") String id);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java
deleted file mode 100644
index 08a1852..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.SimpleTenantUsage;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides asynchronous access to Simple Tenant Usage via the REST API.
- * <p/>
- *
- * @author Adam Lowe
- * @see SimpleTenantUsageAsyncApi
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
-public interface SimpleTenantUsageApi {
-
- /**
- * Retrieve tenant_usage for all tenants
- *
- * @return the set of TenantUsage reports
- */
- FluentIterable<? extends SimpleTenantUsage> list();
-
- /**
- * Retrieve tenant_usage for a specified tenant
- *
- * @return the requested tenant usage
- */
- SimpleTenantUsage get(String tenantId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java
deleted file mode 100644
index 550d404..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.SimpleTenantUsage;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Simple Tenant Usage via the REST API.
- * <p/>
- *
- * @author Adam Lowe
- * @see SimpleTenantUsageApi
- * @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html" />
- * @see <a href="http://nova.openstack.org/api_ext" />
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.simple_tenant_usage.html" />
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
-@RequestFilters(AuthenticateRequest.class)
-public interface SimpleTenantUsageAsyncApi {
-
- /**
- * @see SimpleTenantUsageApi#list()
- */
- @Named("tenantusage:list")
- @GET
- @Path("/os-simple-tenant-usage")
- @SelectJson("tenant_usages")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends SimpleTenantUsage>> list();
-
- /**
- * @see SimpleTenantUsageApi#get(String)
- */
- @Named("tenantusage:get")
- @GET
- @Path("/os-simple-tenant-usage/{id}")
- @SelectJson("tenant_usage")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends SimpleTenantUsage> get(@PathParam("id") String tenantId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java
deleted file mode 100644
index daf089f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.VirtualInterface;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Virtual Interface features (VIFs).
- *
- * @see VirtualInterfaceAsyncApi
- * @author Adam Lowe
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VIRTUAL_INTERFACES)
-public interface VirtualInterfaceApi {
-
- /**
- * Returns the list of Virtual Interfaces for a given instance.
- *
- * @return the list of snapshots
- */
- FluentIterable<? extends VirtualInterface> listOnServer(String serverId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java
deleted file mode 100644
index c23228c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.VirtualInterface;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Virtual Interface features (VIFs).
- *
- * @see VirtualInterfaceApi
- * @author Adam Lowe
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VIRTUAL_INTERFACES)
-@RequestFilters(AuthenticateRequest.class)
-public interface VirtualInterfaceAsyncApi {
- /**
- * @see VirtualInterfaceApi#listOnServer(String)
- */
- @Named("virtualinterface:list")
- @GET
- @SelectJson("virtual_interfaces")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/servers/{server_id}/os-virtual-interfaces")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends VirtualInterface>> listOnServer(@PathParam("server_id") String serverId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java
deleted file mode 100644
index f9ab865..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.Volume;
-import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
-import org.jclouds.openstack.nova.v2_0.domain.VolumeSnapshot;
-import org.jclouds.openstack.nova.v2_0.options.CreateVolumeOptions;
-import org.jclouds.openstack.nova.v2_0.options.CreateVolumeSnapshotOptions;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Volumes.
- * <p/>
- *
- * @see VolumeAsyncApi
- * @see org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi
- * @author Adam Lowe
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUMES)
-public interface VolumeApi {
- /**
- * Returns a summary list of snapshots.
- *
- * @return the list of snapshots
- */
- FluentIterable<? extends Volume> list();
-
- /**
- * Returns a detailed list of volumes.
- *
- * @return the list of volumes.
- */
- FluentIterable<? extends Volume> listInDetail();
-
- /**
- * Return data about the given volume.
- *
- * @return details of a specific snapshot.
- */
- Volume get(String volumeId);
-
- /**
- * Creates a new Snapshot
- *
- * @return the new Snapshot
- */
- Volume create(int sizeGB, CreateVolumeOptions... options);
-
- /**
- * Delete a snapshot.
- *
- * @return true if successful
- */
- boolean delete(String volumeId);
-
- /**
- * List volume attachments for a given instance.
- *
- * @return all Floating IPs
- * @deprecated To be removed in jclouds 1.7
- * @see VolumeAttachmentApi#listAttachmentsOnServer(String)
- */
- @Deprecated FluentIterable<? extends VolumeAttachment> listAttachmentsOnServer(String serverId);
-
- /**
- * Get a specific attached volume.
- *
- * @return data about the given volume attachment.
- * @deprecated To be removed in jclouds 1.7
- * @see VolumeAttachmentApi#getAttachmentForVolumeOnServer(String, String)
- */
- @Deprecated VolumeAttachment getAttachmentForVolumeOnServer(String volumeId, String serverId);
-
- /**
- * Attach a volume to an instance
- *
- * @return data about the new volume attachment
- * @deprecated To be removed in jclouds 1.7
- * @see VolumeAttachmentApi#attachVolumeToServerAsDevice(String, String, String)
- */
- @Deprecated VolumeAttachment attachVolumeToServerAsDevice(String volumeId, String serverId, String device);
-
- /**
- * Detach a Volume from an instance.
- *
- * @return true if successful
- * @deprecated To be removed in jclouds 1.7
- * @see VolumeAttachmentApi#detachVolumeFromServer(String, String)
- */
- @Deprecated Boolean detachVolumeFromServer(String server_id, String volumeId);
-
- /**
- * Returns a summary list of snapshots.
- *
- * @return the list of snapshots
- */
- FluentIterable<? extends VolumeSnapshot> listSnapshots();
-
- /**
- * Returns a summary list of snapshots.
- *
- * @return the list of snapshots
- */
- FluentIterable<? extends VolumeSnapshot> listSnapshotsInDetail();
-
- /**
- * Return data about the given snapshot.
- *
- * @return details of a specific snapshot.
- */
- VolumeSnapshot getSnapshot(String snapshotId);
-
- /**
- * Creates a new Snapshot
- *
- * @return the new Snapshot
- */
- VolumeSnapshot createSnapshot(String volumeId, CreateVolumeSnapshotOptions... options);
-
- /**
- * Delete a snapshot.
- *
- * @return true if successful
- */
- boolean deleteSnapshot(String snapshotId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java
deleted file mode 100644
index 0e84604..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.Volume;
-import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
-import org.jclouds.openstack.nova.v2_0.domain.VolumeSnapshot;
-import org.jclouds.openstack.nova.v2_0.options.CreateVolumeOptions;
-import org.jclouds.openstack.nova.v2_0.options.CreateVolumeSnapshotOptions;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides synchronous access to Volumes.
- * <p/>
- *
- * @see org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi
- * @author Adam Lowe
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUMES)
-@RequestFilters(AuthenticateRequest.class)
-public interface VolumeAsyncApi {
- /**
- * Returns a summary list of volumes.
- *
- * @return the list of volumes
- */
- @Named("volume:list")
- @GET
- @Path("/os-volumes")
- @SelectJson("volumes")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends Volume>> list();
-
- /**
- * Returns a detailed list of volumes.
- *
- * @return the list of volumes.
- */
- @Named("volume:list")
- @GET
- @Path("/os-volumes/detail")
- @SelectJson("volumes")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends Volume>> listInDetail();
-
- /**
- * Return data about the given volume.
- *
- * @return details of a specific volume.
- */
- @Named("volume:get")
- @GET
- @Path("/os-volumes/{id}")
- @SelectJson("volume")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Volume> get(@PathParam("id") String volumeId);
-
- /**
- * Creates a new volume
- *
- * @return the new Snapshot
- */
- @Named("volume:create")
- @POST
- @Path("/os-volumes")
- @SelectJson("volume")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @MapBinder(CreateVolumeOptions.class)
- ListenableFuture<? extends Volume> create(@PayloadParam("size") int sizeGB, CreateVolumeOptions... options);
-
- /**
- * Delete a volume.
- *
- * @return true if successful
- */
- @Named("volume:delete")
- @DELETE
- @Path("/os-volumes/{id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@PathParam("id") String volumeId);
-
- /**
- * List volume attachments for a given instance.
- *
- * @return all Floating IPs
- * @deprecated To be removed in jclouds 1.7
- * @see VolumeAttachmentApi#listAttachmentsOnServer(String)
- */
- @Named("volume:listattachments")
- @GET
- @Path("/servers/{server_id}/os-volume_attachments")
- @SelectJson("volumeAttachments")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- @Deprecated ListenableFuture<? extends FluentIterable<? extends VolumeAttachment>> listAttachmentsOnServer(@PathParam("server_id") String serverId);
-
- /**
- * Get a specific attached volume.
- *
- * @return data about the given volume attachment.
- * @deprecated To be removed in jclouds 1.7
- * @see VolumeAttachmentApi#getAttachmentForVolumeOnServer(String, String)
- */
- @Named("volume:getattachments")
- @GET
- @Path("/servers/{server_id}/os-volume_attachments/{id}")
- @SelectJson("volumeAttachment")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @Deprecated ListenableFuture<? extends VolumeAttachment> getAttachmentForVolumeOnServer(@PathParam("id") String volumeId,
- @PathParam("server_id") String serverId);
-
- /**
- * Attach a volume to an instance
- *
- * @return the new Attachment
- * @deprecated To be removed in jclouds 1.7
- * @see VolumeAttachmentApi#attachVolumeToServerAsDevice(String, String, String)
- */
- @Named("volume:attach")
- @POST
- @Path("/servers/{server_id}/os-volume_attachments")
- @SelectJson("volumeAttachment")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- @WrapWith("volumeAttachment")
- @Deprecated ListenableFuture<? extends VolumeAttachment> attachVolumeToServerAsDevice(@PayloadParam("volumeId") String volumeId,
- @PathParam("server_id") String serverId, @PayloadParam("device") String device);
-
- /**
- * Detach a Volume from an instance.
- *
- * @return true if successful
- * @deprecated To be removed in jclouds 1.7
- * @see VolumeAttachmentApi#detachVolumeFromServer(String, String)
- */
- @Named("volume:detach")
- @DELETE
- @Path("/servers/{server_id}/os-volume_attachments/{id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- @Deprecated ListenableFuture<Boolean> detachVolumeFromServer(@PathParam("id") String volumeId, @PathParam("server_id") String serverId);
-
- /**
- * Returns a summary list of snapshots.
- *
- * @return the list of snapshots
- */
- @Named("volume:listsnapshots")
- @GET
- @Path("/os-snapshots")
- @SelectJson("snapshots")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends VolumeSnapshot>> listSnapshots();
-
- /**
- * Returns a summary list of snapshots.
- *
- * @return the list of snapshots
- */
- @Named("volume:listsnapshot")
- @GET
- @Path("/os-snapshots/detail")
- @SelectJson("snapshots")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends VolumeSnapshot>> listSnapshotsInDetail();
-
- /**
- * Return data about the given snapshot.
- *
- * @return details of a specific snapshot.
- */
- @Named("volume:getsnapshot")
- @GET
- @Path("/os-snapshots/{id}")
- @SelectJson("snapshot")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends VolumeSnapshot> getSnapshot(@PathParam("id") String snapshotId);
-
- /**
- * Creates a new Snapshot
- *
- * @return the new Snapshot
- */
- @Named("volume:createsnapshot")
- @POST
- @Path("/os-snapshots")
- @SelectJson("snapshot")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- @MapBinder(CreateVolumeSnapshotOptions.class)
- ListenableFuture<? extends VolumeSnapshot> createSnapshot(@PayloadParam("volume_id") String volumeId, CreateVolumeSnapshotOptions... options);
-
- /**
- * Delete a snapshot.
- *
- * @return true if successful
- */
- @Named("volume:deletesnapshot")
- @DELETE
- @Path("/os-snapshots/{id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> deleteSnapshot(@PathParam("id") String snapshotId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApi.java
deleted file mode 100644
index 273815e..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApi.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Volume Attachments.
- *
- * This API strictly handles attaching Volumes to Servers. To create and manage Volumes you need to use one of the
- * following APIs:
- *
- * 1. The Cinder API
- * If your OpenStack deployment is Folsom or later and it supports the Cinder block storage service, use this API.
- * @see org.jclouds.openstack.cinder.v1.features.VolumeApi
- *
- * 2. The nova-volume API
- * If your OpenStack deployment is Essex or earlier and it supports the nova-volume extension, use this API.
- * @see org.jclouds.openstack.nova.v2_0.extensions.VolumeApi
- *
- * @see VolumeAttachmentAsyncApi
- * @author Everett Toews
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUMES)
-public interface VolumeAttachmentApi {
- /**
- * List Volume Attachments for a given Server.
- *
- * @param serverId The ID of the Server
- * @return All VolumeAttachments for the Server
- */
- FluentIterable<? extends VolumeAttachment> listAttachmentsOnServer(String serverId);
-
- /**
- * Get a specific Volume Attachment for a Volume and Server.
- *
- * @param volumeId The ID of the Volume
- * @param serverId The ID of the Server
- * @return The Volume Attachment.
- */
- VolumeAttachment getAttachmentForVolumeOnServer(String volumeId, String serverId);
-
- /**
- * Attach a Volume to a Server.
- *
- * Note: If you are using KVM as your hypervisor then the actual device name in the Server will be different than
- * the one specified. When the Server sees a new device, it picks the next available name (which in most cases is
- * /dev/vdc) and the disk shows up there on the Server.
- *
- * @param serverId The ID of the Server
- * @param volumeId The ID of the Volume
- * @param device The name of the device this Volume will be identified as in the Server (e.g. /dev/vdc)
- * @return The Volume Attachment.
- */
- VolumeAttachment attachVolumeToServerAsDevice(String volumeId, String serverId, String device);
-
- /**
- * Detach a Volume from a server.
- *
- * Note: Make sure you've unmounted the volume first. Failure to do so could result in failure or data loss.
- *
- * @param volumeId The ID of the Volume
- * @param serverId The ID of the Server
- * @return true if successful
- */
- boolean detachVolumeFromServer(String volumeId, String serverId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentAsyncApi.java
deleted file mode 100644
index 7aa5763..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentAsyncApi.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Volume Attachments .
- *
- * @see VolumeAttachmentApi
- * @author Everett Toews
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUMES)
-@RequestFilters(AuthenticateRequest.class)
-public interface VolumeAttachmentAsyncApi {
- /**
- * @see VolumeAttachmentApi#listAttachmentsOnServer(String)
- */
- @Named("volumeattachment:list")
- @GET
- @Path("/servers/{server_id}/os-volume_attachments")
- @SelectJson("volumeAttachments")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends VolumeAttachment>> listAttachmentsOnServer(
- @PathParam("server_id") String serverId);
-
- /**
- * @see VolumeAttachmentApi#getAttachmentForVolumeOnServer(String, String)
- */
- @Named("volumeattachment:get")
- @GET
- @Path("/servers/{server_id}/os-volume_attachments/{id}")
- @SelectJson("volumeAttachment")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends VolumeAttachment> getAttachmentForVolumeOnServer(
- @PathParam("id") String volumeId,
- @PathParam("server_id") String serverId);
-
- /**
- * @see VolumeAttachmentApi#attachVolumeToServerAsDevice(String, String, String)
- */
- @Named("volumeattachment:attach")
- @POST
- @Path("/servers/{server_id}/os-volume_attachments")
- @SelectJson("volumeAttachment")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- @WrapWith("volumeAttachment")
- ListenableFuture<? extends VolumeAttachment> attachVolumeToServerAsDevice(
- @PayloadParam("volumeId") String volumeId,
- @PathParam("server_id") String serverId,
- @PayloadParam("device") String device);
-
- /**
- * @see VolumeAttachmentApi#detachVolumeFromServer(String, String)
- */
- @Named("volumeattachment:detach")
- @DELETE
- @Path("/servers/{server_id}/os-volume_attachments/{id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> detachVolumeFromServer(
- @PathParam("id") String volumeId,
- @PathParam("server_id") String serverId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java
deleted file mode 100644
index be0e5cc..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import java.util.Map;
-import org.jclouds.openstack.nova.v2_0.domain.VolumeType;
-import org.jclouds.openstack.nova.v2_0.options.CreateVolumeTypeOptions;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Volume Type features
- *
- * @author Adam Lowe
- * @see VolumeApi
- * @see VolumeTypeAsyncApi
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.volumetypes.html"/>
- * @see <a href="https://blueprints.launchpad.net/nova/+spec/volume-type"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUME_TYPES)
-public interface VolumeTypeApi {
-
- /**
- * @return set of all volume types
- */
- FluentIterable<? extends VolumeType> list();
-
- /**
- * @param id the id of the volume type to retrieve
- * @return the requested volume type
- */
- VolumeType get(String id);
-
- /**
- * Creates a new volume type
- *
- * @param name the name of the new volume type
- * @param options optional settings for the new volume type
- * @return the new volume type
- */
- VolumeType create(String name, CreateVolumeTypeOptions... options);
-
- /**
- * Deletes a volume type
- */
- boolean delete(String id);
-
- /**
- * @param id the id of the volume type
- * @return the set of extra metadata for the flavor
- */
- Map<String, String> getExtraSpecs(String id);
-
- /**
- * Creates or updates the extra metadata for a given flavor
- */
- boolean updateExtraSpecs(String id, Map<String, String> specs);
-
- /**
- * Retrieve a single extra spec value
- *
- * @param id the id of the volume type
- * @param key the key of the extra spec item to retrieve
- */
- String getExtraSpec(String id, String key);
-
- /**
- * Creates or updates a single extra spec value
- *
- * @param id the id of the volume type
- * @param key the extra spec key (when creating ensure this does not include whitespace or other difficult characters)
- * @param value the new value to store associate with the key
- */
- boolean updateExtraSpec(String id, String key, String value);
-
- /**
- * Deletes an existing extra spec
- *
- * @param id the id of the volume type
- * @param key the key of the extra spec to delete
- */
- boolean deleteExtraSpec(String id, String key);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java
deleted file mode 100644
index 4312258..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.VolumeType;
-import org.jclouds.openstack.nova.v2_0.options.CreateVolumeTypeOptions;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Unwrap;
-import org.jclouds.rest.annotations.WrapWith;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Volume Type features
- *
- * @author Adam Lowe
- * @see VolumeTypeApi
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUME_TYPES)
-@RequestFilters(AuthenticateRequest.class)
-@Path("/os-volume-types")
-@Consumes(MediaType.APPLICATION_JSON)
-public interface VolumeTypeAsyncApi {
-
- /**
- * @see VolumeTypeApi#list
- */
- @Named("volumetype:list")
- @GET
- @SelectJson("volume_types")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends VolumeType>> list();
-
-
- /**
- * @see VolumeTypeApi#get
- */
- @Named("volumetype:get")
- @GET
- @Path("/{id}")
- @SelectJson("volume_type")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends VolumeType> get(@PathParam("id") String id);
-
- /**
- * @see VolumeTypeApi#create
- */
- @Named("volumetype:create")
- @POST
- @SelectJson("volume_type")
- @Produces(MediaType.APPLICATION_JSON)
- @WrapWith("volume_type")
- ListenableFuture<? extends VolumeType> create(@PayloadParam("name") String name, CreateVolumeTypeOptions... options);
-
- /**
- * @see VolumeTypeApi#delete
- */
- @Named("volumetype:delete")
- @DELETE
- @Path("/{id}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@PathParam("id") String id);
-
- /**
- * @see VolumeTypeApi#getExtraSpecs(String)
- */
- @Named("volumetype:getextraspecs")
- @GET
- @SelectJson("extra_specs")
- @Path("/{id}/extra_specs")
- @Fallback(EmptyMapOnNotFoundOr404.class)
- ListenableFuture<Map<String, String>> getExtraSpecs(@PathParam("id") String id);
-
- /**
- * @see VolumeTypeApi#updateExtraSpecs(String, java.util.Map)
- */
- @Named("volumetype:udpateextraspecs")
- @POST
- @Path("/{id}/extra_specs")
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<Boolean> updateExtraSpecs(@PathParam("id") String id, @PayloadParam("extra_specs") Map<String, String> specs);
-
- /**
- * @see VolumeTypeApi#getExtraSpec(String, String)
- */
- @Named("volumetype:getextraspec")
- @GET
- @Path("/{id}/extra_specs/{key}")
- @Unwrap
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<String> getExtraSpec(@PathParam("id") String id, @PathParam("key") String key);
-
- /**
- * @see VolumeTypeApi#updateExtraSpec(String, String, String)
- */
- @Named("volumetype:updateextraspec")
- @PUT
- @Path("/{id}/extra_specs/{key}")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"{key}\":\"{value}\"%7D")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> updateExtraSpec(@PathParam("id") String id,
- @PathParam("key") @PayloadParam("key") String key,
- @PayloadParam("value") String value);
-
- /**
- * @see VolumeTypeApi#deleteExtraSpec(String, String)
- */
- @Named("volumetype:deleteextraspec")
- @DELETE
- @Path("/{id}/extra_specs/{key}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> deleteExtraSpec(@PathParam("id") String id,
- @PathParam("key") String key);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java
deleted file mode 100644
index 7924120..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.features;
-
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.domain.Flavor;
-import org.jclouds.openstack.v2_0.domain.Resource;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * Provides asynchronous access to Flavors via their REST API.
- * <p/>
- *
- * @see FlavorAsyncApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-compute/2/content/List_Flavors-d1e4188.html"
- * />
- * @author Jeremy Daggett, Ilja Bobkevic
- */
-public interface FlavorApi {
-
- /**
- * List all flavors (IDs, names, links)
- *
- * @return all flavors (IDs, names, links)
- */
- PagedIterable<? extends Resource> list();
-
- PaginatedCollection<? extends Resource> list(PaginationOptions options);
-
- /**
- * List all flavors (all details)
- *
- * @return all flavors (all details)
- */
- PagedIterable<? extends Flavor> listInDetail();
-
- PaginatedCollection<? extends Flavor> listInDetail(PaginationOptions options);
-
- /**
- * List details of the specified flavor
- *
- * @param id
- * id of the flavor
- * @return flavor or null if not found
- */
- Flavor get(String id);
-
- /**
- * Create flavor according to the provided object
- *
- * @param flavor - flavor object
- * @return newly created flavor
- */
- Flavor create(Flavor flavor);
-
- /**
- * Delete flavor with a given id
- *
- * @param id - flavor id
- */
- void delete(String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java
deleted file mode 100644
index 7c1552e..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.features;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.Flavor;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseFlavorDetails;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseFlavors;
-import org.jclouds.openstack.v2_0.domain.Resource;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Transform;
-import org.jclouds.rest.annotations.Unwrap;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Flavors via their REST API.
- * <p/>
- *
- * @see FlavorApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-compute/2/content/List_Flavors-d1e4188.html"
- * >docs</a>
- * @author Jeremy Daggett TODO: Need a ListFlavorOptions class minDisk=minDiskInGB&
- * minRam=minRamInMB& marker=markerID&limit=int
- * @author Ilja Bobkevic
- */
-@RequestFilters(AuthenticateRequest.class)
-public interface FlavorAsyncApi {
-
- /**
- * @see FlavorApi#list()
- */
- @Named("flavor:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/flavors")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseFlavors.class)
- @Transform(ParseFlavors.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends Resource>> list();
-
- /** @see FlavorApi#list(PaginationOptions) */
- @Named("flavor:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/flavors")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseFlavors.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends Resource>> list(PaginationOptions options);
-
- /**
- * @see FlavorApi#listInDetail()
- */
- @Named("flavor:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/flavors/detail")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseFlavorDetails.class)
- @Transform(ParseFlavorDetails.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends Flavor>> listInDetail();
-
- /** @see FlavorApi#listInDetail(PaginationOptions) */
- @Named("flavor:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/flavors/detail")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseFlavorDetails.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends Flavor>> listInDetail(PaginationOptions options);
-
- /**
- * @see FlavorApi#get
- */
- @Named("flavor:get")
- @GET
- @SelectJson("flavor")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/flavors/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Flavor> get(@PathParam("id") String id);
-
-
- /**
- * @see FlavorApi#create
- */
- @Named("flavor:create")
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/flavors")
- ListenableFuture<? extends Flavor> create(@WrapWith("flavor") Flavor flavor);
-
- /**
- * @see FlavorApi#delete
- */
- @Named("flavor:delete")
- @DELETE
- @Consumes
- @Path("/flavors/{id}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> delete(@PathParam("id") String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java
deleted file mode 100644
index cc7f468..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.features;
-
-import java.util.Map;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-import org.jclouds.openstack.v2_0.domain.Resource;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-
-/**
- * Provides synchronous access to Images.
- * <p/>
- *
- * @see ImageAsyncApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-compute/1.1/content/Servers-d1e2073.html"
- * />
- * @author Adrian Cole
- */
-public interface ImageApi {
-
- /**
- * List all images (IDs, names, links)
- *
- * @return all images (IDs, names, links)
- */
- PagedIterable<? extends Resource> list();
-
- PaginatedCollection<? extends Resource> list(PaginationOptions options);
-
- /**
- * List all images (all details)
- *
- * @return all images (all details)
- */
- PagedIterable<? extends Image> listInDetail();
-
- PaginatedCollection<? extends Image> listInDetail(PaginationOptions options);
-
- /**
- * List details of the specified image
- *
- * @param id
- * id of the server
- * @return server or null if not found
- */
- Image get(String id);
-
- /**
- * Delete the specified image
- *
- * @param id
- * id of the image
- * @return server or null if not found
- */
- void delete(String id);
-
- /**
- * List all metadata for an image.
- *
- * @param id
- * id of the image
- * @return the metadata as a Map<String, String>
- */
- Map<String, String> getMetadata(String id);
-
- /**
- * Sets the metadata for an image.
- *
- * @param id
- * id of the image
- * @param metadata
- * a Map containing the metadata
- * @return the metadata as a Map<String, String>
- */
- Map<String, String> setMetadata(String id, Map<String, String> metadata);
-
- /**
- * Update the metadata for a server.
- *
- * @param id
- * id of the image
- * @param metadata
- * a Map containing the metadata
- * @return the metadata as a Map<String, String>
- */
- Map<String, String> updateMetadata(String id, Map<String, String> metadata);
-
- /**
- * Update the metadata for an image.
- *
- * @param id
- * id of the image
- * @param metadata
- * a Map containing the metadata
- * @return the value or null if not present
- */
- @Nullable
- String getMetadata(String id, String key);
-
-
- /**
- * Set a metadata item for an image.
- *
- * @param id
- * id of the image
- * @param key
- * the name of the metadata item
- * @param value
- * the value of the metadata item
- * @return the value you updated
- */
- String updateMetadata(String id, String key, String value);
-
- /**
- * Delete a metadata item from an image.
- *
- * @param id
- * id of the image
- * @param key
- * the name of the metadata item
- */
- void deleteMetadata(String id, String key);
-
-}
[02/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiExpectTest.java
deleted file mode 100644
index 32c4617..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiExpectTest.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.domain.BackupType;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Tests parsing and guice wiring of AdminActionsApi
- *
- * @author Adam Lowe
- */
-@Test(groups = "unit", testName = "AdminActionsApiExpectTest")
-public class AdminActionsApiExpectTest extends BaseNovaApiExpectTest {
-
- public void testSuspend() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.suspend("1"));
- }
-
- public void testSuspendFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.suspend("1"));
- }
-
- @Test(expectedExceptions = AuthorizationException.class)
- public void testSuspendFailsNotAuthorized() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
- HttpResponse.builder().statusCode(403).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- api.suspend("1");
- }
-
- public void testResume() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.resume("1"));
- }
-
- public void testResumeFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.resume("1"));
- }
-
- @Test(expectedExceptions = AuthorizationException.class)
- public void testResumeFailsNotAuthorized() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
- HttpResponse.builder().statusCode(403).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- api.resume("1");
- }
-
- public void testLock() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "lock").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.lock("1"));
- }
-
- public void testLockFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "lock").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.lock("1"));
- }
-
- public void testUnlock() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "unlock").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.unlock("1"));
- }
-
- public void testUnlockFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "unlock").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.unlock("1"));
- }
-
- public void testPause() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "pause").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.pause("1"));
- }
-
- public void testPauseFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "pause").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.pause("1"));
- }
-
- public void testUnpause() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "unpause").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.unpause("1"));
- }
-
- public void testUnpauseFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "unpause").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.unpause("1"));
- }
-
- public void testMigrateServer() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "migrate").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.migrate("1"));
- }
-
-
- public void testMigrateServerFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "migrate").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.migrate("1"));
- }
-
- public void testResetNetworkOfServer() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "resetNetwork").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.resetNetwork("1"));
- }
-
- public void testResetNetworkOfServerFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "resetNetwork").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.resetNetwork("1"));
- }
-
- public void testInjectNetworkInfoIntoServer() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "injectNetworkInfo").build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.injectNetworkInfo("1"));
- }
-
- public void testInjectNetworkInfoIntoServerFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "injectNetworkInfo").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.injectNetworkInfo("1"));
- }
-
- public void testBackupServer() {
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action").method("POST")
- .payload(payloadFromStringWithContentType("{\"createBackup\":{\"backup_type\":\"weekly\",\"rotation\":3,\"name\":\"mybackup\",\"metadata\":{\"some\":\"data or other\"}}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(202).addHeader("Location", "http://172.16.89.149:8774/v2/images/1976b3b3-409a-468d-b16c-a9172c341b46").build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- String imageId = api.createBackup("1", "mybackup", BackupType.WEEKLY, 3, CreateBackupOfServerOptions.Builder.metadata(ImmutableMap.of("some", "data or other")));
- assertEquals(imageId, "1976b3b3-409a-468d-b16c-a9172c341b46");
- }
-
- @Test(expectedExceptions = ResourceNotFoundException.class)
- public void testBackupServerFailNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("POST")
- .payload(payloadFromStringWithContentType("{\"createBackup\":{\"backup_type\":\"weekly\",\"rotation\":3,\"name\":\"mybackup\",\"metadata\":{\"some\":\"data or other\"}}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- api.createBackup("1", "mybackup", BackupType.WEEKLY, 3, CreateBackupOfServerOptions.Builder.metadata(ImmutableMap.of("some", "data or other")));
- }
-
- public void testLiveMigrateServer() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "GONNAOVERWRITE")
- .payload(payloadFromStringWithContentType("{\"os-migrateLive\":{\"host\":\"bighost\",\"block_migration\":true,\"disk_over_commit\":false}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(202).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.liveMigrate("1", "bighost", true, false));
- }
-
- public void testLiveMigrateServerFailsNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
- ServerAdminApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- standardActionRequestBuilderVoidResponse(endpoint, "GONNAOVERWRITE")
- .payload(payloadFromStringWithContentType("{\"os-migrateLive\":{\"host\":\"bighost\",\"block_migration\":true,\"disk_over_commit\":false}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(404).build()
- ).getServerAdminExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.liveMigrate("1", "bighost", true, false));
- }
-
- protected HttpRequest.Builder<?> standardActionRequestBuilderVoidResponse(URI endpoint, String actionName) {
- return HttpRequest.builder()
- .method("POST")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{\"" + actionName + "\":null}", MediaType.APPLICATION_JSON))
- .endpoint(endpoint);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java
deleted file mode 100644
index 1d15058..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.openstack.nova.v2_0.domain.BackupType;
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
-import org.jclouds.openstack.nova.v2_0.features.ImageApi;
-import org.jclouds.openstack.nova.v2_0.features.ServerApi;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
-import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions;
-import org.jclouds.openstack.v2_0.features.ExtensionApi;
-import org.testng.SkipException;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-
-/**
- * Tests behavior of HostAdministrationApi
- *
- * TODO test migration methods
- *
- * @author Adam Lowe
- */
-@Test(groups = "live", testName = "AdminActionsApiLiveTest", singleThreaded = true)
-public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest {
- private ImageApi imageApi;
- private ServerApi serverApi;
- private ExtensionApi extensionApi;
- private Optional<? extends ServerAdminApi> apiOption;
- private String zone;
-
- private String testServerId;
- private String backupImageId;
-
- @BeforeClass(groups = {"integration", "live"})
- @Override
- public void setup() {
- super.setup();
- zone = Iterables.getLast(api.getConfiguredZones(), "nova");
- serverApi = api.getServerApiForZone(zone);
- extensionApi = api.getExtensionApiForZone(zone);
- imageApi = api.getImageApiForZone(zone);
- apiOption = api.getServerAdminExtensionForZone(zone);
- if (apiOption.isPresent()) {
- testServerId = createServerInZone(zone).getId();
- }
- }
-
- @AfterClass(groups = { "integration", "live" })
- @Override
- protected void tearDown() {
- if (apiOption.isPresent()) {
- if (testServerId != null) {
- assertTrue(api.getServerApiForZone(zone).delete(testServerId));
- }
- if (backupImageId != null) {
- imageApi.delete(backupImageId);
- }
- }
- super.tearDown();
- }
-
- protected void skipOnAdminExtensionAbsent() {
- if (!apiOption.isPresent()) {
- throw new SkipException("Test depends on ServerAdminApi extension");
- }
- }
-
- @AfterMethod(alwaysRun = true)
- public void ensureServerIsActiveAgain() {
- if (apiOption.isPresent())
- blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);
- }
-
- public void testSuspendAndResume() {
- skipOnAdminExtensionAbsent();
- ServerAdminApi api = apiOption.get();
-
- // Suspend-resume
- try {
- api.resume(testServerId);
- fail("Resumed an active server!");
- } catch (HttpResponseException e) {
- }
- assertTrue(api.suspend(testServerId));
- blockUntilServerInState(testServerId, serverApi, Status.SUSPENDED);
- try {
- api.suspend(testServerId);
- fail("Suspended an already suspended server!");
- } catch (HttpResponseException e) {
- }
- assertTrue(api.resume(testServerId));
- blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);
- try {
- api.resume(testServerId);
- fail("Resumed an already resumed server!");
- } catch (HttpResponseException e) {
- }
-
- }
-
- public void testLockAndUnlock() {
- skipOnAdminExtensionAbsent();
- ServerAdminApi api = apiOption.get();
-
- // TODO should we be able to double-lock (as it were)
- assertTrue(api.unlock(testServerId));
- assertTrue(api.unlock(testServerId));
- assertTrue(api.lock(testServerId));
- assertTrue(api.lock(testServerId));
- assertTrue(api.unlock(testServerId));
- assertTrue(api.unlock(testServerId));
-
- }
-
- public void testResetNetworkAndInjectNetworkInfo() {
- skipOnAdminExtensionAbsent();
- ServerAdminApi api = apiOption.get();
- assertTrue(api.resetNetwork(testServerId));
- assertTrue(api.injectNetworkInfo(testServerId));
- }
-
- @Test
- public void testPauseAndUnpause() {
- skipOnAdminExtensionAbsent();
- ServerAdminApi api = apiOption.get();
-
- // Unlock and lock (double-checking error contitions too)
- try {
- api.unpause(testServerId);
- fail("Unpaused active server!");
- } catch (HttpResponseException e) {
- }
- assertTrue(api.pause(testServerId));
- blockUntilServerInState(testServerId, serverApi, Status.PAUSED);
- try {
- api.pause(testServerId);
- fail("paused a paused server!");
- } catch (HttpResponseException e) {
- }
- assertTrue(api.unpause(testServerId));
- blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);
- try {
- api.unpause(testServerId);
- fail("Unpaused a server we just unpaused!");
- } catch (HttpResponseException e) {
- }
-
- }
-
- @Test
- public void testCreateBackupOfServer() throws InterruptedException {
- skipOnAdminExtensionAbsent();
- backupImageId = apiOption.get().createBackup(testServerId, "jclouds-test-backup", BackupType.DAILY, 0,
- CreateBackupOfServerOptions.Builder.metadata(ImmutableMap.of("test", "metadata")));
-
- assertNotNull(backupImageId);
-
- // If we don't have extended task status, we'll have to wait here!
- if (extensionApi.get("OS-EXT-STS") == null) {
- Thread.sleep(30000);
- }
-
- blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);
-
- Image backupImage = imageApi.get(backupImageId);
- assertEquals(backupImage.getId(), backupImageId);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
deleted file mode 100644
index f033a1b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.extensions;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-/**
- * @author Inbar Stolberg
- */
-@Test(groups = "unit", testName = "AvailabilityZoneApiExpectTest")
-public class AvailabilityZoneApiExpectTest extends BaseNovaApiExpectTest {
-
- public void testLAvailabilityZonesList() throws Exception {
- HttpRequest list = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-availability-zone")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/listAvailabilityZones.json")).build();
-
- NovaApi availabilityZonesApi = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
-
- assertEquals(availabilityZonesApi.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- FluentIterable<? extends AvailabilityZone> zones = availabilityZonesApi.getAvailabilityZoneApi("az-1.region-a.geo-1").list();
-
- Optional<? extends AvailabilityZone> zone = zones.first();
-
- assertTrue(zone.isPresent(), "Couldn't find zone");
- assertTrue(zone.get().getName().equals("nova"), "Expected zone name to be nova but it was: " + zone.get().getName());
- assertTrue(zone.get().getState().available(), "Zone: "+ zone.get().getName() + " is not available.");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
deleted file mode 100644
index a7ad44f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.extensions;
-
-import com.google.common.collect.FluentIterable;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-/**
- * @author inbar stolberg
- */
-@Test(groups = "live", testName = "AvailabilityZonesApiLiveTest")
-public class AvailabilityZonesApiLiveTest extends BaseNovaApiLiveTest {
-
- @Test
- public void testListAvailabilityZones() throws Exception {
-
- AvailabilityZoneAPI availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne");
- FluentIterable<? extends AvailabilityZone> zones = availabilityZoneApi.list();
-
- for (AvailabilityZone zone : zones) {
- assertNotNull(zone.getName());
- assertTrue(zone.getState().available(), "zone: " + zone.getName() + " is not available.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiExpectTest.java
deleted file mode 100644
index b04b5f2..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiExpectTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Tests guice wiring and parsing of FlavorExtraSpecsApi
- *
- * @author Adam Lowe
- */
-@Test(groups = "unit", testName = "FlavorExtraSpecsApiExpectTest")
-public class FlavorExtraSpecsApiExpectTest extends BaseNovaApiExpectTest {
-
- public void testGetAllExtraSpecs() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
- FlavorExtraSpecsApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_extra_specs.json")).build()
- ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.getMetadata("9"), ImmutableMap.of("test", "value1"));
- }
-
- public void testGetAllExtraSpecsFailNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
- FlavorExtraSpecsApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(404).build()
- ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.getMetadata("9").isEmpty());
- }
-
- public void testSetAllExtraSpecs() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
- FlavorExtraSpecsApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint)
- .method("POST")
- .payload(payloadFromStringWithContentType("{\"extra_specs\":{\"test1\":\"somevalue\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).build()
- ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.updateMetadata("9", ImmutableMap.of("test1", "somevalue")));
- }
-
- public void testSetExtraSpec() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
- FlavorExtraSpecsApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint)
- .method("PUT")
- .payload(payloadFromStringWithContentType("{\"test1\":\"somevalue\"}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).build()
- ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.updateMetadataEntry("5", "test1", "somevalue"));
- }
-
- public void testGetExtraSpec() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
- FlavorExtraSpecsApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"test1\":\"another value\"}", MediaType.APPLICATION_JSON)).build()
- ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
-
- assertEquals(api.getMetadataKey("5", "test1"), "another value");
- }
-
- public void testGetExtraSpecFailNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
- FlavorExtraSpecsApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(404).build()
- ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
-
- assertNull(api.getMetadataKey("5", "test1"));
- }
-
- public void testDeleteExtraSpec() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
- FlavorExtraSpecsApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("DELETE").build(),
- HttpResponse.builder().statusCode(200).build()
- ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
-
- assertTrue(api.deleteMetadataKey("5", "test1"));
- }
-
- public void testDeleteExtraSpecFailNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
- FlavorExtraSpecsApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- authenticatedGET().endpoint(endpoint).method("DELETE").build(),
- HttpResponse.builder().statusCode(404).build()
- ).getFlavorExtraSpecsExtensionForZone("az-1.region-a.geo-1").get();
-
- assertFalse(api.deleteMetadataKey("5", "test1"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java
deleted file mode 100644
index d958324..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Map;
-
-import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
-import org.jclouds.openstack.v2_0.domain.Resource;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-
-/**
- * Tests behavior of FlavorExtraSpecsApi
- *
- * @author Adam Lowe
- */
-@Test(groups = "live", testName = "FlavorExtraSpecsApiLiveTest", singleThreaded = true)
-public class FlavorExtraSpecsApiLiveTest extends BaseNovaApiLiveTest {
- private FlavorApi flavorApi;
- private Optional<? extends FlavorExtraSpecsApi> apiOption;
- private String zone;
-
- private Resource testFlavor;
- private Map<String, String> testSpecs = ImmutableMap.of("jclouds-test", "some data", "jclouds-test2", "more data!");
-
- @BeforeClass(groups = {"integration", "live"})
- @Override
- public void setup() {
- super.setup();
- zone = Iterables.getLast(api.getConfiguredZones(), "nova");
- flavorApi = api.getFlavorApiForZone(zone);
- apiOption = api.getFlavorExtraSpecsExtensionForZone(zone);
- }
-
- @AfterClass(groups = { "integration", "live" })
- @Override
- protected void tearDown() {
- if (apiOption.isPresent() && testFlavor != null) {
- for (String key : testSpecs.keySet()) {
- assertTrue(apiOption.get().deleteMetadataKey(testFlavor.getId(), key));
- }
- }
- super.tearDown();
- }
-
- public void testCreateExtraSpecs() {
- if (apiOption.isPresent()) {
- FlavorExtraSpecsApi api = apiOption.get();
- testFlavor = Iterables.getLast(flavorApi.list().concat());
- Map<String, String> before = api.getMetadata(testFlavor.getId());
- assertNotNull(before);
- Map<String, String> specs = Maps.newHashMap(before);
- specs.putAll(testSpecs);
- assertTrue(api.updateMetadata(testFlavor.getId(), specs));
- assertEquals(api.getMetadata(testFlavor.getId()), specs);
- for (Map.Entry<String, String> entry : specs.entrySet()) {
- assertEquals(api.getMetadataKey(testFlavor.getId(), entry.getKey()), entry.getValue());
- }
- }
- }
-
- @Test(dependsOnMethods = "testCreateExtraSpecs")
- public void testListExtraSpecs() {
- if (apiOption.isPresent()) {
- FlavorExtraSpecsApi api = apiOption.get();
- for (String key : testSpecs.keySet()) {
- assertTrue(api.getMetadata(testFlavor.getId()).containsKey(key));
- }
- for (Resource flavor : flavorApi.list().concat()) {
- Map<String, String> specs = api.getMetadata(flavor.getId());
- assertNotNull(specs);
- for (Map.Entry<String, String> entry : specs.entrySet()) {
- assertEquals(api.getMetadataKey(flavor.getId(), entry.getKey()), entry.getValue());
- }
- }
- }
- }
-
- @Test(dependsOnMethods = "testCreateExtraSpecs")
- public void testTwiddleIndividualSpecs() {
- if (apiOption.isPresent()) {
- FlavorExtraSpecsApi api = apiOption.get();
- for (String key : testSpecs.keySet()) {
- assertTrue(api.updateMetadataEntry(testFlavor.getId(), key, "new value"));
- }
- for (String key : testSpecs.keySet()) {
- assertEquals(api.getMetadataKey(testFlavor.getId(), key), "new value");
- }
- for (Resource flavor : flavorApi.list().concat()) {
- Map<String, String> specs = api.getMetadata(flavor.getId());
- assertNotNull(specs);
- for (Map.Entry<String, String> entry : specs.entrySet()) {
- assertEquals(api.getMetadataKey(flavor.getId(), entry.getKey()), entry.getValue());
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java
deleted file mode 100644
index 65cf1d4..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPListTest;
-import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Tests annotation parsing of {@code FloatingIPAsyncApi}
- *
- * @author Michael Arnold
- */
-@Test(groups = "unit", testName = "FloatingIPApiExpectTest")
-public class FloatingIPApiExpectTest extends BaseNovaApiExpectTest {
- public void testWhenNamespaceInExtensionsListFloatingIpPresent() throws Exception {
-
- NovaApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse);
-
- assertEquals(apiWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- assertTrue(apiWhenExtensionNotInList.getFloatingIPExtensionForZone("az-1.region-a.geo-1").isPresent());
-
- }
-
- public void testWhenNamespaceNotInExtensionsListFloatingIpNotPresent() throws Exception {
-
- NovaApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, unmatchedExtensionsOfNovaResponse);
-
- assertEquals(apiWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- assertFalse(apiWhenExtensionNotInList.getFloatingIPExtensionForZone("az-1.region-a.geo-1").isPresent());
-
- }
-
- public void testListFloatingIPsWhenResponseIs2xx() throws Exception {
- HttpRequest list = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/floatingip_list.json")).build();
-
- NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
-
- assertEquals(apiWhenFloatingIPsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
-
- assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().list()
- .toString(), new ParseFloatingIPListTest().expected().toString());
- }
-
- public void testListFloatingIPsWhenResponseIs404() throws Exception {
- HttpRequest list = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
-
- NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
-
- assertTrue(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().list().isEmpty());
- }
-
- public void testGetFloatingIPWhenResponseIs2xx() throws Exception {
- HttpRequest get = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips/1")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse getResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/floatingip_details.json")).build();
-
- NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse);
-
- assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().get("1")
- .toString(), new ParseFloatingIPTest().expected().toString());
- }
-
- public void testGetFloatingIPWhenResponseIs404() throws Exception {
- HttpRequest get = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips/1")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build();
-
- HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
-
- NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse);
-
- assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().get("1"));
- }
-
- public void testAllocateWhenResponseIs2xx() throws Exception {
- HttpRequest createFloatingIP = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{}", "application/json")).build();
-
- HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/floatingip_details.json")).build();
-
- NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
- createFloatingIPResponse);
-
- assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().toString(),
- new ParseFloatingIPTest().expected().toString());
-
- }
-
- public void testAllocateWhenResponseIs404() throws Exception {
- HttpRequest createFloatingIP = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{}", "application/json")).build();
-
- HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(404).build();
-
- NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
- createFloatingIPResponse);
-
- assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create());
- }
-
- public void testAllocateWithPoolNameWhenResponseIs2xx() throws Exception {
- HttpRequest createFloatingIP = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{\"pool\":\"myPool\"}", "application/json")).build();
-
- HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/floatingip_details.json")).build();
-
- NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
- createFloatingIPResponse);
-
- assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().allocateFromPool("myPool").toString(),
- new ParseFloatingIPTest().expected().toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java
deleted file mode 100644
index d85604c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import org.jclouds.openstack.nova.v2_0.domain.Address;
-import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.features.ServerApi;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Multimap;
-
-/**
- * Tests behavior of {@code ServerApi}
- *
- * @author Adrian Cole
- */
-@Test(groups = "live", testName = "FloatingIPApiLiveTest")
-public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
-
- private static final int INCONSISTENCY_WINDOW = 5000;
-
- @Test
- public void testListFloatingIPs() throws Exception {
- for (String zoneId : api.getConfiguredZones()) {
- Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
- if (!apiOption.isPresent())
- continue;
- FloatingIPApi api = apiOption.get();
- Set<? extends FloatingIP> response = api.list().toSet();
- assert null != response;
- assertTrue(response.size() >= 0);
- for (FloatingIP ip : response) {
- FloatingIP newDetails = api.get(ip.getId());
-
- assertEquals(newDetails.getId(), ip.getId());
- assertEquals(newDetails.getIp(), ip.getIp());
- assertEquals(newDetails.getFixedIp(), ip.getFixedIp());
- assertEquals(newDetails.getInstanceId(), ip.getInstanceId());
-
- }
- }
- }
-
- @Test
- public void testAllocateAndDecreateFloatingIPs() throws Exception {
- for (String zoneId : api.getConfiguredZones()) {
- Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
- if (!apiOption.isPresent())
- continue;
- FloatingIPApi api = apiOption.get();
- FloatingIP floatingIP = api.create();
- assertNotNull(floatingIP);
-
- Set<? extends FloatingIP> response = api.list().toSet();
- boolean ipInSet = false;
- for (FloatingIP ip : response) {
- if (ip.getId().equals(floatingIP.getId()))
- ipInSet = true;
- }
- assertTrue(ipInSet);
-
- api.delete(floatingIP.getId());
-
- response = api.list().toSet();
- ipInSet = false;
- for (FloatingIP ip : response) {
- if (ip.getId().equals(floatingIP.getId())) {
- ipInSet = true;
- }
- }
- assertFalse(ipInSet);
- }
- }
-
- @Test
- public void testAddAndRemoveFloatingIp() throws Exception {
- for (String zoneId : api.getConfiguredZones()) {
- Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
- if (!apiOption.isPresent())
- continue;
- FloatingIPApi api = apiOption.get();
- ServerApi serverApi = this.api.getServerApiForZone(zoneId);
- Server server = createServerInZone(zoneId);
- FloatingIP floatingIP = api.create();
- assertNotNull(floatingIP);
- try {
- api.addToServer(floatingIP.getIp(), server.getId());
- assertEventually(new ServerHasFloatingIP(serverApi, server.getId(), floatingIP.getIp()));
- } finally {
- api.removeFromServer(floatingIP.getIp(), server.getId());
- serverApi.delete(server.getId());
- }
- }
- }
-
- protected static void assertEventually(Runnable assertion) {
- long start = System.currentTimeMillis();
- AssertionError error = null;
- for (int i = 0; i < 30; i++) {
- try {
- assertion.run();
- if (i > 0)
- System.err.printf("%d attempts and %dms asserting %s%n", i + 1, System.currentTimeMillis() - start,
- assertion.getClass().getSimpleName());
- return;
- } catch (AssertionError e) {
- error = e;
- }
- try {
- Thread.sleep(INCONSISTENCY_WINDOW / 30);
- } catch (InterruptedException e) {
- }
- }
- if (error != null)
- throw error;
-
- }
-
- public static final class ServerHasFloatingIP implements Runnable {
- private final ServerApi api;
- private final String serverId;
- private final String floatingIP;
-
- public ServerHasFloatingIP(ServerApi serverApi, String serverId, String floatingIP) {
- this.api = serverApi;
- this.serverId = serverId;
- this.floatingIP = floatingIP;
- }
-
- public void run() {
- try {
- Server server = api.get(serverId);
- boolean ipInServerAddresses = false;
- Multimap<String, Address> addresses = server.getAddresses();
- for (Address address : addresses.values()) {
- if (address.getAddr().equals(floatingIP)) {
- ipInServerAddresses = true;
- }
- }
- assertTrue(ipInServerAddresses);
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java
deleted file mode 100644
index 97861e3..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.Set;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.v2_0.domain.Host;
-import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-/**
- * Tests HostAdministrationApi guice wiring and parsing (including the Response parsers in FieldValueResponseParsers)
- *
- * @author Adam Lowe
- */
-@Test(groups = "unit", testName = "HostAdministrationApiExpectTest")
-public class HostAdministrationApiExpectTest extends BaseNovaApiExpectTest {
-
-
- public void testList() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts");
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("GET")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/hosts_list.json")).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
-
- Host expected = Host.builder().name("ubuntu").service("compute").build();
-
- Set<? extends Host> result = api.list().toSet();
- Host host = Iterables.getOnlyElement(result);
- assertEquals(host.getName(), "ubuntu");
- assertEquals(host.getService(), "compute");
-
- assertEquals(host, expected);
- }
-
- public void testGet() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/xyz");
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("GET")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host.json")).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
-
- Set<HostResourceUsage> expected = ImmutableSet.of(
- HostResourceUsage.builder().memoryMb(16083).project("(total)").cpu(4).diskGb(181).host("ubuntu").build(),
- HostResourceUsage.builder().memoryMb(3396).project("(used_now)").cpu(3).diskGb(5).host("ubuntu").build(),
- HostResourceUsage.builder().memoryMb(6144).project("(used_max)").cpu(3).diskGb(80).host("ubuntu").build(),
- HostResourceUsage.builder().memoryMb(6144).project("f8535069c3fb404cb61c873b1a0b4921").cpu(3).diskGb(80).host("ubuntu").build()
- );
-
- assertEquals(api.listResourceUsage("xyz").toSet(), expected);
- }
-
- public void testEnableHost() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("PUT")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"status\":\"enabled\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertTrue(api.enable("ubuntu"));
- }
-
- @Test(expectedExceptions = ResourceNotFoundException.class)
- public void testEnableHostFailNotFound() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("PUT")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(404)
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- api.enable("ubuntu");
- }
-
- public void testEnableHostFailNotEnabled() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("PUT")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"status\":\"disabled\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertFalse(api.enable("ubuntu"));
- }
-
- public void testDisableHost() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("PUT")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{\"status\":\"disable\"}", MediaType.APPLICATION_JSON))
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"status\":\"disabled\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertTrue(api.disable("ubuntu"));
- }
-
- public void testStartMaintenance() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("PUT")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{\"maintenance_mode\":\"enable\"}", MediaType.APPLICATION_JSON))
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"maintenance_mode\":\"on_maintenance\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertTrue(api.startMaintenance("ubuntu"));
- }
-
- public void testStopMaintenance() {
- URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("PUT")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken)
- .payload(payloadFromStringWithContentType("{\"maintenance_mode\":\"disable\"}", MediaType.APPLICATION_JSON))
- .endpoint(endpoint).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"maintenance_mode\":\"off_maintenance\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertTrue(api.stopMaintenance("ubuntu"));
- }
-
- public void testStartupHost() {
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"power_action\":\"startup\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertTrue(api.startup("ubuntu"));
- }
-
- @Test(expectedExceptions = ResourceNotFoundException.class)
- public void testStartupHostFailNotFound() {
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build(),
- HttpResponse.builder().statusCode(404).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertTrue(api.startup("ubuntu"));
- }
-
- public void testStartupHostFailWrongActionInProgress() {
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"power_action\":\"shutdown\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertFalse(api.startup("ubuntu"));
- }
-
- public void testShutdownHost() {
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/shutdown")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"power_action\":\"shutdown\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertTrue(api.shutdown("ubuntu"));
- }
-
- public void testRebootHost() {
- HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
- responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
- HttpRequest.builder().method("GET")
- .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/reboot")
- .addHeader("Accept", "application/json")
- .addHeader("X-Auth-Token", authToken).build(),
- HttpResponse.builder().statusCode(200)
- .payload(payloadFromStringWithContentType("{\"host\":\"ubuntu\",\"power_action\":\"reboot\"}", MediaType.APPLICATION_JSON))
- .build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
- assertTrue(api.reboot("ubuntu"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java
deleted file mode 100644
index 814cd7d..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import org.jclouds.openstack.nova.v2_0.domain.Host;
-import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
-import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
-import org.testng.annotations.BeforeGroups;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
-/**
- * Tests behavior of HostAdministrationApi
- *
- * @author Adam Lowe
- */
-@Test(groups = "live", testName = "HostAdministrationApiLiveTest", singleThreaded = true)
-public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest {
- private Optional<? extends HostAdministrationApi> optApi = Optional.absent();
-
- Predicate<Host> isComputeHost = new Predicate<Host>() {
- @Override
- public boolean apply(Host input) {
- return Objects.equal("compute", input.getService());
- }
- };
-
- @BeforeGroups(groups = {"integration", "live"})
- @Override
- public void setup() {
- super.setup();
-
- if (identity.endsWith(":admin")) {
- String zone = Iterables.getLast(api.getConfiguredZones(), "nova");
- optApi = api.getHostAdministrationExtensionForZone(zone);
- }
- }
-
- public void testListAndGet() throws Exception {
- if (optApi.isPresent()) {
- HostAdministrationApi api = optApi.get();
- Set<? extends Host> hosts = api.list().toSet();
- assertNotNull(hosts);
- for (Host host : hosts) {
- for (HostResourceUsage usage : api.listResourceUsage(host.getName())) {
- assertEquals(usage.getHost(), host.getName());
- assertNotNull(usage);
- }
- }
- }
- }
-
- @Test(enabled = false)
- public void testEnableDisable() throws Exception {
- if (optApi.isPresent()) {
- HostAdministrationApi api = optApi.get();
- Host host = Iterables.find(api.list(), isComputeHost);
-
- assertTrue(api.disable(host.getName()));
- assertTrue(api.enable(host.getName()));
- }
- }
-
- @Test(enabled = false)
- public void testMaintenanceMode() throws Exception {
- if (optApi.isPresent()) {
- HostAdministrationApi api = optApi.get();
- Host host = Iterables.find(api.list(), isComputeHost);
- assertTrue(api.startMaintenance(host.getName()));
- assertTrue(api.stopMaintenance(host.getName()));
- }
- }
-
- @Test(enabled = false)
- public void testReboot() throws Exception {
- if (optApi.isPresent()) {
- HostAdministrationApi api = optApi.get();
- Host host = Iterables.find(api.list(), isComputeHost);
- assertTrue(api.reboot(host.getName()));
- }
- }
-
- @Test(enabled = false)
- public void testShutdownAndStartup() throws Exception {
- if (optApi.isPresent()) {
- HostAdministrationApi api = optApi.get();
- Host host = Iterables.find(api.list(), isComputeHost);
- assertTrue(api.shutdown(host.getName()));
- assertTrue(api.startup(host.getName()));
- }
- }
-}
[33/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list.json
new file mode 100644
index 0000000..4f3faa5
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list.json
@@ -0,0 +1,42 @@
+{
+ "extensions": [
+ {
+ "name": "Public Image Extension",
+ "namespace": "http://docs.rackspacecloud.com/servers/api/ext/pie/v1.0",
+ "alias": "RAX-PIE",
+ "updated": "2011-01-22T13:25:27-06:00",
+ "description": "Adds the capability to share an image with other users.",
+ "links": [
+ {
+ "rel": "describedby",
+ "type": "application/pdf",
+ "href": "http://docs.rackspacecloud.com/servers/api/ext/cs-pie-20111111.pdf"
+ },
+ {
+ "rel": "describedby",
+ "type": "application/vnd.sun.wadl+xml",
+ "href": "http://docs.rackspacecloud.com/servers/api/ext/cs-pie.wadl"
+ }
+ ]
+ },
+ {
+ "name": "Cloud Block Storage",
+ "namespace": "http://docs.rackspacecloud.com/servers/api/ext/cbs/v1.0",
+ "alias": "RAX-CBS",
+ "updated": "2011-01-12T11:22:33-06:00",
+ "description": "Allows mounting cloud block storage volumes.",
+ "links": [
+ {
+ "rel": "describedby",
+ "type": "application/pdf",
+ "href": "http://docs.rackspacecloud.com/servers/api/ext/cs-cbs-20111201.pdf"
+ },
+ {
+ "rel": "describedby",
+ "type": "application/vnd.sun.wadl+xml",
+ "href": "http://docs.rackspacecloud.com/servers/api/ext/cs-cbs.wadl"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_full.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_full.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_full.json
new file mode 100644
index 0000000..490bebc
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_full.json
@@ -0,0 +1,281 @@
+{"extensions": [
+{
+ "updated": "2011-09-27T00:00:00+00:00",
+ "name": "DiskConfig",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/disk_config/api/v1.1",
+ "alias": "OS-DCF",
+ "description": "Disk Management Extension"
+},
+{
+ "updated": "2011-06-29T00:00:00+00:00",
+ "name": "Hosts",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/hosts/api/v1.1",
+ "alias": "os-hosts",
+ "description": "Admin-only host administration"
+},
+{
+ "updated": "2011-07-19T00:00:00+00:00",
+ "name": "SchedulerHints",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/scheduler-hints/api/v2",
+ "alias": "os-scheduler-hints",
+ "description": "Pass arbitrary key/value pairs to the scheduler"
+},
+{
+ "updated": "2011-08-08T00:00:00+00:00",
+ "name": "Quotas",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/quotas-sets/api/v1.1",
+ "alias": "os-quota-sets",
+ "description": "Quotas management support"
+},
+{
+ "updated": "2011-12-23T00:00:00+00:00",
+ "name": "Floating_ip_dns",
+ "links": [],
+ "namespace": "http://docs.openstack.org/ext/floating_ip_dns/api/v1.1",
+ "alias": "os-floating-ip-dns",
+ "description": "Floating IP DNS support"
+},
+{
+ "updated": "2011-09-14T00:00:00+00:00",
+ "name": "FlavorExtraData",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1",
+ "alias": "OS-FLV-EXT-DATA",
+ "description": "Provide additional data for flavors"
+},
+{
+ "updated": "2011-06-23T00:00:00+00:00",
+ "name": "FlavorExtraSpecs",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/flavor_extra_specs/api/v1.1",
+ "alias": "os-flavor-extra-specs",
+ "description": "Instance type (flavor) extra specs"
+},
+{
+ "updated": "2011-08-17T00:00:00+00:00",
+ "name": "VirtualInterfaces",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/virtual_interfaces/api/v1.1",
+ "alias": "virtual_interfaces",
+ "description": "Virtual interface support"
+},
+{
+ "updated": "2011-12-23T00:00:00+00:00",
+ "name": "Accounts",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/accounts/api/v1.1",
+ "alias": "os-accounts",
+ "description": "Admin-only access to accounts"
+},
+{
+ "updated": "2011-03-25T00:00:00+00:00",
+ "name": "Volumes",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/volumes/api/v1.1",
+ "alias": "os-volumes",
+ "description": "Volumes support"
+},
+{
+ "updated": "2011-11-03T00:00:00+00:00",
+ "name": "ExtendedStatus",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/extended_status/api/v1.1",
+ "alias": "OS-EXT-STS",
+ "description": "Extended Status support"
+},
+{
+ "updated": "2011-12-23T00:00:00+00:00",
+ "name": "Consoles",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/os-consoles/api/v2",
+ "alias": "os-consoles",
+ "description": "Interactive Console support."
+},
+{
+ "updated": "2011-07-21T00:00:00+00:00",
+ "name": "SecurityGroups",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/securitygroups/api/v1.1",
+ "alias": "security_groups",
+ "description": "Security group support"
+},
+{
+ "updated": "2012-01-12T00:00:00+00:00",
+ "name": "Aggregates",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/aggregates/api/v1.1",
+ "alias": "os-aggregates",
+ "description": "Admin-only aggregate administration"
+},
+{
+ "updated": "2011-07-19T00:00:00+00:00",
+ "name": "Createserverext",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/createserverext/api/v1.1",
+ "alias": "os-create-server-ext",
+ "description": "Extended support to the Create Server v1.1 API"
+},
+{
+ "updated": "2011-09-01T00:00:00+00:00",
+ "name": "DeferredDelete",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/deferred-delete/api/v1.1",
+ "alias": "os-deferred-delete",
+ "description": "Instance deferred delete"
+},
+{
+ "updated": "2011-12-21T00:00:00+00:00",
+ "name": "ServerDiagnostics",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/server-diagnostics/api/v1.1",
+ "alias": "os-server-diagnostics",
+ "description": "Allow Admins to view server diagnostics through server action"
+},
+{
+ "updated": "2011-12-23T00:00:00+00:00",
+ "name": "Networks",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/networks/api/v1.1",
+ "alias": "os-networks",
+ "description": "Admin-only Network Management Extension"
+},
+{
+ "updated": "2011-11-03T00:00:00+00:00",
+ "name": "ExtendedServerAttributes",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/extended_status/api/v1.1",
+ "alias": "OS-EXT-SRV-ATTR",
+ "description": "Extended Server Attributes support."
+},
+{
+ "updated": "2011-08-08T00:00:00+00:00",
+ "name": "Keypairs",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/keypairs/api/v1.1",
+ "alias": "os-keypairs",
+ "description": "Keypair Support"
+},
+{
+ "updated": "2011-08-24T00:00:00+00:00",
+ "name": "VolumeTypes",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/volume_types/api/v1.1",
+ "alias": "os-volume-types",
+ "description": "Volume types support"
+},
+{
+ "updated": "2011-08-19T00:00:00+00:00",
+ "name": "SimpleTenantUsage",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/os-simple-tenant-usage/api/v1.1",
+ "alias": "os-simple-tenant-usage",
+ "description": "Simple tenant usage extension"
+},
+{
+ "updated": "2012-01-04T00:00:00+00:00",
+ "name": "Floating_ip_pools",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/floating_ip_pools/api/v1.1",
+ "alias": "os-floating-ip-pools",
+ "description": "Floating IPs support"
+},
+{
+ "updated": "2012-01-23T00:00:00+00:00",
+ "name": "ServerStartStop",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/servers/api/v1.1",
+ "alias": "os-server-start-stop",
+ "description": "Start/Stop instance compute API support"
+},
+{
+ "updated": "2012-03-12T00:00:00+00:00",
+ "name": "QuotaClasses",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/quota-classes-sets/api/v1.1",
+ "alias": "os-quota-class-sets",
+ "description": "Quota classes management support"
+},
+{
+ "updated": "2012-01-19T00:00:00+00:00",
+ "name": "Certificates",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/certificates/api/v1.1",
+ "alias": "os-certificates",
+ "description": "Certificates support"
+},
+{
+ "updated": "2011-08-18T00:00:00+00:00",
+ "name": "Rescue",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/rescue/api/v1.1",
+ "alias": "os-rescue",
+ "description": "Instance rescue mode"
+},
+{
+ "updated": "2012-01-19T00:00:00+00:00",
+ "name": "FlavorManage",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/flavor_manage/api/v1.1",
+ "alias": "os-flavor-manage",
+ "description": "\n Flavor create/delete API support\n "
+},
+{
+ "updated": "2011-12-16T00:00:00+00:00",
+ "name": "Cloudpipe",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/cloudpipe/api/v1.1",
+ "alias": "os-cloudpipe",
+ "description": "Adds actions to create cloudpipe instances.\n\n When running with the Vlan network mode, you need a mechanism to route\n from the public Internet to your vlans. This mechanism is known as a\n cloudpipe.\n\n At the time of creating this class, only OpenVPN is supported. Support for\n a SSH Bastion host is forthcoming.\n "
+},
+{
+ "updated": "2011-06-09T00:00:00+00:00",
+ "name": "Multinic",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/multinic/api/v1.1",
+ "alias": "NMN",
+ "description": "Multiple network support"
+},
+{
+ "updated": "2011-08-08T00:00:00+00:00",
+ "name": "Users",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/users/api/v1.1",
+ "alias": "os-users",
+ "description": "Allow admins to acces user information"
+},
+{
+ "updated": "2011-09-20T00:00:00+00:00",
+ "name": "AdminActions",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/admin-actions/api/v1.1",
+ "alias": "os-admin-actions",
+ "description": "Enable admin-only server actions\n\n Actions include: pause,unpause, suspend, resume, migrate,\n resetNetwork, injectNetworkInfo, lock, unlock, createBackup\n "
+},
+{
+ "updated": "2011-12-21T00:00:00+00:00",
+ "name": "ServerActionList",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/server-actions-list/api/v1.1",
+ "alias": "os-server-action-list",
+ "description": "Allow Admins to view pending server actions"
+},
+{
+ "updated": "2011-12-08T00:00:00+00:00",
+ "name": "Console_output",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/os-console-output/api/v2",
+ "alias": "os-console-output",
+ "description": "Console log output support, with tailing ability."
+},
+{
+ "updated": "2011-06-16T00:00:00+00:00",
+ "name": "Floating_ips",
+ "links": [],
+ "namespace": "http://docs.openstack.org/compute/ext/floating_ips/api/v1.1",
+ "alias": "os-floating-ips",
+ "description": "Floating IPs support"}
+]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_normal.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_normal.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_normal.json
new file mode 100644
index 0000000..37fd53f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_normal.json
@@ -0,0 +1,31 @@
+{
+ "extensions": [{
+ "updated": "2011-08-08T00:00:00+00:00",
+ "name": "Keypairs",
+ "links": [],
+ "namespace": "http://docs.openstack.org/ext/keypairs/api/v1.1",
+ "alias": "os-keypairs",
+ "description": "Keypair Support"
+ }, {
+ "updated": "2011-03-25T00:00:00+00:00",
+ "name": "Volumes",
+ "links": [],
+ "namespace": "http://docs.openstack.org/ext/volumes/api/v1.1",
+ "alias": "os-volumes",
+ "description": "Volumes support"
+ }, {
+ "updated": "2011-07-21T00:00:00+00:00",
+ "name": "SecurityGroups",
+ "links": [],
+ "namespace": "http://docs.openstack.org/ext/securitygroups/api/v1.1",
+ "alias": "security_groups",
+ "description": "Security group support"
+ }, {
+ "updated": "2011-06-16T00:00:00+00:00",
+ "name": "Floating_ips",
+ "links": [],
+ "namespace": "http://docs.openstack.org/ext/floating_ips/api/v1.1",
+ "alias": "os-floating-ips",
+ "description": "Floating IPs support"
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_openstack.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_openstack.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_openstack.json
new file mode 100644
index 0000000..0144af6
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_list_openstack.json
@@ -0,0 +1,115 @@
+{
+ "extensions": [{
+ "updated": "2011-06-09T00:00:00+00:00",
+ "name": "Multinic",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/multinic/api/v1.1",
+ "alias": "NMN",
+ "description": "Multiple network support"
+ }, {
+ "updated": "2011-06-29T00:00:00+00:00",
+ "name": "Hosts",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/hosts/api/v1.1",
+ "alias": "os-hosts",
+ "description": "Host administration"
+ }, {
+ "updated": "2011-03-25T00:00:00+00:00",
+ "name": "Volumes",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/volumes/api/v1.1",
+ "alias": "os-volumes",
+ "description": "Volumes support"
+ }, {
+ "updated": "2011-05-25 16:12:21.656723",
+ "name": "Admin Controller",
+ "links": [],
+ "namespace": "https:TODO/",
+ "alias": "ADMIN",
+ "description": "The Admin API Extension"
+ }, {
+ "updated": "2011-08-08T00:00:00+00:00",
+ "name": "Quotas",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/quotas-sets/api/v1.1",
+ "alias": "os-quota-sets",
+ "description": "Quotas management support"
+ }, {
+ "updated": "2011-08-24T00:00:00+00:00",
+ "name": "VolumeTypes",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/volume_types/api/v1.1",
+ "alias": "os-volume-types",
+ "description": "Volume types support"
+ }, {
+ "updated": "2011-06-23T00:00:00+00:00",
+ "name": "FlavorExtraSpecs",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/flavor_extra_specs/api/v1.1",
+ "alias": "os-flavor-extra-specs",
+ "description": "Instance type (flavor) extra specs"
+ }, {
+ "updated": "2011-09-14T00:00:00+00:00",
+ "name": "FlavorExtraData",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/flavor_extra_data/api/v1.1",
+ "alias": "os-flavor-extra-data",
+ "description": "Provide additional data for flavors"
+ }, {
+ "updated": "2011-08-17T00:00:00+00:00",
+ "name": "VirtualInterfaces",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/virtual_interfaces/api/v1.1",
+ "alias": "virtual_interfaces",
+ "description": "Virtual interface support"
+ }, {
+ "updated": "2011-07-19T00:00:00+00:00",
+ "name": "Createserverext",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/createserverext/api/v1.1",
+ "alias": "os-create-server-ext",
+ "description": "Extended support to the Create Server v1.1 API"
+ }, {
+ "updated": "2011-08-08T00:00:00+00:00",
+ "name": "Keypairs",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/keypairs/api/v1.1",
+ "alias": "os-keypairs",
+ "description": "Keypair Support"
+ }, {
+ "updated": "2011-08-25T00:00:00+00:00",
+ "name": "VSAs",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/vsa/api/v1.1",
+ "alias": "zadr-vsa",
+ "description": "Virtual Storage Arrays support"
+ }, {
+ "updated": "2011-08-19T00:00:00+00:00",
+ "name": "SimpleTenantUsage",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/os-simple-tenant-usage/api/v1.1",
+ "alias": "os-simple-tenant-usage",
+ "description": "Simple tenant usage extension"
+ }, {
+ "updated": "2011-08-18T00:00:00+00:00",
+ "name": "Rescue",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/rescue/api/v1.1",
+ "alias": "os-rescue",
+ "description": "Instance rescue mode"
+ }, {
+ "updated": "2011-07-21T00:00:00+00:00",
+ "name": "SecurityGroups",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/securitygroups/api/v1.1",
+ "alias": "security_groups",
+ "description": "Security group support"
+ }, {
+ "updated": "2011-06-16T00:00:00+00:00",
+ "name": "Floating_ips",
+ "links": [],
+ "namespace": "https://docs.openstack.org/ext/floating_ips/api/v1.1",
+ "alias": "os-floating-ips",
+ "description": "Floating IPs support"
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_details.json
new file mode 100644
index 0000000..b2a3556
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_details.json
@@ -0,0 +1,19 @@
+{
+ "flavor" : {
+ "id" : "52415800-8b69-11e0-9b19-734f1195ff37",
+ "name" : "256 MB Server",
+ "ram" : 256,
+ "disk" : 10,
+ "vcpus" : 1,
+ "links": [
+ {
+ "rel" : "self",
+ "href" : "http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37"
+ },
+ {
+ "rel" : "bookmark",
+ "href" : "http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37"
+ }
+ ]
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list.json
new file mode 100644
index 0000000..1e4cdeb
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list.json
@@ -0,0 +1,32 @@
+{
+ "flavors": [
+ {
+ "id": "52415800-8b69-11e0-9b19-734f1195ff37",
+ "name": "256 MB Server",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37"
+ }
+ ]
+ },
+ {
+ "id": "52415800-8b69-11e0-9b19-734f216543fd",
+ "name": "512 MB Server",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list_detail.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list_detail.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list_detail.json
new file mode 100644
index 0000000..e810b48
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list_detail.json
@@ -0,0 +1 @@
+{"flavors": [{"rxtx_quota": 0, "name": "standard.xsmall", "links": [{"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/flavors/100", "rel": "self"}, {"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100", "rel": "bookmark"}], "ram": 1024, "vcpus": 1, "rxtx_cap": 0, "swap": 0, "disk": 30, "id": 100}, {"rxtx_quota": 0, "name": "standard.small", "links": [{"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/flavors/101", "rel": "self"}, {"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/101", "rel": "bookmark"}], "ram": 2048, "vcpus": 2, "rxtx_cap": 0, "swap": 0, "disk": 60, "id": 101}, {"rxtx_quota": 0, "name": "standard.2xlarge", "links": [{"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/flavors/105", "rel": "self"}, {"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/105", "rel": "bookmark"}], "ra
m": 32768, "vcpus": 8, "rxtx_cap": 0, "swap": 0, "disk": 960, "id": 105}, {"rxtx_quota": 0, "name": "standard.large", "links": [{"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/flavors/103", "rel": "self"}, {"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/103", "rel": "bookmark"}], "ram": 8192, "vcpus": 4, "rxtx_cap": 0, "swap": 0, "disk": 240, "id": 103}, {"rxtx_quota": 0, "name": "standard.medium", "links": [{"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/flavors/102", "rel": "self"}, {"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/102", "rel": "bookmark"}], "ram": 4096, "vcpus": 2, "rxtx_cap": 0, "swap": 0, "disk": 120, "id": 102}, {"rxtx_quota": 0, "name": "standard.xlarge", "links": [{"href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/flavors/104", "rel": "self"}, {"href": "https://az-2.region-a.geo-1.compute.hpclou
dsvc.com/37936628937291/flavors/104", "rel": "bookmark"}], "ram": 16384, "vcpus": 4, "rxtx_cap": 0, "swap": 0, "disk": 480, "id": 104}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list_detail_openstack.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list_detail_openstack.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list_detail_openstack.json
new file mode 100644
index 0000000..4725d8b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_list_detail_openstack.json
@@ -0,0 +1,83 @@
+{
+ "flavors": [{
+ "rxtx_quota": 0,
+ "name": "m1.medium",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/flavors/3",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/flavors/3",
+ "rel": "bookmark"
+ }],
+ "ram": 4096,
+ "vcpus": 2,
+ "rxtx_cap": 0,
+ "swap": 0,
+ "disk": 40,
+ "id": 3
+ }, {
+ "rxtx_quota": 0,
+ "name": "m1.large",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/flavors/4",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/flavors/4",
+ "rel": "bookmark"
+ }],
+ "ram": 8192,
+ "vcpus": 4,
+ "rxtx_cap": 0,
+ "swap": 0,
+ "disk": 80,
+ "id": 4
+ }, {
+ "rxtx_quota": 0,
+ "name": "m1.tiny",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/flavors/1",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/flavors/1",
+ "rel": "bookmark"
+ }],
+ "ram": 512,
+ "vcpus": 1,
+ "rxtx_cap": 0,
+ "swap": 0,
+ "disk": 0,
+ "id": 1
+ }, {
+ "rxtx_quota": 0,
+ "name": "m1.xlarge",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/flavors/5",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/flavors/5",
+ "rel": "bookmark"
+ }],
+ "ram": 16384,
+ "vcpus": 8,
+ "rxtx_cap": 0,
+ "swap": 0,
+ "disk": 160,
+ "id": 5
+ }, {
+ "rxtx_quota": 0,
+ "name": "m1.small",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/flavors/2",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/flavors/2",
+ "rel": "bookmark"
+ }],
+ "ram": 2048,
+ "vcpus": 1,
+ "rxtx_cap": 0,
+ "swap": 0,
+ "disk": 20,
+ "id": 2
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_new.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_new.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_new.json
new file mode 100644
index 0000000..5356f8c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/flavor_new.json
@@ -0,0 +1,10 @@
+{
+ "flavor" : {
+ "id" : "1cb47a44-9b84-4da4-bf81-c1976e8414ab",
+ "name" : "128 MB Server",
+ "ram" : 128,
+ "disk" : 10,
+ "vcpus" : 1,
+ "links" : []
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/floatingip_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/floatingip_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/floatingip_details.json
new file mode 100644
index 0000000..c2411fd
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/floatingip_details.json
@@ -0,0 +1,9 @@
+{
+ "floating_ip" :
+ {
+ "id" : 1,
+ "ip" : "10.0.0.3",
+ "fixed_ip" : "10.0.0.2",
+ "instance_id" : 123
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/floatingip_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/floatingip_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/floatingip_list.json
new file mode 100644
index 0000000..27d2519
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/floatingip_list.json
@@ -0,0 +1,16 @@
+{
+ "floating_ips" : [
+ {
+ "instance_id": 12,
+ "ip" : "10.0.0.3",
+ "fixed_ip": "11.0.0.1",
+ "id" : 1
+ },
+ {
+ "instance_id": null,
+ "ip": "10.0.0.5",
+ "fixed_ip": null,
+ "id": 2
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host.json
new file mode 100644
index 0000000..ad2e217
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host.json
@@ -0,0 +1 @@
+{"host": [{"resource": {"project": "(total)", "memory_mb": 16083, "host": "ubuntu", "cpu": 4, "disk_gb": 181}}, {"resource": {"project": "(used_now)", "memory_mb": 3396, "host": "ubuntu", "cpu": 3, "disk_gb": 5}}, {"resource": {"project": "(used_max)", "memory_mb": 6144, "host": "ubuntu", "cpu": 3, "disk_gb": 80}}, {"resource": {"project": "f8535069c3fb404cb61c873b1a0b4921", "memory_mb": 6144, "host": "ubuntu", "cpu": 3, "disk_gb": 80}}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_details.json
new file mode 100644
index 0000000..5e939dd
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_details.json
@@ -0,0 +1 @@
+{"aggregate": {"name": "jclouds-test-a", "availability_zone": "nova", "deleted": false, "created_at": "2012-05-11 11:40:17", "updated_at": "2012-05-11 11:46:44", "operational_state": "created", "hosts": [], "deleted_at": null, "id": 1, "metadata": {"somekey": "somevalue", "anotherkey": "another val"}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_list.json
new file mode 100644
index 0000000..92dfd38
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_list.json
@@ -0,0 +1 @@
+{"aggregates": [{"name": "jclouds-test-a", "availability_zone": "nova", "deleted": false, "created_at": "2012-05-11 11:40:17", "updated_at": "2012-05-11 11:46:44", "operational_state": "created", "hosts": [], "deleted_at": null, "id": 1, "metadata": {"somekey": "somevalue", "anotherkey": "another val"}}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_with_host_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_with_host_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_with_host_details.json
new file mode 100644
index 0000000..2d132f4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/host_aggregate_with_host_details.json
@@ -0,0 +1 @@
+{"aggregate": {"name": "jclouds-test-a", "availability_zone": "nova", "deleted": false, "created_at": "2012-05-11 11:40:17", "updated_at": "2012-05-11 11:46:44", "operational_state": "created", "hosts": ["ubuntu"], "deleted_at": null, "id": 1, "metadata": {"somekey": "somevalue", "anotherkey": "another val"}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/hosts_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/hosts_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/hosts_list.json
new file mode 100644
index 0000000..30d3770
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/hosts_list.json
@@ -0,0 +1 @@
+{"hosts": [{"host_name": "ubuntu", "service": "compute"}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_active.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_active.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_active.json
new file mode 100644
index 0000000..4b778e4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_active.json
@@ -0,0 +1,41 @@
+{
+ "image" : {
+ "id" : "52415800-8b69-11e0-9b19-734f5736d2a2",
+ "name" : "My Server Backup",
+ "updated" : "2010-10-10T12:00:00Z",
+ "created" : "2010-08-10T12:00:00Z",
+ "tenant_id" : "12345",
+ "user_id" : "joe",
+ "status" : "ACTIVE",
+ "progress" : 80,
+ "minDisk" : 5,
+ "minRam" : 256,
+ "metadata" : {
+ "ImageType" : "Gold",
+ "ImageVersion" : "1.5"
+ },
+ "server" : {
+ "id": "52415800-8b69-11e0-9b19-734f335aa7b3",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f335aa7b3"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f335aa7b3"
+ }
+ ]
+ },
+ "links": [
+ {
+ "rel" : "self",
+ "href" : "http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"
+ },
+ {
+ "rel" : "bookmark",
+ "href" : "http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"
+ }
+ ]
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_details.json
new file mode 100644
index 0000000..b75d94c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_details.json
@@ -0,0 +1,41 @@
+{
+ "image" : {
+ "id" : "52415800-8b69-11e0-9b19-734f5736d2a2",
+ "name" : "My Server Backup",
+ "updated" : "2010-10-10T12:00:00Z",
+ "created" : "2010-08-10T12:00:00Z",
+ "tenant_id" : "12345",
+ "user_id" : "joe",
+ "status" : "SAVING",
+ "progress" : 80,
+ "minDisk" : 5,
+ "minRam" : 256,
+ "metadata" : {
+ "ImageType" : "Gold",
+ "ImageVersion" : "1.5"
+ },
+ "server" : {
+ "id": "52415800-8b69-11e0-9b19-734f335aa7b3",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f335aa7b3"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f335aa7b3"
+ }
+ ]
+ },
+ "links": [
+ {
+ "rel" : "self",
+ "href" : "http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"
+ },
+ {
+ "rel" : "bookmark",
+ "href" : "http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"
+ }
+ ]
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list.json
new file mode 100644
index 0000000..afecf34
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list.json
@@ -0,0 +1,32 @@
+{
+ "images": [
+ {
+ "id": "52415800-8b69-11e0-9b19-734f6f006e54",
+ "name": "CentOS 5.2",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f6f006e54"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f6f006e54"
+ }
+ ]
+ },
+ {
+ "id" : "52415800-8b69-11e0-9b19-734f5736d2a2",
+ "name" : "My Server Backup",
+ "links": [
+ {
+ "rel" : "self",
+ "href" : "http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"
+ },
+ {
+ "rel" : "bookmark",
+ "href" : "http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail.json
new file mode 100644
index 0000000..0b4dcc0
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail.json
@@ -0,0 +1 @@
+{"images": [{"status": "ACTIVE", "updated": "2012-03-12T07:52:30Z", "name": "Debian Squeeze 6.0.3 Server 64-bit 20120123", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1361", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1361", "rel": "bookmark"}], "created": "2012-02-21T14:13:55Z", "progress": 100, "id": "1361", "metadata": {"hp_image_type": "machine", "image_location": "local", "image_state": "available", "project_id": "None", "hp_md_version": "1", "kernel_id": "1359", "min_ram": 0, "ramdisk_id": "1360", "hp_image_id": "c89dee3bca7a62103f7d88d2a02f4dc8", "owner": null, "hp_image_builddate": "20120123", "architecture": "amd64", "min_disk": 0, "hp_image_version": "1hp1.1"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:52:17Z", "name": "Debian Squeeze 6.0.3 Server 64-bit 20120123 (Ramdisk)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3793662893
7291/images/1360", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1360", "rel": "bookmark"}], "created": "2012-02-21T14:13:53Z", "progress": 100, "id": "1360", "metadata": {"hp_image_type": "ramdisk", "image_location": "local", "image_state": "available", "project_id": "None", "hp_md_version": "1", "min_ram": 0, "hp_image_id": "c89dee3bca7a62103f7d88d2a02f4dc8", "owner": null, "hp_image_builddate": "20120123", "architecture": "amd64", "min_disk": 0, "hp_image_version": "1hp1.1"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:52:09Z", "name": "Debian Squeeze 6.0.3 Server 64-bit 20120123 (Kernel)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1359", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1359", "rel": "bookmark"}], "created": "2012-02-21T14:13:52Z", "progress": 100, "id": "1359", "metadata": {"hp_image_type": "kernel", "
image_location": "local", "image_state": "available", "project_id": "None", "hp_md_version": "1", "min_ram": 0, "hp_image_id": "c89dee3bca7a62103f7d88d2a02f4dc8", "owner": null, "hp_image_builddate": "20120123", "architecture": "amd64", "min_disk": 0, "hp_image_version": "1hp1.1"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:51:52Z", "name": "CentOS 6.2 Server 64-bit 20120125", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1358", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1358", "rel": "bookmark"}], "created": "2012-02-21T13:58:51Z", "progress": 100, "id": "1358", "metadata": {"hp_image_type": "machine", "image_location": "local", "image_state": "available", "project_id": "None", "hp_md_version": "1", "kernel_id": "1356", "min_ram": 0, "ramdisk_id": "1357", "hp_image_id": "f2fbb1bf37a13e7c5da897c7082684df", "owner": null, "hp_image_builddate": "20120125", "architecture": "
x86_64", "min_disk": 0, "hp_image_version": "1hp1"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:51:37Z", "name": "CentOS 6.2 Server 64-bit 20120125 (Ramdisk)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1357", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1357", "rel": "bookmark"}], "created": "2012-02-21T13:58:49Z", "progress": 100, "id": "1357", "metadata": {"hp_image_type": "ramdisk", "image_location": "local", "image_state": "available", "project_id": "None", "hp_md_version": "1", "min_ram": 0, "hp_image_id": "f2fbb1bf37a13e7c5da897c7082684df", "owner": null, "hp_image_builddate": "20120125", "architecture": "x86_64", "min_disk": 0, "hp_image_version": "1hp1"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:51:28Z", "name": "CentOS 6.2 Server 64-bit 20120125 (Kernel)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1
356", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1356", "rel": "bookmark"}], "created": "2012-02-21T13:58:47Z", "progress": 100, "id": "1356", "metadata": {"hp_image_type": "kernel", "image_location": "local", "image_state": "available", "project_id": "None", "hp_md_version": "1", "min_ram": 0, "hp_image_id": "f2fbb1bf37a13e7c5da897c7082684df", "owner": null, "hp_image_builddate": "20120125", "architecture": "x86_64", "min_disk": 0, "hp_image_version": "1hp1"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:51:04Z", "name": "Ubuntu Oneiric 11.10 Server 64-bit 20111212", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1242", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1242", "rel": "bookmark"}], "created": "2011-12-21T11:57:15Z", "progress": 100, "id": "1242", "metadata": {"image_location": "local", "image_state": "available
", "kernel_id": "1241", "min_ram": 0, "min_disk": 0, "architecture": "amd64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:50:58Z", "name": "Ubuntu Oneiric 11.10 Server 64-bit 20111212 (Kernel)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1241", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241", "rel": "bookmark"}], "created": "2011-12-21T11:57:07Z", "progress": 100, "id": "1241", "metadata": {"image_location": "local", "image_state": "available", "min_ram": 0, "min_disk": 0, "architecture": "amd64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:50:52Z", "name": "Ubuntu Natty 11.04 Server 64-bit 20111212", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1240", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/3793662893
7291/images/1240", "rel": "bookmark"}], "created": "2011-12-21T11:55:03Z", "progress": 100, "id": "1240", "metadata": {"image_location": "local", "image_state": "available", "kernel_id": "1239", "min_ram": 0, "min_disk": 0, "architecture": "amd64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:50:45Z", "name": "Ubuntu Natty 11.04 Server 64-bit 20111212 (Kernel)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1239", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1239", "rel": "bookmark"}], "created": "2011-12-21T11:55:02Z", "progress": 100, "id": "1239", "metadata": {"image_location": "local", "image_state": "available", "min_ram": 0, "min_disk": 0, "architecture": "amd64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:50:32Z", "name": "Ubuntu Maverick 10.10 Server 64-bit 20111212", "links": [{"href": "
https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1238", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1238", "rel": "bookmark"}], "created": "2011-12-21T11:52:34Z", "progress": 100, "id": "1238", "metadata": {"image_location": "local", "image_state": "available", "kernel_id": "1237", "min_ram": 0, "min_disk": 0, "architecture": "amd64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:50:24Z", "name": "Ubuntu Maverick 10.10 Server 64-bit 20111212 (Kernel)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1237", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1237", "rel": "bookmark"}], "created": "2011-12-21T11:52:27Z", "progress": 100, "id": "1237", "metadata": {"image_location": "local", "image_state": "available", "min_ram": 0, "min_disk": 0, "architecture": "amd6
4", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:49:30Z", "name": "Ubuntu Lucid 10.04 LTS Server 64-bit 20111212", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1236", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1236", "rel": "bookmark"}], "created": "2011-12-21T11:40:17Z", "progress": 100, "id": "1236", "metadata": {"image_location": "local", "image_state": "available", "kernel_id": "1235", "min_ram": 0, "min_disk": 0, "architecture": "amd64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:49:23Z", "name": "Ubuntu Lucid 10.04 LTS Server 64-bit 20111212 (Kernel)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1235", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1235", "rel": "bookmark"}], "create
d": "2011-12-21T11:39:58Z", "progress": 100, "id": "1235", "metadata": {"image_location": "local", "image_state": "available", "min_ram": 0, "min_disk": 0, "architecture": "amd64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:49:05Z", "name": "CentOS 5.6 Server 64-bit 20111207", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1234", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1234", "rel": "bookmark"}], "created": "2011-12-21T11:07:09Z", "progress": 100, "id": "1234", "metadata": {"image_location": "local", "image_state": "available", "kernel_id": "1232", "min_ram": 0, "ramdisk_id": "1233", "min_disk": 0, "architecture": "x86_64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:48:59Z", "name": "CentOS 5.6 Server 64-bit 20111207 (Ramdisk)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpclou
dsvc.com/v1.1/37936628937291/images/1233", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1233", "rel": "bookmark"}], "created": "2011-12-21T11:07:08Z", "progress": 100, "id": "1233", "metadata": {"image_location": "local", "image_state": "available", "min_ram": 0, "min_disk": 0, "architecture": "x86_64", "owner": null, "project_id": "None"}}, {"status": "ACTIVE", "updated": "2012-03-12T07:48:39Z", "name": "CentOS 5.6 Server 64-bit 20111207 (Kernel)", "links": [{"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/images/1232", "rel": "self"}, {"href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1232", "rel": "bookmark"}], "created": "2011-12-21T11:07:07Z", "progress": 100, "id": "1232", "metadata": {"image_location": "local", "image_state": "available", "min_ram": 0, "min_disk": 0, "architecture": "x86_64", "owner": null, "project_id": "None"}}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail_imageextension.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail_imageextension.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail_imageextension.json
new file mode 100644
index 0000000..396d1f4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail_imageextension.json
@@ -0,0 +1,121 @@
+{
+ "images": [{
+ "status": "UNRECOGNIZED",
+ "updated": "2012-02-02T19:11:00Z",
+ "name": "oneiric-server-cloudimg-amd64",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/15",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/15",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:52Z",
+ "progress": 100,
+ "id": "15",
+ "metadata": {
+ "kernel_id": "14",
+ "min_disk": 0,
+ "min_ram": 0,
+ "owner": "1"
+ }
+ }, {
+ "status": "UNKNOWN",
+ "updated": "2012-02-02T19:10:51Z",
+ "name": "oneiric-server-cloudimg-amd64-kernel",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/14",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/14",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:50Z",
+ "progress": 100,
+ "id": "14",
+ "metadata": {
+ "min_disk": 0,
+ "owner": "1",
+ "min_ram": 0
+ }
+ }, {
+ "status": "ACTIVE",
+ "updated": "2012-02-02T19:10:41Z",
+ "name": "natty-server-cloudimg-amd64",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/13",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/13",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:33Z",
+ "progress": 100,
+ "id": "13",
+ "metadata": {
+ "kernel_id": "12",
+ "min_disk": 0,
+ "min_ram": 0,
+ "owner": "1"
+ }
+ }, {
+ "status": "SAVING",
+ "updated": "2012-02-02T19:10:33Z",
+ "name": "natty-server-cloudimg-amd64-kernel",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/12",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/12",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:32Z",
+ "progress": 100,
+ "id": "12",
+ "metadata": {
+ "min_disk": 0,
+ "owner": "1",
+ "min_ram": 0
+ }
+ }, {
+ "status": "ERROR",
+ "updated": "2012-02-02T19:10:41Z",
+ "name": "natty-server-cloudimg-amd64",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/11",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/11",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:33Z",
+ "progress": 100,
+ "id": "11",
+ "metadata": {
+ "kernel_id": "12",
+ "min_disk": 0,
+ "min_ram": 0,
+ "owner": "1"
+ }
+ }, {
+ "status": "ERROR",
+ "updated": "2012-02-02T19:10:41Z",
+ "name": "natty-server-cloudimg-amd64",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/10",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/10",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:33Z",
+ "progress": 100,
+ "id": "10",
+ "metadata": {
+ "kernel_id": "12",
+ "min_disk": 0,
+ "min_ram": 0,
+ "owner": "1"
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail_openstack.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail_openstack.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail_openstack.json
new file mode 100644
index 0000000..f0575db
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/image_list_detail_openstack.json
@@ -0,0 +1,81 @@
+{
+ "images": [{
+ "status": "ACTIVE",
+ "updated": "2012-02-02T19:11:00Z",
+ "name": "oneiric-server-cloudimg-amd64",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/15",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/15",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:52Z",
+ "progress": 100,
+ "id": "15",
+ "metadata": {
+ "kernel_id": "14",
+ "min_disk": 0,
+ "min_ram": 0,
+ "owner": "1"
+ }
+ }, {
+ "status": "ACTIVE",
+ "updated": "2012-02-02T19:10:51Z",
+ "name": "oneiric-server-cloudimg-amd64-kernel",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/14",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/14",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:50Z",
+ "progress": 100,
+ "id": "14",
+ "metadata": {
+ "min_disk": 0,
+ "owner": "1",
+ "min_ram": 0
+ }
+ }, {
+ "status": "ACTIVE",
+ "updated": "2012-02-02T19:10:41Z",
+ "name": "natty-server-cloudimg-amd64",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/13",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/13",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:33Z",
+ "progress": 100,
+ "id": "13",
+ "metadata": {
+ "kernel_id": "12",
+ "min_disk": 0,
+ "min_ram": 0,
+ "owner": "1"
+ }
+ }, {
+ "status": "ACTIVE",
+ "updated": "2012-02-02T19:10:33Z",
+ "name": "natty-server-cloudimg-amd64-kernel",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/images/12",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/images/12",
+ "rel": "bookmark"
+ }],
+ "created": "2012-02-02T19:10:32Z",
+ "progress": 100,
+ "id": "12",
+ "metadata": {
+ "min_disk": 0,
+ "owner": "1",
+ "min_ram": 0
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_created.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_created.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_created.json
new file mode 100644
index 0000000..188f929
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_created.json
@@ -0,0 +1,9 @@
+{
+ "keypair": {
+ "public_key": "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABACE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumADSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQ== nova@nv-aw2az1-api0001\n",
+ "private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIICXQIAAAKBgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABAC\nE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumA\nDSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQIDAQAB\nAoGAW8Ww+KbpQK8smcgCTr/RqcmsSI8VeL2hXjJvDq0L5WbyYuFdkanDvCztUVZn\nsmyfDtwAqZXB4Ct/dN1tY7m8QpdyRaKRW4Q+hghGCAQpsG7rYDdvwdEyvMaW5RA4\ntucQyajMNyQ/tozU3wMx/v8A7RvGcE9tqoG0WK1C3kBu95UCQQDrOd+joYDkvccz\nFIVu5gNPMXEh3fGGzDxk225UlvESquYLzfz4TfmuUjH4Z1BL3wRiwfJsrrjFkm33\njIidDE8PAkEA1qHjxuaIS1yz/rfzErmcOVNlbFHMP4ihjGTTvh1ZctXlNeLwzENQ\nEDaQV3IpUY1KQR6rxcWb5AXgfF9D9PYFpwJBANucAqGAbRgh3lJgPFtXP4u2O0tF\nLPOOxmvbOdybt6KYD4LB5AXmts77SlACFMNhCXUyYaT6UuOSXDyb5gfJsB0CQQC3\nFaGXKU9Z+doQjhlq/6mjvN/nZl80Uvh7Kgb1RVPoAU1kihGeLE0/h0vZTCiyyDNv\nGRqtucMg32J+tUTi0HpBAkAwHiCZMHMeJWHUwIwlRQY/dnR86FWobRl98ViF2rCL\nDHkDVOeIser3Q6zSqU5/m99lX6an5g8pAh/R5LqnOQZC\n-----END RSA PRIVATE KEY-----\n",
+ "user_id": "65649731189278",
+ "name": "testkeypair",
+ "fingerprint": "d2:1f:c9:2b:d8:90:77:5f:15:64:27:e3:9f:77:1d:e4"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_created_computeservice.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_created_computeservice.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_created_computeservice.json
new file mode 100644
index 0000000..7a3cef0
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_created_computeservice.json
@@ -0,0 +1,9 @@
+{
+ "keypair": {
+ "public_key": "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABACE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumADSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQ== nova@nv-aw2az1-api0001\n",
+ "private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIICXQIAAAKBgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABAC\nE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumA\nDSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQIDAQAB\nAoGAW8Ww+KbpQK8smcgCTr/RqcmsSI8VeL2hXjJvDq0L5WbyYuFdkanDvCztUVZn\nsmyfDtwAqZXB4Ct/dN1tY7m8QpdyRaKRW4Q+hghGCAQpsG7rYDdvwdEyvMaW5RA4\ntucQyajMNyQ/tozU3wMx/v8A7RvGcE9tqoG0WK1C3kBu95UCQQDrOd+joYDkvccz\nFIVu5gNPMXEh3fGGzDxk225UlvESquYLzfz4TfmuUjH4Z1BL3wRiwfJsrrjFkm33\njIidDE8PAkEA1qHjxuaIS1yz/rfzErmcOVNlbFHMP4ihjGTTvh1ZctXlNeLwzENQ\nEDaQV3IpUY1KQR6rxcWb5AXgfF9D9PYFpwJBANucAqGAbRgh3lJgPFtXP4u2O0tF\nLPOOxmvbOdybt6KYD4LB5AXmts77SlACFMNhCXUyYaT6UuOSXDyb5gfJsB0CQQC3\nFaGXKU9Z+doQjhlq/6mjvN/nZl80Uvh7Kgb1RVPoAU1kihGeLE0/h0vZTCiyyDNv\nGRqtucMg32J+tUTi0HpBAkAwHiCZMHMeJWHUwIwlRQY/dnR86FWobRl98ViF2rCL\nDHkDVOeIser3Q6zSqU5/m99lX6an5g8pAh/R5LqnOQZC\n-----END RSA PRIVATE KEY-----\n",
+ "user_id": "65649731189278",
+ "name": "jclouds-test-0",
+ "fingerprint": "d2:1f:c9:2b:d8:90:77:5f:15:64:27:e3:9f:77:1d:e4"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_list.json
new file mode 100644
index 0000000..28040ab
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/keypair_list.json
@@ -0,0 +1,18 @@
+{
+ "keypairs": [
+ {
+ "keypair": {
+ "public_key": "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQCy9EC3O7Ff80vPEfAHDQob61PGwcpYc5KE7tEZnZhrB9n0NyHPRm0E0M+ls3fcTa04HDi+R0DzmRwoyhHQJyI658v8kWZZcuvFjKCcsgsSh/dzdX0xTreLIzSOzt5U7RnZYfshP5cmxtF99yrEY3M/swdin0L+fXsTSkR1B42STQ== nova@nv-aw2az1-api0001",
+ "name": "default",
+ "fingerprint": "ab:0c:f4:f3:54:c0:5d:3f:ed:62:ad:d3:94:7c:79:7c"
+ }
+ },
+ {
+ "keypair": {
+ "public_key": "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABACE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumADSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQ== nova@nv-aw2az1-api0001",
+ "name": "testkeypair",
+ "fingerprint": "d2:1f:c9:2b:d8:90:77:5f:15:64:27:e3:9f:77:1d:e4"
+ }
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/listAvailabilityZones.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/listAvailabilityZones.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/listAvailabilityZones.json
new file mode 100644
index 0000000..2d4ad78
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/listAvailabilityZones.json
@@ -0,0 +1,11 @@
+{
+ "availabilityZoneInfo": [
+ {
+ "zoneState": {
+ "available": true
+ },
+ "hosts": null,
+ "zoneName": "nova"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_item.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_item.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_item.json
new file mode 100644
index 0000000..f853109
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_item.json
@@ -0,0 +1,5 @@
+{
+ "metadata": {
+ "Server Label": "Web Head 1"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_list.json
new file mode 100644
index 0000000..174d7d6
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_list.json
@@ -0,0 +1,6 @@
+{
+ "metadata": {
+ "Server Label": "Web Head 1",
+ "Image Version": "2.1"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_updated.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_updated.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_updated.json
new file mode 100644
index 0000000..82d9fd3
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/metadata_updated.json
@@ -0,0 +1,7 @@
+{
+ "metadata": {
+ "Server Label": "Web Head 2",
+ "Image Version": "2.1",
+ "Server Description": "Simple Server"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server.json
new file mode 100644
index 0000000..71fb1f2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server.json
@@ -0,0 +1,41 @@
+{
+ "server": {
+ "status": "BUILD(scheduling)",
+ "updated": "2012-03-19T06:21:13Z",
+ "hostId": "",
+ "user_id": "54297837463082",
+ "name": "test-e92",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752",
+ "rel": "self"
+ }, {
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752",
+ "rel": "bookmark"
+ }],
+ "addresses": {},
+ "tenant_id": "37936628937291",
+ "image": {
+ "id": "1241",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-19T06:21:13Z",
+ "uuid": "47491020-6a78-4f63-9475-23195ac4515c",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": null,
+ "adminPass": "ZWuHcmTMQ7eXoHeM",
+ "flavor": {
+ "id": "100",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100",
+ "rel": "bookmark"
+ }]
+ },
+ "config_drive": "",
+ "id": 71752,
+ "metadata": {}
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_disk_config_auto.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_disk_config_auto.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_disk_config_auto.json
new file mode 100644
index 0000000..7238333
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_disk_config_auto.json
@@ -0,0 +1,42 @@
+{
+ "server": {
+ "status": "BUILD(scheduling)",
+ "updated": "2012-03-19T06:21:13Z",
+ "hostId": "",
+ "user_id": "54297837463082",
+ "name": "test-e92",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752",
+ "rel": "self"
+ }, {
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752",
+ "rel": "bookmark"
+ }],
+ "addresses": {},
+ "tenant_id": "37936628937291",
+ "image": {
+ "id": "1241",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-19T06:21:13Z",
+ "uuid": "47491020-6a78-4f63-9475-23195ac4515c",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": null,
+ "adminPass": "ZWuHcmTMQ7eXoHeM",
+ "flavor": {
+ "id": "100",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100",
+ "rel": "bookmark"
+ }]
+ },
+ "config_drive": "",
+ "id": 71752,
+ "metadata": {},
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_disk_config_manual.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_disk_config_manual.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_disk_config_manual.json
new file mode 100644
index 0000000..2cfba41
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_disk_config_manual.json
@@ -0,0 +1,42 @@
+{
+ "server": {
+ "status": "BUILD(scheduling)",
+ "updated": "2012-03-19T06:21:13Z",
+ "hostId": "",
+ "user_id": "54297837463082",
+ "name": "test-e92",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752",
+ "rel": "self"
+ }, {
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752",
+ "rel": "bookmark"
+ }],
+ "addresses": {},
+ "tenant_id": "37936628937291",
+ "image": {
+ "id": "1241",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-19T06:21:13Z",
+ "uuid": "47491020-6a78-4f63-9475-23195ac4515c",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": null,
+ "adminPass": "ZWuHcmTMQ7eXoHeM",
+ "flavor": {
+ "id": "100",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100",
+ "rel": "bookmark"
+ }]
+ },
+ "config_drive": "",
+ "id": 71752,
+ "metadata": {},
+ "OS-DCF:diskConfig": "MANUAL"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_in_zone.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_in_zone.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_in_zone.json
new file mode 100644
index 0000000..71fb1f2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_in_zone.json
@@ -0,0 +1,41 @@
+{
+ "server": {
+ "status": "BUILD(scheduling)",
+ "updated": "2012-03-19T06:21:13Z",
+ "hostId": "",
+ "user_id": "54297837463082",
+ "name": "test-e92",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752",
+ "rel": "self"
+ }, {
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752",
+ "rel": "bookmark"
+ }],
+ "addresses": {},
+ "tenant_id": "37936628937291",
+ "image": {
+ "id": "1241",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-19T06:21:13Z",
+ "uuid": "47491020-6a78-4f63-9475-23195ac4515c",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": null,
+ "adminPass": "ZWuHcmTMQ7eXoHeM",
+ "flavor": {
+ "id": "100",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100",
+ "rel": "bookmark"
+ }]
+ },
+ "config_drive": "",
+ "id": 71752,
+ "metadata": {}
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_networks_response.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_networks_response.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_networks_response.json
new file mode 100644
index 0000000..7238333
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_networks_response.json
@@ -0,0 +1,42 @@
+{
+ "server": {
+ "status": "BUILD(scheduling)",
+ "updated": "2012-03-19T06:21:13Z",
+ "hostId": "",
+ "user_id": "54297837463082",
+ "name": "test-e92",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752",
+ "rel": "self"
+ }, {
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752",
+ "rel": "bookmark"
+ }],
+ "addresses": {},
+ "tenant_id": "37936628937291",
+ "image": {
+ "id": "1241",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-19T06:21:13Z",
+ "uuid": "47491020-6a78-4f63-9475-23195ac4515c",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": null,
+ "adminPass": "ZWuHcmTMQ7eXoHeM",
+ "flavor": {
+ "id": "100",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100",
+ "rel": "bookmark"
+ }]
+ },
+ "config_drive": "",
+ "id": 71752,
+ "metadata": {},
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_no_adminpass.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_no_adminpass.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_no_adminpass.json
new file mode 100644
index 0000000..a89e48f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_no_adminpass.json
@@ -0,0 +1,40 @@
+{
+ "server": {
+ "status": "BUILD(scheduling)",
+ "updated": "2012-03-19T06:21:13Z",
+ "hostId": "",
+ "user_id": "54297837463082",
+ "name": "test-e92",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752",
+ "rel": "self"
+ }, {
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752",
+ "rel": "bookmark"
+ }],
+ "addresses": {},
+ "tenant_id": "37936628937291",
+ "image": {
+ "id": "1241",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-19T06:21:13Z",
+ "uuid": "47491020-6a78-4f63-9475-23195ac4515c",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": null,
+ "flavor": {
+ "id": "100",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100",
+ "rel": "bookmark"
+ }]
+ },
+ "config_drive": "",
+ "id": 71752,
+ "metadata": {}
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_nova_networks.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_nova_networks.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_nova_networks.json
new file mode 100644
index 0000000..d0f4322
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/new_server_nova_networks.json
@@ -0,0 +1,41 @@
+{
+ "server": {
+ "status": "BUILD(scheduling)",
+ "updated": "2012-03-19T06:21:13Z",
+ "hostId": "",
+ "user_id": "54297837463082",
+ "name": "test-e92",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752",
+ "rel": "self"
+ }, {
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752",
+ "rel": "bookmark"
+ }],
+ "addresses": {},
+ "tenant_id": "37936628937291",
+ "image": {
+ "id": "1241",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-19T06:21:13Z",
+ "uuid": "47491020-6a78-4f63-9475-23195ac4515c",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": null,
+ "adminPass": "ZWuHcmTMQ7eXoHeM",
+ "flavor": {
+ "id": "100",
+ "links": [{
+ "href": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100",
+ "rel": "bookmark"
+ }]
+ },
+ "id": 71752,
+ "metadata": {},
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/quota_class.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/quota_class.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/quota_class.json
new file mode 100644
index 0000000..837b9cc
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/quota_class.json
@@ -0,0 +1,15 @@
+{"quota_class_set": {
+ "metadata_items": 128,
+ "injected_file_content_bytes": 10240,
+ "injected_files": 5,
+ "gigabytes": 1000,
+ "ram": 4096,
+ "floating_ips": 10,
+ "security_group_rules": 20,
+ "instances": 5,
+ "key_pairs": 100,
+ "volumes": 5,
+ "cores": 10,
+ "id": "jcloudstestquotas",
+ "security_groups": 10
+}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/quotas.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/quotas.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/quotas.json
new file mode 100644
index 0000000..dcf2869
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/quotas.json
@@ -0,0 +1,15 @@
+{"quota_set": {
+ "metadata_items": 128,
+ "injected_file_content_bytes": 10240,
+ "injected_files": 5,
+ "gigabytes": 1000,
+ "ram": 51200,
+ "floating_ips": 10,
+ "security_group_rules": 20,
+ "instances": 10,
+ "key_pairs": 100,
+ "volumes": 10,
+ "cores": 20,
+ "id": "demo",
+ "security_groups": 10
+}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_created.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_created.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_created.json
new file mode 100644
index 0000000..fee9b4d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_created.json
@@ -0,0 +1,9 @@
+{
+ "security_group": {
+ "rules": [ ],
+ "tenant_id": "dev_16767499955063",
+ "id": 160,
+ "name": "jclouds-test",
+ "description": "jclouds-test"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details.json
new file mode 100644
index 0000000..840de6c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details.json
@@ -0,0 +1,34 @@
+{
+ "security_group":
+ {
+ "rules": [
+ {
+ "from_port": 22,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 28,
+ "ip_range": {
+ "cidr": "10.2.6.0/24"
+ },
+ "id": 108
+ },
+ {
+ "from_port": 22,
+ "group": {
+ "tenant_id": "admin",
+ "name": "11111"
+ },
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 28,
+ "ip_range": {},
+ "id": 109
+ }
+ ],
+ "tenant_id": "tenant0",
+ "id": 0,
+ "name": "name0",
+ "description": "description0"
+ }
+}
\ No newline at end of file
[44/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java
new file mode 100644
index 0000000..867ccd3
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java
@@ -0,0 +1,89 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.Ingress;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides synchronous access to Security Groups.
+ * <p/>
+ *
+ * @see SecurityGroupAsyncApi
+ * @author Jeremy Daggett
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SECURITY_GROUPS)
+public interface SecurityGroupApi {
+
+ /**
+ * List all Security Groups.
+ *
+ * @return all Security Groups
+ */
+ FluentIterable<? extends SecurityGroup> list();
+
+ /**
+ * Get a specific Security Group
+ *
+ * @return a specific Security Group
+ */
+ SecurityGroup get(String id);
+
+ /**
+ * Create a Security Group
+ *
+ * @return a new Security Group
+ */
+ SecurityGroup createWithDescription(String name, String description);
+
+ /**
+ * Delete a Security Group.
+ *
+ * @return
+ */
+ boolean delete(String id);
+
+ /**
+ * Create a Security Group Rule.
+ *
+ * @return a new Security Group Rule
+ */
+ SecurityGroupRule createRuleAllowingCidrBlock(String parentGroup, Ingress ingress, String sourceCidr);
+
+ /**
+ * Create a Security Group Rule.
+ *
+ * @return a new Security Group Rule
+ */
+ SecurityGroupRule createRuleAllowingSecurityGroupId(String parentGroup, Ingress ingress,
+ String groupId);
+
+ /**
+ * Delete a Security Group Rule.
+ *
+ * @return
+ */
+ Boolean deleteRule(String id);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java
new file mode 100644
index 0000000..5e5a2de
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java
@@ -0,0 +1,152 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.binders.BindSecurityGroupRuleToJsonPayload;
+import org.jclouds.openstack.nova.v2_0.domain.Ingress;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Security Groups via the REST API.
+ * <p/>
+ *
+ * @see SecurityGroupApi
+ * @author Jeremy Daggett
+ * @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
+ * />
+ * @see <a href="http://nova.openstack.org/api_ext" />
+ * @see <a href="http://wiki.openstack.org/os-security-groups" />
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SECURITY_GROUPS)
+@RequestFilters(AuthenticateRequest.class)
+public interface SecurityGroupAsyncApi {
+
+ /**
+ * @see SecurityGroupApi#list
+ */
+ @Named("securitygroup:list")
+ @GET
+ @SelectJson("security_groups")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/os-security-groups")
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends SecurityGroup>> list();
+
+ /**
+ * @see SecurityGroupApi#get
+ */
+ @Named("securitygroup:get")
+ @GET
+ @Path("/os-security-groups/{id}")
+ @SelectJson("security_group")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends SecurityGroup> get(@PathParam("id") String id);
+
+ /**
+ * @see SecurityGroupApi#createWithDescription
+ */
+ @Named("securitygroup:create")
+ @POST
+ @Path("/os-security-groups")
+ @SelectJson("security_group")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"security_group\":%7B\"name\":\"{name}\",\"description\":\"{description}\"%7D%7D")
+ ListenableFuture<? extends SecurityGroup> createWithDescription(@PayloadParam("name") String name,
+ @PayloadParam("description") String description);
+
+ /**
+ * @see SecurityGroupApi#delete
+ */
+ @Named("securitygroup:delete")
+ @DELETE
+ @Path("/os-security-groups/{id}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Consumes(MediaType.APPLICATION_JSON)
+ ListenableFuture<Boolean> delete(@PathParam("id") String id);
+
+ /**
+ * @see SecurityGroupApi#createRuleAllowingCidrBlock
+ */
+ @Named("securitygroup:create")
+ @POST
+ @Path("/os-security-group-rules")
+ @SelectJson("security_group_rule")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @MapBinder(BindSecurityGroupRuleToJsonPayload.class)
+ ListenableFuture<? extends SecurityGroupRule> createRuleAllowingCidrBlock(
+ @PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol,
+ @PayloadParam("cidr") String cidr);
+
+ /**
+ * @see SecurityGroupApi#createRuleOnSecurityGroupToCidrBlock
+ */
+ @Named("securitygroup:create")
+ @POST
+ @Path("/os-security-group-rules")
+ @SelectJson("security_group_rule")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @MapBinder(BindSecurityGroupRuleToJsonPayload.class)
+ ListenableFuture<? extends SecurityGroupRule> createRuleAllowingSecurityGroupId(
+ @PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol,
+ @PayloadParam("group_id") String group_id);
+
+ /**
+ * @see SecurityGroupApi#deleteRule
+ */
+ @Named("securitygroup:delete")
+ @DELETE
+ @Path("/os-security-group-rules/{security_group_rule_ID}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Consumes
+ ListenableFuture<Boolean> deleteRule(@PathParam("security_group_rule_ID") String security_group_rule_ID);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminApi.java
new file mode 100644
index 0000000..6ad70c2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminApi.java
@@ -0,0 +1,120 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.BackupType;
+import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Provide additional actions for servers:
+ * 'suspend', 'resume', 'migrate', 'lock', 'unlock', 'resetNetwork', 'createBackup', 'pause', 'migrateLive',
+ * 'injectNetworkInfo', 'unpause'
+ *
+ * @author Adam Lowe
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ServerAdminAsyncApi
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
+public interface ServerAdminApi {
+
+ /**
+ * Suspend a server.
+ *
+ * @param id id of the server
+ */
+ Boolean suspend(String id);
+
+ /**
+ * Resume a server.
+ *
+ * @param id id of the server
+ */
+ Boolean resume(String id);
+
+ /**
+ * Migrate a server.
+ *
+ * @param id id of the server
+ */
+ Boolean migrate(String id);
+
+ /**
+ * Lock a server.
+ *
+ * @param id id of the server
+ */
+ Boolean lock(String id);
+
+ /**
+ * Unlock a server.
+ *
+ * @param id id of the server
+ */
+ Boolean unlock(String id);
+
+ /**
+ * Reset network of a server.
+ *
+ * @param id id of the server
+ */
+ Boolean resetNetwork(String id);
+
+ /**
+ * Create backup of a server.
+ *
+ * @param id id of the server
+ * @param imageName the name of the image to create
+ * @param backupType the type of backup
+ * @param rotation the number of images to retain (0 to simply overwrite)
+ * @param options optional rotation and/or metadata parameters
+ * @return the id of the newly created image
+ */
+ String createBackup(String id, String imageName, BackupType backupType, int rotation, CreateBackupOfServerOptions... options);
+
+ /**
+ * Pause a server.
+ *
+ * @param id id of the server
+ */
+ Boolean pause(String id);
+
+ /**
+ * Unpause a server.
+ *
+ * @param id id of the server
+ */
+ Boolean unpause(String id);
+
+
+ /**
+ * Live migrate a server.
+ *
+ * @param id id of the server
+ */
+ Boolean liveMigrate(String id, String host, boolean blockMigration, boolean diskOverCommit);
+
+ /**
+ * Inject network info into a server.
+ *
+ * @param id id of the server
+ */
+ Boolean injectNetworkInfo(String id);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminAsyncApi.java
new file mode 100644
index 0000000..1797a9d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerAdminAsyncApi.java
@@ -0,0 +1,175 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.BackupType;
+import org.jclouds.openstack.nova.v2_0.functions.ParseImageIdFromLocationHeader;
+import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.WrapWith;
+
+import com.google.common.annotations.Beta;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provide access to Admin Server Actions via REST API
+ *
+ * @author Adam Lowe
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ServerAdminApi
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
+@RequestFilters(AuthenticateRequest.class)
+@Path("/servers/{id}/action")
+public interface ServerAdminAsyncApi {
+
+ /**
+ * @see ServerAdminApi#suspend(String)
+ */
+ @Named("serveradmin:suspend")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"suspend\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> suspend(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#resume(String)
+ */
+ @Named("serveradmin:resume")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"resume\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> resume(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#migrate(String)
+ */
+ @Named("serveradmin:migrate")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"migrate\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> migrate(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#lock(String)
+ */
+ @Named("serveradmin:lock")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"lock\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> lock(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#unlock(String)
+ */
+ @Named("serveradmin:unlock")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"unlock\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> unlock(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#resetNetwork(String)
+ */
+ @Named("serveradmin:resetnetwork")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"resetNetwork\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> resetNetwork(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#createBackup
+ */
+ @Named("serveradmin:createbackup")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @WrapWith("createBackup")
+ @Fallback(MapHttp4xxCodesToExceptions.class)
+ @ResponseParser(ParseImageIdFromLocationHeader.class)
+ ListenableFuture<String> createBackup(@PathParam("id") String id,
+ @PayloadParam("name") String imageName,
+ @PayloadParam("backup_type") BackupType backupType,
+ @PayloadParam("rotation") int rotation,
+ CreateBackupOfServerOptions... options);
+
+ /**
+ * @see ServerAdminApi#pause(String)
+ */
+ @Named("serveradmin:pause")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"pause\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> pause(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#unpause(String)
+ */
+ @Named("serveradmin:unpause")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"unpause\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> unpause(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#injectNetworkInfo(String)
+ */
+ @Named("serveradmin:injectnetwork")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("{\"injectNetworkInfo\":null}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> injectNetworkInfo(@PathParam("id") String id);
+
+ /**
+ * @see ServerAdminApi#liveMigrate(String)
+ */
+ @Named("serveradmin:livemigrate")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ @WrapWith("os-migrateLive")
+ ListenableFuture<Boolean> liveMigrate(@PathParam("id") String id,
+ @PayloadParam("host") String host,
+ @PayloadParam("block_migration") boolean blockMigration,
+ @PayloadParam("disk_over_commit") boolean diskOverCommit);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApi.java
new file mode 100644
index 0000000..f9c91ae
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApi.java
@@ -0,0 +1,49 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Provides synchronous access to Server details including security group, referred to as the CREATESERVEREXT extension
+ * in the nova documentation
+ * <p/>
+ * NOTE: the equivalent to listServersInDetail() isn't available at the other end, so not extending ServerApi at this
+ * time.
+ *
+ * @author Adam Lowe
+ * @see org.jclouds.openstack.nova.v2_0.features.ServerApi
+ * @see ServerWithSecurityGroupsAsyncApi
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.createserverext.html"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.CREATESERVEREXT)
+public interface ServerWithSecurityGroupsApi {
+
+ /**
+ * Retrieve details of the specified server, including security groups
+ *
+ * @param id id of the server
+ * @return server or null if not found
+ */
+ ServerWithSecurityGroups get(String id);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java
new file mode 100644
index 0000000..069d39b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java
@@ -0,0 +1,62 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+import com.google.common.annotations.Beta;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides synchronous access to Servers with Security Groups.
+ *
+ * @author Adam Lowe
+ * @see org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi
+ * @see ServerWithSecurityGroupsApi
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.createserverext.html"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.CREATESERVEREXT)
+@RequestFilters(AuthenticateRequest.class)
+public interface ServerWithSecurityGroupsAsyncApi {
+
+ /**
+ * @see ServerWithSecurityGroupsApi#get(String)
+ */
+ @Named("server:get")
+ @GET
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/os-create-server-ext/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends ServerWithSecurityGroups> get(@PathParam("id") String id);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java
new file mode 100644
index 0000000..08a1852
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java
@@ -0,0 +1,50 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.SimpleTenantUsage;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides asynchronous access to Simple Tenant Usage via the REST API.
+ * <p/>
+ *
+ * @author Adam Lowe
+ * @see SimpleTenantUsageAsyncApi
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
+public interface SimpleTenantUsageApi {
+
+ /**
+ * Retrieve tenant_usage for all tenants
+ *
+ * @return the set of TenantUsage reports
+ */
+ FluentIterable<? extends SimpleTenantUsage> list();
+
+ /**
+ * Retrieve tenant_usage for a specified tenant
+ *
+ * @return the requested tenant usage
+ */
+ SimpleTenantUsage get(String tenantId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java
new file mode 100644
index 0000000..550d404
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java
@@ -0,0 +1,77 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.SimpleTenantUsage;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Simple Tenant Usage via the REST API.
+ * <p/>
+ *
+ * @author Adam Lowe
+ * @see SimpleTenantUsageApi
+ * @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html" />
+ * @see <a href="http://nova.openstack.org/api_ext" />
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.simple_tenant_usage.html" />
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
+@RequestFilters(AuthenticateRequest.class)
+public interface SimpleTenantUsageAsyncApi {
+
+ /**
+ * @see SimpleTenantUsageApi#list()
+ */
+ @Named("tenantusage:list")
+ @GET
+ @Path("/os-simple-tenant-usage")
+ @SelectJson("tenant_usages")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends SimpleTenantUsage>> list();
+
+ /**
+ * @see SimpleTenantUsageApi#get(String)
+ */
+ @Named("tenantusage:get")
+ @GET
+ @Path("/os-simple-tenant-usage/{id}")
+ @SelectJson("tenant_usage")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends SimpleTenantUsage> get(@PathParam("id") String tenantId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java
new file mode 100644
index 0000000..daf089f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java
@@ -0,0 +1,43 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.VirtualInterface;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides synchronous access to Virtual Interface features (VIFs).
+ *
+ * @see VirtualInterfaceAsyncApi
+ * @author Adam Lowe
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VIRTUAL_INTERFACES)
+public interface VirtualInterfaceApi {
+
+ /**
+ * Returns the list of Virtual Interfaces for a given instance.
+ *
+ * @return the list of snapshots
+ */
+ FluentIterable<? extends VirtualInterface> listOnServer(String serverId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java
new file mode 100644
index 0000000..c23228c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java
@@ -0,0 +1,59 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.VirtualInterface;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Virtual Interface features (VIFs).
+ *
+ * @see VirtualInterfaceApi
+ * @author Adam Lowe
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VIRTUAL_INTERFACES)
+@RequestFilters(AuthenticateRequest.class)
+public interface VirtualInterfaceAsyncApi {
+ /**
+ * @see VirtualInterfaceApi#listOnServer(String)
+ */
+ @Named("virtualinterface:list")
+ @GET
+ @SelectJson("virtual_interfaces")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/servers/{server_id}/os-virtual-interfaces")
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends VirtualInterface>> listOnServer(@PathParam("server_id") String serverId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java
new file mode 100644
index 0000000..f9ab865
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java
@@ -0,0 +1,147 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.Volume;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeSnapshot;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeOptions;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeSnapshotOptions;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides synchronous access to Volumes.
+ * <p/>
+ *
+ * @see VolumeAsyncApi
+ * @see org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi
+ * @author Adam Lowe
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUMES)
+public interface VolumeApi {
+ /**
+ * Returns a summary list of snapshots.
+ *
+ * @return the list of snapshots
+ */
+ FluentIterable<? extends Volume> list();
+
+ /**
+ * Returns a detailed list of volumes.
+ *
+ * @return the list of volumes.
+ */
+ FluentIterable<? extends Volume> listInDetail();
+
+ /**
+ * Return data about the given volume.
+ *
+ * @return details of a specific snapshot.
+ */
+ Volume get(String volumeId);
+
+ /**
+ * Creates a new Snapshot
+ *
+ * @return the new Snapshot
+ */
+ Volume create(int sizeGB, CreateVolumeOptions... options);
+
+ /**
+ * Delete a snapshot.
+ *
+ * @return true if successful
+ */
+ boolean delete(String volumeId);
+
+ /**
+ * List volume attachments for a given instance.
+ *
+ * @return all Floating IPs
+ * @deprecated To be removed in jclouds 1.7
+ * @see VolumeAttachmentApi#listAttachmentsOnServer(String)
+ */
+ @Deprecated FluentIterable<? extends VolumeAttachment> listAttachmentsOnServer(String serverId);
+
+ /**
+ * Get a specific attached volume.
+ *
+ * @return data about the given volume attachment.
+ * @deprecated To be removed in jclouds 1.7
+ * @see VolumeAttachmentApi#getAttachmentForVolumeOnServer(String, String)
+ */
+ @Deprecated VolumeAttachment getAttachmentForVolumeOnServer(String volumeId, String serverId);
+
+ /**
+ * Attach a volume to an instance
+ *
+ * @return data about the new volume attachment
+ * @deprecated To be removed in jclouds 1.7
+ * @see VolumeAttachmentApi#attachVolumeToServerAsDevice(String, String, String)
+ */
+ @Deprecated VolumeAttachment attachVolumeToServerAsDevice(String volumeId, String serverId, String device);
+
+ /**
+ * Detach a Volume from an instance.
+ *
+ * @return true if successful
+ * @deprecated To be removed in jclouds 1.7
+ * @see VolumeAttachmentApi#detachVolumeFromServer(String, String)
+ */
+ @Deprecated Boolean detachVolumeFromServer(String server_id, String volumeId);
+
+ /**
+ * Returns a summary list of snapshots.
+ *
+ * @return the list of snapshots
+ */
+ FluentIterable<? extends VolumeSnapshot> listSnapshots();
+
+ /**
+ * Returns a summary list of snapshots.
+ *
+ * @return the list of snapshots
+ */
+ FluentIterable<? extends VolumeSnapshot> listSnapshotsInDetail();
+
+ /**
+ * Return data about the given snapshot.
+ *
+ * @return details of a specific snapshot.
+ */
+ VolumeSnapshot getSnapshot(String snapshotId);
+
+ /**
+ * Creates a new Snapshot
+ *
+ * @return the new Snapshot
+ */
+ VolumeSnapshot createSnapshot(String volumeId, CreateVolumeSnapshotOptions... options);
+
+ /**
+ * Delete a snapshot.
+ *
+ * @return true if successful
+ */
+ boolean deleteSnapshot(String snapshotId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java
new file mode 100644
index 0000000..0e84604
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java
@@ -0,0 +1,254 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.Volume;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeSnapshot;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeOptions;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeSnapshotOptions;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.WrapWith;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides synchronous access to Volumes.
+ * <p/>
+ *
+ * @see org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi
+ * @author Adam Lowe
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUMES)
+@RequestFilters(AuthenticateRequest.class)
+public interface VolumeAsyncApi {
+ /**
+ * Returns a summary list of volumes.
+ *
+ * @return the list of volumes
+ */
+ @Named("volume:list")
+ @GET
+ @Path("/os-volumes")
+ @SelectJson("volumes")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends Volume>> list();
+
+ /**
+ * Returns a detailed list of volumes.
+ *
+ * @return the list of volumes.
+ */
+ @Named("volume:list")
+ @GET
+ @Path("/os-volumes/detail")
+ @SelectJson("volumes")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends Volume>> listInDetail();
+
+ /**
+ * Return data about the given volume.
+ *
+ * @return details of a specific volume.
+ */
+ @Named("volume:get")
+ @GET
+ @Path("/os-volumes/{id}")
+ @SelectJson("volume")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends Volume> get(@PathParam("id") String volumeId);
+
+ /**
+ * Creates a new volume
+ *
+ * @return the new Snapshot
+ */
+ @Named("volume:create")
+ @POST
+ @Path("/os-volumes")
+ @SelectJson("volume")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @MapBinder(CreateVolumeOptions.class)
+ ListenableFuture<? extends Volume> create(@PayloadParam("size") int sizeGB, CreateVolumeOptions... options);
+
+ /**
+ * Delete a volume.
+ *
+ * @return true if successful
+ */
+ @Named("volume:delete")
+ @DELETE
+ @Path("/os-volumes/{id}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> delete(@PathParam("id") String volumeId);
+
+ /**
+ * List volume attachments for a given instance.
+ *
+ * @return all Floating IPs
+ * @deprecated To be removed in jclouds 1.7
+ * @see VolumeAttachmentApi#listAttachmentsOnServer(String)
+ */
+ @Named("volume:listattachments")
+ @GET
+ @Path("/servers/{server_id}/os-volume_attachments")
+ @SelectJson("volumeAttachments")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ @Deprecated ListenableFuture<? extends FluentIterable<? extends VolumeAttachment>> listAttachmentsOnServer(@PathParam("server_id") String serverId);
+
+ /**
+ * Get a specific attached volume.
+ *
+ * @return data about the given volume attachment.
+ * @deprecated To be removed in jclouds 1.7
+ * @see VolumeAttachmentApi#getAttachmentForVolumeOnServer(String, String)
+ */
+ @Named("volume:getattachments")
+ @GET
+ @Path("/servers/{server_id}/os-volume_attachments/{id}")
+ @SelectJson("volumeAttachment")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Deprecated ListenableFuture<? extends VolumeAttachment> getAttachmentForVolumeOnServer(@PathParam("id") String volumeId,
+ @PathParam("server_id") String serverId);
+
+ /**
+ * Attach a volume to an instance
+ *
+ * @return the new Attachment
+ * @deprecated To be removed in jclouds 1.7
+ * @see VolumeAttachmentApi#attachVolumeToServerAsDevice(String, String, String)
+ */
+ @Named("volume:attach")
+ @POST
+ @Path("/servers/{server_id}/os-volume_attachments")
+ @SelectJson("volumeAttachment")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @WrapWith("volumeAttachment")
+ @Deprecated ListenableFuture<? extends VolumeAttachment> attachVolumeToServerAsDevice(@PayloadParam("volumeId") String volumeId,
+ @PathParam("server_id") String serverId, @PayloadParam("device") String device);
+
+ /**
+ * Detach a Volume from an instance.
+ *
+ * @return true if successful
+ * @deprecated To be removed in jclouds 1.7
+ * @see VolumeAttachmentApi#detachVolumeFromServer(String, String)
+ */
+ @Named("volume:detach")
+ @DELETE
+ @Path("/servers/{server_id}/os-volume_attachments/{id}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Deprecated ListenableFuture<Boolean> detachVolumeFromServer(@PathParam("id") String volumeId, @PathParam("server_id") String serverId);
+
+ /**
+ * Returns a summary list of snapshots.
+ *
+ * @return the list of snapshots
+ */
+ @Named("volume:listsnapshots")
+ @GET
+ @Path("/os-snapshots")
+ @SelectJson("snapshots")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends VolumeSnapshot>> listSnapshots();
+
+ /**
+ * Returns a summary list of snapshots.
+ *
+ * @return the list of snapshots
+ */
+ @Named("volume:listsnapshot")
+ @GET
+ @Path("/os-snapshots/detail")
+ @SelectJson("snapshots")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends VolumeSnapshot>> listSnapshotsInDetail();
+
+ /**
+ * Return data about the given snapshot.
+ *
+ * @return details of a specific snapshot.
+ */
+ @Named("volume:getsnapshot")
+ @GET
+ @Path("/os-snapshots/{id}")
+ @SelectJson("snapshot")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends VolumeSnapshot> getSnapshot(@PathParam("id") String snapshotId);
+
+ /**
+ * Creates a new Snapshot
+ *
+ * @return the new Snapshot
+ */
+ @Named("volume:createsnapshot")
+ @POST
+ @Path("/os-snapshots")
+ @SelectJson("snapshot")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @MapBinder(CreateVolumeSnapshotOptions.class)
+ ListenableFuture<? extends VolumeSnapshot> createSnapshot(@PayloadParam("volume_id") String volumeId, CreateVolumeSnapshotOptions... options);
+
+ /**
+ * Delete a snapshot.
+ *
+ * @return true if successful
+ */
+ @Named("volume:deletesnapshot")
+ @DELETE
+ @Path("/os-snapshots/{id}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> deleteSnapshot(@PathParam("id") String snapshotId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApi.java
new file mode 100644
index 0000000..273815e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApi.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.openstack.nova.v2_0.extensions;
+
+import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides synchronous access to Volume Attachments.
+ *
+ * This API strictly handles attaching Volumes to Servers. To create and manage Volumes you need to use one of the
+ * following APIs:
+ *
+ * 1. The Cinder API
+ * If your OpenStack deployment is Folsom or later and it supports the Cinder block storage service, use this API.
+ * @see org.jclouds.openstack.cinder.v1.features.VolumeApi
+ *
+ * 2. The nova-volume API
+ * If your OpenStack deployment is Essex or earlier and it supports the nova-volume extension, use this API.
+ * @see org.jclouds.openstack.nova.v2_0.extensions.VolumeApi
+ *
+ * @see VolumeAttachmentAsyncApi
+ * @author Everett Toews
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUMES)
+public interface VolumeAttachmentApi {
+ /**
+ * List Volume Attachments for a given Server.
+ *
+ * @param serverId The ID of the Server
+ * @return All VolumeAttachments for the Server
+ */
+ FluentIterable<? extends VolumeAttachment> listAttachmentsOnServer(String serverId);
+
+ /**
+ * Get a specific Volume Attachment for a Volume and Server.
+ *
+ * @param volumeId The ID of the Volume
+ * @param serverId The ID of the Server
+ * @return The Volume Attachment.
+ */
+ VolumeAttachment getAttachmentForVolumeOnServer(String volumeId, String serverId);
+
+ /**
+ * Attach a Volume to a Server.
+ *
+ * Note: If you are using KVM as your hypervisor then the actual device name in the Server will be different than
+ * the one specified. When the Server sees a new device, it picks the next available name (which in most cases is
+ * /dev/vdc) and the disk shows up there on the Server.
+ *
+ * @param serverId The ID of the Server
+ * @param volumeId The ID of the Volume
+ * @param device The name of the device this Volume will be identified as in the Server (e.g. /dev/vdc)
+ * @return The Volume Attachment.
+ */
+ VolumeAttachment attachVolumeToServerAsDevice(String volumeId, String serverId, String device);
+
+ /**
+ * Detach a Volume from a server.
+ *
+ * Note: Make sure you've unmounted the volume first. Failure to do so could result in failure or data loss.
+ *
+ * @param volumeId The ID of the Volume
+ * @param serverId The ID of the Server
+ * @return true if successful
+ */
+ boolean detachVolumeFromServer(String volumeId, String serverId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentAsyncApi.java
new file mode 100644
index 0000000..7aa5763
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentAsyncApi.java
@@ -0,0 +1,107 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.WrapWith;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Volume Attachments .
+ *
+ * @see VolumeAttachmentApi
+ * @author Everett Toews
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUMES)
+@RequestFilters(AuthenticateRequest.class)
+public interface VolumeAttachmentAsyncApi {
+ /**
+ * @see VolumeAttachmentApi#listAttachmentsOnServer(String)
+ */
+ @Named("volumeattachment:list")
+ @GET
+ @Path("/servers/{server_id}/os-volume_attachments")
+ @SelectJson("volumeAttachments")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends VolumeAttachment>> listAttachmentsOnServer(
+ @PathParam("server_id") String serverId);
+
+ /**
+ * @see VolumeAttachmentApi#getAttachmentForVolumeOnServer(String, String)
+ */
+ @Named("volumeattachment:get")
+ @GET
+ @Path("/servers/{server_id}/os-volume_attachments/{id}")
+ @SelectJson("volumeAttachment")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends VolumeAttachment> getAttachmentForVolumeOnServer(
+ @PathParam("id") String volumeId,
+ @PathParam("server_id") String serverId);
+
+ /**
+ * @see VolumeAttachmentApi#attachVolumeToServerAsDevice(String, String, String)
+ */
+ @Named("volumeattachment:attach")
+ @POST
+ @Path("/servers/{server_id}/os-volume_attachments")
+ @SelectJson("volumeAttachment")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @WrapWith("volumeAttachment")
+ ListenableFuture<? extends VolumeAttachment> attachVolumeToServerAsDevice(
+ @PayloadParam("volumeId") String volumeId,
+ @PathParam("server_id") String serverId,
+ @PayloadParam("device") String device);
+
+ /**
+ * @see VolumeAttachmentApi#detachVolumeFromServer(String, String)
+ */
+ @Named("volumeattachment:detach")
+ @DELETE
+ @Path("/servers/{server_id}/os-volume_attachments/{id}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> detachVolumeFromServer(
+ @PathParam("id") String volumeId,
+ @PathParam("server_id") String serverId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java
new file mode 100644
index 0000000..be0e5cc
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java
@@ -0,0 +1,101 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import java.util.Map;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeType;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeTypeOptions;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * Provides synchronous access to Volume Type features
+ *
+ * @author Adam Lowe
+ * @see VolumeApi
+ * @see VolumeTypeAsyncApi
+ * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.volumetypes.html"/>
+ * @see <a href="https://blueprints.launchpad.net/nova/+spec/volume-type"/>
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUME_TYPES)
+public interface VolumeTypeApi {
+
+ /**
+ * @return set of all volume types
+ */
+ FluentIterable<? extends VolumeType> list();
+
+ /**
+ * @param id the id of the volume type to retrieve
+ * @return the requested volume type
+ */
+ VolumeType get(String id);
+
+ /**
+ * Creates a new volume type
+ *
+ * @param name the name of the new volume type
+ * @param options optional settings for the new volume type
+ * @return the new volume type
+ */
+ VolumeType create(String name, CreateVolumeTypeOptions... options);
+
+ /**
+ * Deletes a volume type
+ */
+ boolean delete(String id);
+
+ /**
+ * @param id the id of the volume type
+ * @return the set of extra metadata for the flavor
+ */
+ Map<String, String> getExtraSpecs(String id);
+
+ /**
+ * Creates or updates the extra metadata for a given flavor
+ */
+ boolean updateExtraSpecs(String id, Map<String, String> specs);
+
+ /**
+ * Retrieve a single extra spec value
+ *
+ * @param id the id of the volume type
+ * @param key the key of the extra spec item to retrieve
+ */
+ String getExtraSpec(String id, String key);
+
+ /**
+ * Creates or updates a single extra spec value
+ *
+ * @param id the id of the volume type
+ * @param key the extra spec key (when creating ensure this does not include whitespace or other difficult characters)
+ * @param value the new value to store associate with the key
+ */
+ boolean updateExtraSpec(String id, String key, String value);
+
+ /**
+ * Deletes an existing extra spec
+ *
+ * @param id the id of the volume type
+ * @param key the key of the extra spec to delete
+ */
+ boolean deleteExtraSpec(String id, String key);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java
new file mode 100644
index 0000000..4312258
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java
@@ -0,0 +1,161 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeType;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeTypeOptions;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Unwrap;
+import org.jclouds.rest.annotations.WrapWith;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Volume Type features
+ *
+ * @author Adam Lowe
+ * @see VolumeTypeApi
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.VOLUME_TYPES)
+@RequestFilters(AuthenticateRequest.class)
+@Path("/os-volume-types")
+@Consumes(MediaType.APPLICATION_JSON)
+public interface VolumeTypeAsyncApi {
+
+ /**
+ * @see VolumeTypeApi#list
+ */
+ @Named("volumetype:list")
+ @GET
+ @SelectJson("volume_types")
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends FluentIterable<? extends VolumeType>> list();
+
+
+ /**
+ * @see VolumeTypeApi#get
+ */
+ @Named("volumetype:get")
+ @GET
+ @Path("/{id}")
+ @SelectJson("volume_type")
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends VolumeType> get(@PathParam("id") String id);
+
+ /**
+ * @see VolumeTypeApi#create
+ */
+ @Named("volumetype:create")
+ @POST
+ @SelectJson("volume_type")
+ @Produces(MediaType.APPLICATION_JSON)
+ @WrapWith("volume_type")
+ ListenableFuture<? extends VolumeType> create(@PayloadParam("name") String name, CreateVolumeTypeOptions... options);
+
+ /**
+ * @see VolumeTypeApi#delete
+ */
+ @Named("volumetype:delete")
+ @DELETE
+ @Path("/{id}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> delete(@PathParam("id") String id);
+
+ /**
+ * @see VolumeTypeApi#getExtraSpecs(String)
+ */
+ @Named("volumetype:getextraspecs")
+ @GET
+ @SelectJson("extra_specs")
+ @Path("/{id}/extra_specs")
+ @Fallback(EmptyMapOnNotFoundOr404.class)
+ ListenableFuture<Map<String, String>> getExtraSpecs(@PathParam("id") String id);
+
+ /**
+ * @see VolumeTypeApi#updateExtraSpecs(String, java.util.Map)
+ */
+ @Named("volumetype:udpateextraspecs")
+ @POST
+ @Path("/{id}/extra_specs")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Fallback(FalseOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ ListenableFuture<Boolean> updateExtraSpecs(@PathParam("id") String id, @PayloadParam("extra_specs") Map<String, String> specs);
+
+ /**
+ * @see VolumeTypeApi#getExtraSpec(String, String)
+ */
+ @Named("volumetype:getextraspec")
+ @GET
+ @Path("/{id}/extra_specs/{key}")
+ @Unwrap
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<String> getExtraSpec(@PathParam("id") String id, @PathParam("key") String key);
+
+ /**
+ * @see VolumeTypeApi#updateExtraSpec(String, String, String)
+ */
+ @Named("volumetype:updateextraspec")
+ @PUT
+ @Path("/{id}/extra_specs/{key}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Payload("%7B\"{key}\":\"{value}\"%7D")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> updateExtraSpec(@PathParam("id") String id,
+ @PathParam("key") @PayloadParam("key") String key,
+ @PayloadParam("value") String value);
+
+ /**
+ * @see VolumeTypeApi#deleteExtraSpec(String, String)
+ */
+ @Named("volumetype:deleteextraspec")
+ @DELETE
+ @Path("/{id}/extra_specs/{key}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ ListenableFuture<Boolean> deleteExtraSpec(@PathParam("id") String id,
+ @PathParam("key") String key);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java
new file mode 100644
index 0000000..7924120
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java
@@ -0,0 +1,78 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * Provides asynchronous access to Flavors via their REST API.
+ * <p/>
+ *
+ * @see FlavorAsyncApi
+ * @see <a href=
+ * "http://docs.openstack.org/api/openstack-compute/2/content/List_Flavors-d1e4188.html"
+ * />
+ * @author Jeremy Daggett, Ilja Bobkevic
+ */
+public interface FlavorApi {
+
+ /**
+ * List all flavors (IDs, names, links)
+ *
+ * @return all flavors (IDs, names, links)
+ */
+ PagedIterable<? extends Resource> list();
+
+ PaginatedCollection<? extends Resource> list(PaginationOptions options);
+
+ /**
+ * List all flavors (all details)
+ *
+ * @return all flavors (all details)
+ */
+ PagedIterable<? extends Flavor> listInDetail();
+
+ PaginatedCollection<? extends Flavor> listInDetail(PaginationOptions options);
+
+ /**
+ * List details of the specified flavor
+ *
+ * @param id
+ * id of the flavor
+ * @return flavor or null if not found
+ */
+ Flavor get(String id);
+
+ /**
+ * Create flavor according to the provided object
+ *
+ * @param flavor - flavor object
+ * @return newly created flavor
+ */
+ Flavor create(Flavor flavor);
+
+ /**
+ * Delete flavor with a given id
+ *
+ * @param id - flavor id
+ */
+ void delete(String id);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java
new file mode 100644
index 0000000..7c1552e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java
@@ -0,0 +1,144 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseFlavorDetails;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseFlavors;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.annotations.Unwrap;
+import org.jclouds.rest.annotations.WrapWith;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Provides asynchronous access to Flavors via their REST API.
+ * <p/>
+ *
+ * @see FlavorApi
+ * @see <a href=
+ * "http://docs.openstack.org/api/openstack-compute/2/content/List_Flavors-d1e4188.html"
+ * >docs</a>
+ * @author Jeremy Daggett TODO: Need a ListFlavorOptions class minDisk=minDiskInGB&
+ * minRam=minRamInMB& marker=markerID&limit=int
+ * @author Ilja Bobkevic
+ */
+@RequestFilters(AuthenticateRequest.class)
+public interface FlavorAsyncApi {
+
+ /**
+ * @see FlavorApi#list()
+ */
+ @Named("flavor:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/flavors")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseFlavors.class)
+ @Transform(ParseFlavors.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends PagedIterable<? extends Resource>> list();
+
+ /** @see FlavorApi#list(PaginationOptions) */
+ @Named("flavor:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/flavors")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseFlavors.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ ListenableFuture<? extends PaginatedCollection<? extends Resource>> list(PaginationOptions options);
+
+ /**
+ * @see FlavorApi#listInDetail()
+ */
+ @Named("flavor:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/flavors/detail")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseFlavorDetails.class)
+ @Transform(ParseFlavorDetails.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ ListenableFuture<? extends PagedIterable<? extends Flavor>> listInDetail();
+
+ /** @see FlavorApi#listInDetail(PaginationOptions) */
+ @Named("flavor:list")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/flavors/detail")
+ @RequestFilters(AuthenticateRequest.class)
+ @ResponseParser(ParseFlavorDetails.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ ListenableFuture<? extends PaginatedCollection<? extends Flavor>> listInDetail(PaginationOptions options);
+
+ /**
+ * @see FlavorApi#get
+ */
+ @Named("flavor:get")
+ @GET
+ @SelectJson("flavor")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/flavors/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ ListenableFuture<? extends Flavor> get(@PathParam("id") String id);
+
+
+ /**
+ * @see FlavorApi#create
+ */
+ @Named("flavor:create")
+ @POST
+ @Unwrap
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/flavors")
+ ListenableFuture<? extends Flavor> create(@WrapWith("flavor") Flavor flavor);
+
+ /**
+ * @see FlavorApi#delete
+ */
+ @Named("flavor:delete")
+ @DELETE
+ @Consumes
+ @Path("/flavors/{id}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ ListenableFuture<Void> delete(@PathParam("id") String id);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java
new file mode 100644
index 0000000..cc7f468
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java
@@ -0,0 +1,142 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import java.util.Map;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * Provides synchronous access to Images.
+ * <p/>
+ *
+ * @see ImageAsyncApi
+ * @see <a href=
+ * "http://docs.openstack.org/api/openstack-compute/1.1/content/Servers-d1e2073.html"
+ * />
+ * @author Adrian Cole
+ */
+public interface ImageApi {
+
+ /**
+ * List all images (IDs, names, links)
+ *
+ * @return all images (IDs, names, links)
+ */
+ PagedIterable<? extends Resource> list();
+
+ PaginatedCollection<? extends Resource> list(PaginationOptions options);
+
+ /**
+ * List all images (all details)
+ *
+ * @return all images (all details)
+ */
+ PagedIterable<? extends Image> listInDetail();
+
+ PaginatedCollection<? extends Image> listInDetail(PaginationOptions options);
+
+ /**
+ * List details of the specified image
+ *
+ * @param id
+ * id of the server
+ * @return server or null if not found
+ */
+ Image get(String id);
+
+ /**
+ * Delete the specified image
+ *
+ * @param id
+ * id of the image
+ * @return server or null if not found
+ */
+ void delete(String id);
+
+ /**
+ * List all metadata for an image.
+ *
+ * @param id
+ * id of the image
+ * @return the metadata as a Map<String, String>
+ */
+ Map<String, String> getMetadata(String id);
+
+ /**
+ * Sets the metadata for an image.
+ *
+ * @param id
+ * id of the image
+ * @param metadata
+ * a Map containing the metadata
+ * @return the metadata as a Map<String, String>
+ */
+ Map<String, String> setMetadata(String id, Map<String, String> metadata);
+
+ /**
+ * Update the metadata for a server.
+ *
+ * @param id
+ * id of the image
+ * @param metadata
+ * a Map containing the metadata
+ * @return the metadata as a Map<String, String>
+ */
+ Map<String, String> updateMetadata(String id, Map<String, String> metadata);
+
+ /**
+ * Update the metadata for an image.
+ *
+ * @param id
+ * id of the image
+ * @param metadata
+ * a Map containing the metadata
+ * @return the value or null if not present
+ */
+ @Nullable
+ String getMetadata(String id, String key);
+
+
+ /**
+ * Set a metadata item for an image.
+ *
+ * @param id
+ * id of the image
+ * @param key
+ * the name of the metadata item
+ * @param value
+ * the value of the metadata item
+ * @return the value you updated
+ */
+ String updateMetadata(String id, String key, String value);
+
+ /**
+ * Delete a metadata item from an image.
+ *
+ * @param id
+ * id of the image
+ * @param key
+ * the name of the metadata item
+ */
+ void deleteMetadata(String id, String key);
+
+}
[32/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_computeservice_typical.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_computeservice_typical.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_computeservice_typical.json
new file mode 100644
index 0000000..0da1902
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_computeservice_typical.json
@@ -0,0 +1,51 @@
+{
+ "security_group": {
+ "rules": [{
+ "from_port": 22,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 2769,
+ "ip_range": {
+ "cidr": "0.0.0.0/0"
+ },
+ "id": 10331
+ }, {
+ "from_port": 22,
+ "group": {
+ "tenant_id": "37936628937291",
+ "name": "jclouds_mygroup"
+ },
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 2769,
+ "ip_range": {},
+ "id": 10332
+ }, {
+ "from_port": 8080,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 8080,
+ "parent_group_id": 2769,
+ "ip_range": {
+ "cidr": "0.0.0.0/0"
+ },
+ "id": 10333
+ }, {
+ "from_port": 8080,
+ "group": {
+ "tenant_id": "37936628937291",
+ "name": "jclouds_mygroup"
+ },
+ "ip_protocol": "tcp",
+ "to_port": 8080,
+ "parent_group_id": 2769,
+ "ip_range": {},
+ "id": 10334
+ }],
+ "tenant_id": "37936628937291",
+ "id": 2769,
+ "name": "jclouds_mygroup",
+ "description": "jclouds_mygroup"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_extension.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_extension.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_extension.json
new file mode 100644
index 0000000..0c5b316
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_extension.json
@@ -0,0 +1,34 @@
+{
+ "security_group":
+ {
+ "rules": [
+ {
+ "from_port": 22,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 160,
+ "ip_range": {
+ "cidr": "10.2.6.0/24"
+ },
+ "id": 108
+ },
+ {
+ "from_port": 22,
+ "group": {
+ "tenant_id": "tenant0",
+ "name": "name0"
+ },
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 160,
+ "ip_range": {},
+ "id": 109
+ }
+ ],
+ "tenant_id": "tenant0",
+ "id": 160,
+ "name": "name0",
+ "description": "description0"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_extension_norules.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_extension_norules.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_extension_norules.json
new file mode 100644
index 0000000..27aca88
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_extension_norules.json
@@ -0,0 +1,10 @@
+{
+ "security_group":
+ {
+ "rules": [],
+ "tenant_id": "tenant0",
+ "id": 160,
+ "name": "name0",
+ "description": "description0"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_port22.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_port22.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_port22.json
new file mode 100644
index 0000000..5ee82bc
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_details_port22.json
@@ -0,0 +1,19 @@
+{
+ "security_group": {
+ "rules": [{
+ "from_port": 22,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 2769,
+ "ip_range": {
+ "cidr": "0.0.0.0/0"
+ },
+ "id": 10331
+ }],
+ "tenant_id": "37936628937291",
+ "id": 2769,
+ "name": "jclouds-test",
+ "description": "jclouds-test"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list.json
new file mode 100644
index 0000000..b5a1ed1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list.json
@@ -0,0 +1,51 @@
+{
+ "security_groups":[
+ {
+ "rules":[
+ {
+ "from_port":22,
+ "group":{
+
+ },
+ "ip_protocol":"tcp",
+ "to_port":22,
+ "parent_group_id":3,
+ "ip_range":{
+ "cidr":"0.0.0.0/0"
+ },
+ "id":107
+ },
+ {
+ "from_port":7600,
+ "group":{
+
+ },
+ "ip_protocol":"tcp",
+ "to_port":7600,
+ "parent_group_id":3,
+ "ip_range":{
+ "cidr":"0.0.0.0/0"
+ },
+ "id":118
+ },
+ {
+ "from_port":8084,
+ "group":{
+
+ },
+ "ip_protocol":"tcp",
+ "to_port":8084,
+ "parent_group_id":3,
+ "ip_range":{
+ "cidr":"0.0.0.0/0"
+ },
+ "id":119
+ }
+ ],
+ "tenant_id":"tenant1",
+ "id":1,
+ "name":"name1",
+ "description":"description1"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list_details_computeservice_typical.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list_details_computeservice_typical.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list_details_computeservice_typical.json
new file mode 100644
index 0000000..7e58c51
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list_details_computeservice_typical.json
@@ -0,0 +1,53 @@
+{
+ "security_groups":[
+ {
+ "rules": [{
+ "from_port": 22,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 2769,
+ "ip_range": {
+ "cidr": "0.0.0.0/0"
+ },
+ "id": 10331
+ }, {
+ "from_port": 22,
+ "group": {
+ "tenant_id": "37936628937291",
+ "name": "jclouds_mygroup"
+ },
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 2769,
+ "ip_range": {},
+ "id": 10332
+ }, {
+ "from_port": 8080,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 8080,
+ "parent_group_id": 2769,
+ "ip_range": {
+ "cidr": "0.0.0.0/0"
+ },
+ "id": 10333
+ }, {
+ "from_port": 8080,
+ "group": {
+ "tenant_id": "37936628937291",
+ "name": "jclouds_mygroup"
+ },
+ "ip_protocol": "tcp",
+ "to_port": 8080,
+ "parent_group_id": 2769,
+ "ip_range": {},
+ "id": 10334
+ }],
+ "tenant_id": "37936628937291",
+ "id": 2769,
+ "name": "jclouds_mygroup",
+ "description": "jclouds_mygroup"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list_extension.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list_extension.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list_extension.json
new file mode 100644
index 0000000..4a19a36
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygroup_list_extension.json
@@ -0,0 +1,51 @@
+{
+ "security_groups":[
+ {
+ "rules":[
+ {
+ "from_port":22,
+ "group":{
+
+ },
+ "ip_protocol":"tcp",
+ "to_port":22,
+ "parent_group_id":3,
+ "ip_range":{
+ "cidr":"0.0.0.0/0"
+ },
+ "id":107
+ },
+ {
+ "from_port":7600,
+ "group":{
+
+ },
+ "ip_protocol":"tcp",
+ "to_port":7600,
+ "parent_group_id":3,
+ "ip_range":{
+ "cidr":"0.0.0.0/0"
+ },
+ "id":118
+ },
+ {
+ "from_port":8084,
+ "group":{
+
+ },
+ "ip_protocol":"tcp",
+ "to_port":8084,
+ "parent_group_id":3,
+ "ip_range":{
+ "cidr":"0.0.0.0/0"
+ },
+ "id":119
+ }
+ ],
+ "tenant_id": "tenant0",
+ "id": 160,
+ "name": "name0",
+ "description": "description0"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created.json
new file mode 100644
index 0000000..1e8b9fd
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created.json
@@ -0,0 +1,12 @@
+{
+ "security_group_rule": {
+ "from_port": 80,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 8080,
+ "parent_group_id": 161,
+ "ip_range": {
+ "cidr": "0.0.0.0/0"
+ },
+ "id": 218 }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created_cidr.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created_cidr.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created_cidr.json
new file mode 100644
index 0000000..cc91ac7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created_cidr.json
@@ -0,0 +1,13 @@
+{
+ "security_group_rule": {
+ "from_port": 22,
+ "group": {},
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 160,
+ "ip_range": {
+ "cidr": "10.2.6.0/24"
+ },
+ "id": 108
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created_group.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created_group.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created_group.json
new file mode 100644
index 0000000..ff17bcd
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/securitygrouprule_created_group.json
@@ -0,0 +1,14 @@
+{
+ "security_group_rule": {
+ "from_port": 22,
+ "group": {
+ "tenant_id": "admin",
+ "name": "11111"
+ },
+ "ip_protocol": "tcp",
+ "to_port": 22,
+ "parent_group_id": 160,
+ "ip_range": {},
+ "id": 109
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details.json
new file mode 100644
index 0000000..f548785
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details.json
@@ -0,0 +1,86 @@
+{
+ "server": {
+ "id": "52415800-8b69-11e0-9b19-734f000004d2",
+ "tenant_id": "1234",
+ "user_id": "5678",
+ "name": "sample-f352",
+ "updated": "2010-10-10T12:00:00Z",
+ "created": "2010-08-10T12:00:00Z",
+ "hostId": "e4d909c290d0fb1ca068ffaddf22cbd0",
+ "accessIPv4" : "67.23.10.132",
+ "accessIPv6" : "::babe:67.23.10.132",
+ "status": "BUILD(scheduling)",
+ "progress": 60,
+ "OS-DCF:diskConfig": "AUTO",
+ "image" : {
+ "id": "52415800-8b69-11e0-9b19-734f6f006e54",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f6f006e54"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f6f006e54"
+ }
+ ]
+ },
+ "flavor" : {
+ "id": "52415800-8b69-11e0-9b19-734f216543fd",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd"
+ }
+ ]
+ },
+ "addresses": {
+ "public" : [
+ {
+ "version": 4,
+ "addr": "67.23.10.132"
+ },
+ {
+ "version": 6,
+ "addr": "::babe:67.23.10.132"
+ },
+ {
+ "version": 4,
+ "addr": "67.23.10.131"
+ },
+ {
+ "version": 6,
+ "addr": "::babe:4317:0A83"
+ }
+ ],
+ "private" : [
+ {
+ "version": 4,
+ "addr": "10.176.42.16"
+ },
+ {
+ "version": 6,
+ "addr": "::babe:10.176.42.16"
+ }
+ ]
+ },
+ "metadata": {
+ "Server Label": "Web Head 1",
+ "Image Version": "2.1"
+ },
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f6f006e54"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f6f006e54"
+ }
+ ]
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details_devstack.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details_devstack.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details_devstack.json
new file mode 100644
index 0000000..e41095f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details_devstack.json
@@ -0,0 +1,44 @@
+{"server": {
+ "OS-EXT-STS:task_state": null,
+ "addresses": {
+ "private": [{"version": 4, "addr": "10.0.0.8"}]
+ },
+ "links":
+ [
+ {
+ "href": "http://172.16.89.149:8774/v2/7f312675f9b84c97bff8f5054e181419/servers/141b775f-7ac1-45f0-9a95-146260f33a53", "rel": "self"
+ },
+ {
+ "href": "http://172.16.89.149:8774/7f312675f9b84c97bff8f5054e181419/servers/141b775f-7ac1-45f0-9a95-146260f33a53", "rel": "bookmark"
+ }
+ ],
+ "image": {
+ "id": "8e6f5bc4-a210-45b2-841f-c510eae14300", "links": [
+ {
+ "href": "http://172.16.89.149:8774/7f312675f9b84c97bff8f5054e181419/images/8e6f5bc4-a210-45b2-841f-c510eae14300", "rel": "bookmark"
+ }]
+ },
+ "OS-EXT-STS:vm_state": "paused",
+ "OS-EXT-SRV-ATTR:instance_name": "instance-00000014",
+ "flavor": {
+ "id": "1",
+ "links": [{"href": "http://172.16.89.149:8774/7f312675f9b84c97bff8f5054e181419/flavors/1", "rel": "bookmark"}]
+ },
+ "id": "141b775f-7ac1-45f0-9a95-146260f33a53",
+ "user_id": "89c01b67395d4bea945f7f5bfd7f344a",
+ "OS-DCF:diskConfig": "MANUAL",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "OS-EXT-STS:power_state": 3,
+ "config_drive": "",
+ "status": "PAUSED",
+ "updated": "2012-05-04T15:07:48Z",
+ "hostId": "eab9a77d1c44b8833e4a3dc6d2d9d50de556e780a319f184d8c82d9b",
+ "OS-EXT-SRV-ATTR:host": "ubuntu",
+ "key_name": "",
+ "OS-EXT-SRV-ATTR:hypervisor_hostname": null,
+ "name": "test",
+ "created": "2012-05-04T15:07:36Z",
+ "tenant_id": "7f312675f9b84c97bff8f5054e181419",
+ "metadata": {}
+}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details_openstack.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details_openstack.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details_openstack.json
new file mode 100644
index 0000000..10b7a7d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_details_openstack.json
@@ -0,0 +1,46 @@
+{
+ "server": {
+ "status": "ACTIVE",
+ "updated": "2012-03-23T01:30:26Z",
+ "hostId": "881706597197955ac7cc4b353bc7ec884e13fa280de9cc82057796cb",
+ "user_id": "508151008",
+ "name": "mygroup-72c",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/v1.1/37/servers/1459",
+ "rel": "self"
+ }, {
+ "href": "https://nova-api.openstack.org:9774/37/servers/1459",
+ "rel": "bookmark"
+ }],
+ "addresses": {
+ "internet": [{
+ "version": 4,
+ "addr": "8.21.28.47"
+ }]
+ },
+ "tenant_id": "37",
+ "image": {
+ "id": "14",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/37/images/14",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-23T01:30:26Z",
+ "uuid": "2443c9c7-9791-412e-ac09-a6d55ec25335",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": null,
+ "progress": 100,
+ "flavor": {
+ "id": "1",
+ "links": [{
+ "href": "https://nova-api.openstack.org:9774/37/flavors/1",
+ "rel": "bookmark"
+ }]
+ },
+ "config_drive": "",
+ "id": 1459,
+ "metadata": {}
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_diagnostics.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_diagnostics.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_diagnostics.json
new file mode 100644
index 0000000..d35988d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_diagnostics.json
@@ -0,0 +1,17 @@
+{
+ "vnet0_tx_errors": 0,
+ "vda_read": 77364736,
+ "vda_write": 415446016,
+ "vnet0_tx_packets": 9701,
+ "vda_write_req": 47278,
+ "cpu0_time": 143150000000,
+ "vnet0_tx": 1691221,
+ "vnet0_rx_drop": 0,
+ "vda_errors": -1,
+ "vnet0_rx_errors": 0,
+ "memory": 524288,
+ "vnet0_rx_packets": 11271,
+ "vda_read_req": 9551,
+ "vnet0_rx": 1805288,
+ "vnet0_tx_drop": 0
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list.json
new file mode 100644
index 0000000..aa6cf0d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list.json
@@ -0,0 +1,32 @@
+{
+ "servers": [
+ {
+ "id": "52415800-8b69-11e0-9b19-734f6af67565",
+ "name": "sample-server",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f6af67565"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f6af67565"
+ }
+ ]
+ },
+ {
+ "id": "52415800-8b69-11e0-9b19-734f1f1350e5",
+ "name": "sample-server2",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f1f1350e5"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f1f1350e5"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list_details.json
new file mode 100644
index 0000000..7ad6a75
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list_details.json
@@ -0,0 +1,79 @@
+{
+ "servers": [
+ {
+ "id": "52415800-8b69-11e0-9b19-734f000004d2",
+ "tenant_id": "1234",
+ "user_id": "5678",
+ "name": "sample-server",
+ "updated": "2010-10-10T12:00:00Z",
+ "created": "2010-08-10T12:00:00Z",
+ "hostId": "e4d909c290d0fb1ca068ffaddf22cbd0",
+ "accessIPv4" : "67.23.10.132",
+ "accessIPv6" : "::babe:67.23.10.132",
+ "status": "BUILD",
+ "progress": 60,
+ "image" : {
+ "id": "52415800-8b69-11e0-9b19-734f6f006e54",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f6f006e54"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f6f006e54"
+ }
+ ]
+ },
+ "flavor" : {
+ "id": "52415800-8b69-11e0-9b19-734f216543fd",
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd"
+ },
+ {
+ "rel": "bookmark",
+ "href": "http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd"
+ }
+ ]
+ },
+ "addresses": {
+ "public" : [
+ {
+ "version": 4,
+ "addr": "67.23.10.132"
+ },
+ {
+ "version": 6,
+ "addr": "::babe:67.23.10.132"
+ },
+ {
+ "version": 4,
+ "addr": "67.23.10.131"
+ },
+ {
+ "version": 6,
+ "addr": "::babe:4317:0A83"
+ }
+ ],
+ "private" : [
+ {
+ "version": 4,
+ "addr": "10.176.42.16"
+ },
+ {
+ "version": 6,
+ "addr": "::babe:10.176.42.16"
+ }
+ ]
+ },
+ "metadata": {
+ "Server Label": "Web Head 1",
+ "Image Version": "2.1"
+ },
+ "links": [
+ ]
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list_details_essex.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list_details_essex.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list_details_essex.json
new file mode 100644
index 0000000..9ca9445
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_list_details_essex.json
@@ -0,0 +1,152 @@
+{
+ "servers": [{
+ "OS-EXT-STS:task_state": null,
+ "addresses": {
+ "Net TenantA Front-Middle": [{
+ "version": 4,
+ "addr": "172.16.11.5"
+ }],
+ "Public network": [{
+ "version": 4,
+ "addr": "172.16.1.13"
+ }, {
+ "version": 4,
+ "addr": "10.193.112.119"
+ }]
+ },
+ "links": [{
+ "href": "http://nova:8774/v1.1/8d10e6646d5d4585937395b04839a353/servers/0c80b392-db30-4736-ae02-4480090f1207",
+ "rel": "self"
+ }, {
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/servers/0c80b392-db30-4736-ae02-4480090f1207",
+ "rel": "bookmark"
+ }],
+ "image": {
+ "id": "416af940-2d3c-4a7c-977c-a9030685ad5e",
+ "links": [{
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/images/416af940-2d3c-4a7c-977c-a9030685ad5e",
+ "rel": "bookmark"
+ }]
+ },
+ "OS-EXT-STS:vm_state": "active",
+ "flavor": {
+ "id": "1",
+ "links": [{
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/flavors/1",
+ "rel": "bookmark"
+ }]
+ },
+ "id": "0c80b392-db30-4736-ae02-4480090f1207",
+ "user_id": "df13814f6c354d00a8acf66502836323",
+ "OS-DCF:diskConfig": "MANUAL",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "progress": 0,
+ "OS-EXT-STS:power_state": 1,
+ "config_drive": "",
+ "status": "ACTIVE",
+ "updated": "2012-04-12T11:21:33Z",
+ "hostId": "03d796ebb52b1b555e5f6d9262f7dbd52b3f7c181e3aa89b34ca5408",
+ "key_name": "",
+ "name": "VM proxy",
+ "created": "2012-04-12T11:21:23Z",
+ "tenant_id": "8d10e6646d5d4585937395b04839a353",
+ "metadata": {}
+ }, {
+ "OS-EXT-STS:task_state": null,
+ "addresses": {
+ "Net TenantA Front-Middle": [{
+ "version": 4,
+ "addr": "172.16.11.4"
+ }],
+ "Net TenantA Middle-Back": [{
+ "version": 4,
+ "addr": "172.16.12.5"
+ }]
+ },
+ "links": [{
+ "href": "http://nova:8774/v1.1/8d10e6646d5d4585937395b04839a353/servers/b332b5cd-535e-4677-b68e-fc8badc13236",
+ "rel": "self"
+ }, {
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/servers/b332b5cd-535e-4677-b68e-fc8badc13236",
+ "rel": "bookmark"
+ }],
+ "image": {
+ "id": "416af940-2d3c-4a7c-977c-a9030685ad5e",
+ "links": [{
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/images/416af940-2d3c-4a7c-977c-a9030685ad5e",
+ "rel": "bookmark"
+ }]
+ },
+ "OS-EXT-STS:vm_state": "active",
+ "flavor": {
+ "id": "1",
+ "links": [{
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/flavors/1",
+ "rel": "bookmark"
+ }]
+ },
+ "id": "b332b5cd-535e-4677-b68e-fc8badc13236",
+ "user_id": "df13814f6c354d00a8acf66502836323",
+ "OS-DCF:diskConfig": "MANUAL",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "progress": 0,
+ "OS-EXT-STS:power_state": 1,
+ "config_drive": "",
+ "status": "ACTIVE",
+ "updated": "2012-04-12T11:18:58Z",
+ "hostId": "e5bbff80bebacfe1db63951e787b5341427060a602d33abfefb6a1bc",
+ "key_name": "",
+ "name": "VM blog",
+ "created": "2012-04-12T11:18:48Z",
+ "tenant_id": "8d10e6646d5d4585937395b04839a353",
+ "metadata": {}
+ }, {
+ "OS-EXT-STS:task_state": null,
+ "addresses": {
+ "Net TenantA Middle-Back": [{
+ "version": 4,
+ "addr": "172.16.12.4"
+ }]
+ },
+ "links": [{
+ "href": "http://nova:8774/v1.1/8d10e6646d5d4585937395b04839a353/servers/f9d43436-4572-4c9b-9b74-5fa6890a2f21",
+ "rel": "self"
+ }, {
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/servers/f9d43436-4572-4c9b-9b74-5fa6890a2f21",
+ "rel": "bookmark"
+ }],
+ "image": {
+ "id": "416af940-2d3c-4a7c-977c-a9030685ad5e",
+ "links": [{
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/images/416af940-2d3c-4a7c-977c-a9030685ad5e",
+ "rel": "bookmark"
+ }]
+ },
+ "OS-EXT-STS:vm_state": "active",
+ "flavor": {
+ "id": "1",
+ "links": [{
+ "href": "http://nova:8774/8d10e6646d5d4585937395b04839a353/flavors/1",
+ "rel": "bookmark"
+ }]
+ },
+ "id": "f9d43436-4572-4c9b-9b74-5fa6890a2f21",
+ "user_id": "df13814f6c354d00a8acf66502836323",
+ "OS-DCF:diskConfig": "MANUAL",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "progress": 0,
+ "OS-EXT-STS:power_state": 1,
+ "config_drive": "",
+ "status": "ACTIVE",
+ "updated": "2012-04-12T11:15:09Z",
+ "hostId": "03d796ebb52b1b555e5f6d9262f7dbd52b3f7c181e3aa89b34ca5408",
+ "key_name": "",
+ "name": "VM MySQL",
+ "created": "2012-04-12T11:14:56Z",
+ "tenant_id": "8d10e6646d5d4585937395b04839a353",
+ "metadata": {}
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_public_ip_in_private.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_public_ip_in_private.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_public_ip_in_private.json
new file mode 100644
index 0000000..5a5b84e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_public_ip_in_private.json
@@ -0,0 +1,51 @@
+{
+ "server": {
+ "status": "ACTIVE",
+ "updated": "2012-03-22T22:11:55Z",
+ "hostId": "cb0d9e5004bef8c21270a0b09f7624f4c387f3a523f3aaa4c5694a61",
+ "user_id": "54297837463082",
+ "name": "hpcloud-computes-38d",
+ "links": [{
+ "href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/59662",
+ "rel": "self"
+ }, {
+ "href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/59662",
+ "rel": "bookmark"
+ }],
+ "addresses": {
+ "private": [{
+ "version": 4,
+ "addr": "10.6.39.189"
+ }, {
+ "version": 4,
+ "addr": "15.185.181.94"
+ }]
+ },
+ "tenant_id": "37936628937291",
+ "image": {
+ "id": "229",
+ "links": [{
+ "href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/229",
+ "rel": "bookmark"
+ }]
+ },
+ "created": "2012-03-22T22:11:19Z",
+ "uuid": "7aed8e05-1daf-476a-87b2-640e8f7dcafd",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "key_name": "jclouds_hpcloud-computes_77",
+ "progress": 100,
+ "flavor": {
+ "id": "100",
+ "links": [{
+ "href": "https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100",
+ "rel": "bookmark"
+ }]
+ },
+ "config_drive": "",
+ "id": 59662,
+ "metadata": {
+ "Name": "hpcloud-computes"
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_with_security_groups.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_with_security_groups.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_with_security_groups.json
new file mode 100644
index 0000000..16e03fe
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_with_security_groups.json
@@ -0,0 +1 @@
+{"server": {"status": "ACTIVE", "updated": "2012-05-04T12:15:01Z", "hostId": "02c7c81e36024d2bfdb473cb762900138bc07777922479d3d4f8f690", "user_id": "1e8a56719e0d4ab4b7edb85c77f7290f", "name": "test", "links": [{"href": "http://172.16.89.148:8774/v2/4287930c796741aa898425f40832cb3c/servers/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb", "rel": "self"}, {"href": "http://172.16.89.148:8774/4287930c796741aa898425f40832cb3c/servers/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb", "rel": "bookmark"}], "created": "2012-05-04T12:14:57Z", "tenant_id": "4287930c796741aa898425f40832cb3c", "image": {"id": "ea17cc36-f7c9-40cd-b6bf-a952b74870f2", "links": [{"href": "http://172.16.89.148:8774/4287930c796741aa898425f40832cb3c/images/ea17cc36-f7c9-40cd-b6bf-a952b74870f2", "rel": "bookmark"}]}, "addresses": {"private": [{"version": 4, "addr": "10.0.0.8"}]}, "accessIPv4": "", "accessIPv6": "", "key_name": "", "progress": 0, "flavor": {"id": "1", "links": [{"href": "http://172.16.89.148:8774/4287930c796741aa898425f40832c
b3c/flavors/1", "rel": "bookmark"}]}, "config_drive": "", "id": "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb", "security_groups": [{"name": "default"},{"name": "group1"}], "metadata": {}}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_with_security_groups_extension.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_with_security_groups_extension.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_with_security_groups_extension.json
new file mode 100644
index 0000000..7a3c4b2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/server_with_security_groups_extension.json
@@ -0,0 +1 @@
+{"server": {"status": "ACTIVE", "updated": "2012-05-04T12:15:01Z", "hostId": "02c7c81e36024d2bfdb473cb762900138bc07777922479d3d4f8f690", "user_id": "1e8a56719e0d4ab4b7edb85c77f7290f", "name": "test", "links": [{"href": "http://172.16.89.148:8774/v2/4287930c796741aa898425f40832cb3c/servers/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb", "rel": "self"}, {"href": "http://172.16.89.148:8774/4287930c796741aa898425f40832cb3c/servers/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb", "rel": "bookmark"}], "created": "2012-05-04T12:14:57Z", "tenant_id": "4287930c796741aa898425f40832cb3c", "image": {"id": "ea17cc36-f7c9-40cd-b6bf-a952b74870f2", "links": [{"href": "http://172.16.89.148:8774/4287930c796741aa898425f40832cb3c/images/ea17cc36-f7c9-40cd-b6bf-a952b74870f2", "rel": "bookmark"}]}, "addresses": {"private": [{"version": 4, "addr": "10.0.0.8"}]}, "accessIPv4": "", "accessIPv6": "", "key_name": "", "progress": 0, "flavor": {"id": "1", "links": [{"href": "http://172.16.89.148:8774/4287930c796741aa898425f40832c
b3c/flavors/1", "rel": "bookmark"}]}, "config_drive": "", "id": "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb", "security_groups": [{"name": "name1"}], "metadata": {}}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/simple_tenant_usage.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/simple_tenant_usage.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/simple_tenant_usage.json
new file mode 100644
index 0000000..de07dc4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/simple_tenant_usage.json
@@ -0,0 +1 @@
+{"tenant_usage": {"total_memory_mb_usage": 0.0014847999999999999, "total_vcpus_usage": 7.249999999999999e-07, "total_hours": 4.833333333333333e-07, "tenant_id": "f8535069c3fb404cb61c873b1a0b4921", "stop": "2012-04-18 13:32:07.255830", "server_usages": [{"hours": 2.4166666666666665e-07, "uptime": 91149, "local_gb": 50, "ended_at": null, "name": "test1", "tenant_id": "f8535069c3fb404cb61c873b1a0b4921", "vcpus": 2, "memory_mb": 4096, "state": "active", "flavor": "m1.medium", "started_at": "2012-04-17 12:12:58"}, {"hours": 2.4166666666666665e-07, "uptime": 84710, "local_gb": 30, "ended_at": null, "name": "mish_test", "tenant_id": "f8535069c3fb404cb61c873b1a0b4921", "vcpus": 1, "memory_mb": 2048, "state": "active", "flavor": "m1.small", "started_at": "2012-04-17 14:00:17"}], "start": "2012-04-18 13:32:07.255743", "total_local_gb_usage": 1.933333333333333e-05}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/simple_tenant_usages.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/simple_tenant_usages.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/simple_tenant_usages.json
new file mode 100644
index 0000000..6f3c0d7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/simple_tenant_usages.json
@@ -0,0 +1 @@
+{"tenant_usages": [{"total_memory_mb_usage": 0.0015018666666666667, "total_vcpus_usage": 7.333333333333333e-07, "start": "2012-04-18 12:18:39.702411", "tenant_id": "f8535069c3fb404cb61c873b1a0b4921", "stop": "2012-04-18 12:18:39.702499", "total_hours": 4.888888888888889e-07, "total_local_gb_usage": 1.9555555555555557e-05}]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_details.json
new file mode 100644
index 0000000..375127b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_details.json
@@ -0,0 +1 @@
+{"snapshot": {"status": "available", "displayDescription": "jclouds live test snapshot", "displayName": "jclouds-live-test", "volumeId": 9, "id": 7, "createdAt": "2012-04-24 13:34:42", "size": 1}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_list.json
new file mode 100644
index 0000000..03980b1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_list.json
@@ -0,0 +1 @@
+{"snapshots": [{"status": "available", "displayDescription": "jclouds live test snapshot", "displayName": "jclouds-live-test", "volumeId": 9, "id": 7, "createdAt": "2012-04-24 13:34:42", "size": 1}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_list_detail.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_list_detail.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_list_detail.json
new file mode 100644
index 0000000..03980b1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/snapshot_list_detail.json
@@ -0,0 +1 @@
+{"snapshots": [{"status": "available", "displayDescription": "jclouds live test snapshot", "displayName": "jclouds-live-test", "volumeId": 9, "id": 7, "createdAt": "2012-04-24 13:34:42", "size": 1}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/virtual_interfaces_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/virtual_interfaces_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/virtual_interfaces_list.json
new file mode 100644
index 0000000..7df0182
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/virtual_interfaces_list.json
@@ -0,0 +1 @@
+{"virtual_interfaces": [{"id": "02315827-b05c-4668-9c05-75c68838074a", "mac_address": "fa:16:3e:09:71:34"}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_details.json
new file mode 100644
index 0000000..8dd11dc
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_details.json
@@ -0,0 +1 @@
+{"volume": {"status": "in-use", "displayDescription": "This is a test volume", "availabilityZone": "nova", "displayName": "test", "attachments": [{"device": "/dev/vdc", "serverId": "b4785058-cb80-491b-baa3-e4ee6546450e", "id": 1, "volumeId": 1}], "volumeType": null, "snapshotId": null, "size": 1, "id": 1, "createdAt": "2012-04-23 12:16:45", "metadata": {}}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_list.json
new file mode 100644
index 0000000..d2179e7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_list.json
@@ -0,0 +1 @@
+{"volumes": [{"status": "in-use", "displayDescription": "This is a test volume", "availabilityZone": "nova", "displayName": "test", "attachments": [{"device": "/dev/vdc", "serverId": "b4785058-cb80-491b-baa3-e4ee6546450e", "id": 1, "volumeId": 1}], "volumeType": null, "snapshotId": null, "size": 1, "id": 1, "createdAt": "2012-04-23 12:16:45", "metadata": {}}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_list_detail.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_list_detail.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_list_detail.json
new file mode 100644
index 0000000..d2179e7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_list_detail.json
@@ -0,0 +1 @@
+{"volumes": [{"status": "in-use", "displayDescription": "This is a test volume", "availabilityZone": "nova", "displayName": "test", "attachments": [{"device": "/dev/vdc", "serverId": "b4785058-cb80-491b-baa3-e4ee6546450e", "id": 1, "volumeId": 1}], "volumeType": null, "snapshotId": null, "size": 1, "id": 1, "createdAt": "2012-04-23 12:16:45", "metadata": {}}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type.json
new file mode 100644
index 0000000..8739d09
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type.json
@@ -0,0 +1,9 @@
+{"volume_type": {
+ "name": "jclouds-test-1",
+ "deleted": false,
+ "created_at": "2012-05-10 12:33:06",
+ "updated_at": null,
+ "extra_specs": {"test": "value1", "test1": "wibble"},
+ "deleted_at": null,
+ "id": 8
+}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type_extra_specs.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type_extra_specs.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type_extra_specs.json
new file mode 100644
index 0000000..6e71d5d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type_extra_specs.json
@@ -0,0 +1 @@
+{"extra_specs": {"test": "value1"}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type_list.json
new file mode 100644
index 0000000..3e613a3
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/volume_type_list.json
@@ -0,0 +1 @@
+{"volume_types": [{"name": "jclouds-test-1", "deleted": false, "created_at": "2012-05-10 12:33:06", "updated_at": null, "extra_specs": {"test": "value1", "test1": "wibble"}, "deleted_at": null, "id": 8}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/README.txt
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/README.txt b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/README.txt
new file mode 100755
index 0000000..b00a7af
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/README.txt
@@ -0,0 +1,6 @@
+#
+# The jclouds API for VMware vCloud (http://www.vmware.com/products/vcloud/).
+#
+# TODO: Implementation status.
+# TODO: Supported features.
+# TODO: Usage example.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/pom.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/pom.xml
new file mode 100755
index 0000000..400b0d1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-project</artifactId>
+ <version>1.7.1</version>
+ </parent>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>vcloud</artifactId>
+ <version>1.7.1-stratos</version>
+ <name>jclouds vcloud api</name>
+ <description>jclouds components to access an implementation of VMWare vCloud</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <jclouds.version>1.7.1</jclouds.version>
+ <test.vcloud.endpoint>FIXME</test.vcloud.endpoint>
+ <test.vcloud.api-version>1.0</test.vcloud.api-version>
+ <test.vcloud.build-version />
+ <test.vcloud.identity>FIXME</test.vcloud.identity>
+ <test.vcloud.credential>FIXME</test.vcloud.credential>
+ <test.vcloud.template />
+ <jclouds.osgi.export>org.jclouds.vcloud*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.compute.internal;version="${jclouds.version}",
+ org.jclouds.rest.internal;version="${jclouds.version}",
+ org.jclouds*;version="${jclouds.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.jamesmurty.utils</groupId>
+ <artifactId>java-xmlbuilder</artifactId>
+ <version>0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <test.vcloud.endpoint>${test.vcloud.endpoint}</test.vcloud.endpoint>
+ <test.vcloud.api-version>${test.vcloud.api-version}</test.vcloud.api-version>
+ <test.vcloud.build-version>${test.vcloud.build-version}</test.vcloud.build-version>
+ <test.vcloud.identity>${test.vcloud.identity}</test.vcloud.identity>
+ <test.vcloud.credential>${test.vcloud.credential}</test.vcloud.credential>
+ <test.vcloud.template>${test.vcloud.template}</test.vcloud.template>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java
new file mode 100755
index 0000000..ed152bc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java
@@ -0,0 +1,39 @@
+/*
+ * 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.vcloud;
+
+import org.jclouds.vcloud.domain.Task;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class TaskInErrorStateException extends RuntimeException {
+
+ private final Task task;
+
+ public TaskInErrorStateException(Task task) {
+ super("error on task: " + task + " error: " + task.getError());
+ this.task = task;
+ }
+
+ public Task getTask() {
+ return task;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java
new file mode 100755
index 0000000..2bc5b97
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java
@@ -0,0 +1,39 @@
+/*
+ * 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.vcloud;
+
+import org.jclouds.vcloud.domain.Task;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+public class TaskStillRunningException extends RuntimeException {
+
+ private final Task task;
+
+ public TaskStillRunningException(Task task) {
+ super("task still running: " + task);
+ this.task = task;
+ }
+
+ public Task getTask() {
+ return task;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApi.java
new file mode 100755
index 0000000..2112385
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApi.java
@@ -0,0 +1,91 @@
+/*
+ * 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.vcloud;
+
+import java.io.Closeable;
+
+import org.jclouds.rest.annotations.Delegate;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.vcloud.features.CatalogApi;
+import org.jclouds.vcloud.features.NetworkApi;
+import org.jclouds.vcloud.features.OrgApi;
+import org.jclouds.vcloud.features.TaskApi;
+import org.jclouds.vcloud.features.VAppApi;
+import org.jclouds.vcloud.features.VAppTemplateApi;
+import org.jclouds.vcloud.features.VDCApi;
+import org.jclouds.vcloud.features.VmApi;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+
+/**
+ * Provides access to VCloud resources via their REST API.
+ * <p/>
+ *
+ * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
+ * @author Adrian Cole
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VCloudApi extends Closeable {
+ /**
+ * Provides asynchronous access to VApp Template features.
+ *
+ */
+ @Delegate
+ VAppTemplateApi getVAppTemplateApi();
+
+ /**
+ * Provides synchronous access to VApp features.
+ */
+ @Delegate
+ VAppApi getVAppApi();
+
+ /**
+ * Provides synchronous access to Vm features.
+ */
+ @Delegate
+ VmApi getVmApi();
+
+ /**
+ * Provides synchronous access to Catalog features.
+ */
+ @Delegate
+ CatalogApi getCatalogApi();
+
+ /**
+ * Provides synchronous access to Task features.
+ */
+ @Delegate
+ TaskApi getTaskApi();
+
+ /**
+ * Provides synchronous access to VDC features.
+ */
+ @Delegate
+ VDCApi getVDCApi();
+
+ /**
+ * Provides synchronous access to Network features.
+ */
+ @Delegate
+ NetworkApi getNetworkApi();
+
+ /**
+ * Provides synchronous access to Org features.
+ */
+ @Delegate
+ OrgApi getOrgApi();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java
new file mode 100755
index 0000000..f605568
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.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.vcloud;
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
+import static org.jclouds.reflect.Reflection2.typeToken;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_VERSION_SCHEMA;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
+import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
+import org.jclouds.vcloud.config.VCloudHttpApiModule;
+import org.jclouds.vcloud.domain.network.FenceMode;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+
+/**
+ * Implementation of {@link ApiMetadata} for VCloud 1.0 API
+ *
+ * @author Adrian Cole
+ */
+public class VCloudApiMetadata extends BaseHttpApiMetadata<VCloudApi> {
+
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
+ }
+
+ public VCloudApiMetadata() {
+ this(new Builder());
+ }
+
+ protected VCloudApiMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
+ properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "1");
+ properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE,
+ String.format("http://www.vmware.com/vcloud/v${%s}", PROPERTY_VCLOUD_VERSION_SCHEMA));
+ properties.setProperty(PROPERTY_SESSION_INTERVAL, 8 * 60 + "");
+ properties.setProperty(PROPERTY_VCLOUD_XML_SCHEMA, "http://vcloud.safesecureweb.com/ns/vcloud.xsd");
+ properties.setProperty("jclouds.dns_name_length_min", "1");
+ properties.setProperty("jclouds.dns_name_length_max", "80");
+ properties.setProperty(PROPERTY_VCLOUD_DEFAULT_FENCEMODE, FenceMode.BRIDGED.toString());
+ // TODO integrate this with the {@link ComputeTimeouts} instead of having
+ // a single timeout for
+ // everything.
+ properties.setProperty(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED, 1200l * 1000l + "");
+ properties.setProperty(PROPERTY_SESSION_INTERVAL, 300 + "");
+ // CIM ostype does not include version info
+ properties.setProperty(TEMPLATE, "osFamily=UBUNTU,os64Bit=true");
+ return properties;
+ }
+
+ public static class Builder extends BaseHttpApiMetadata.Builder<VCloudApi, Builder> {
+ protected Builder() {
+ id("vcloud")
+ .name("VCloud 1.0 API")
+ .identityName("User at Organization (user@org)")
+ .credentialName("Password")
+ .documentation(URI.create("http://www.vmware.com/support/pubs/vcd_pubs.html"))
+ .version("1.0")
+ .defaultProperties(VCloudApiMetadata.defaultProperties())
+ .view(typeToken(ComputeServiceContext.class))
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(VCloudHttpApiModule.class, VCloudComputeServiceContextModule.class));
+ }
+
+ @Override
+ public VCloudApiMetadata build() {
+ return new VCloudApiMetadata(this);
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudMediaType.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
new file mode 100755
index 0000000..e670157
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
@@ -0,0 +1,221 @@
+/*
+ * 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.vcloud;
+
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Resource Types used in VCloud
+ *
+ * @see MediaType
+ */
+public interface VCloudMediaType {
+ /**
+ * "application/vnd.vmware.vcloud.error+xml"
+ */
+ public static final String ERROR_XML = "application/vnd.vmware.vcloud.error+xml";
+
+ /**
+ * "application/vnd.vmware.vcloud.error+xml"
+ */
+ public static final MediaType ERROR_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.error+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vcloud+xml"
+ */
+ public static final String VCLOUD_XML = "application/vnd.vmware.vcloud.vcloud+xml";
+
+ /**
+ * "application/vnd.vmware.vcloud.vcloud+xml"
+ */
+ public static final MediaType VCLOUD_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vcloud+xml");
+ /**
+ * "application/vnd.vmware.vcloud.orgList+xml"
+ */
+ public static final String ORGLIST_XML = "application/vnd.vmware.vcloud.orgList+xml";
+
+ /**
+ * "application/vnd.vmware.vcloud.orgList+xml"
+ */
+ public static final MediaType ORGLIST_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.orgList+xml");
+ /**
+ * "application/vnd.vmware.vcloud.org+xml"
+ */
+ public static final String ORG_XML = "application/vnd.vmware.vcloud.org+xml";
+ /**
+ * "application/vnd.vmware.vcloud.org+xml"
+ */
+ public static final MediaType ORG_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.org+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vdc+xml"
+ */
+ public static final String VDC_XML = "application/vnd.vmware.vcloud.vdc+xml";
+ /**
+ * "application/vnd.vmware.vcloud.vdc+xml"
+ */
+ public static final MediaType VDC_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vdc+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.catalog+xml"
+ */
+ public static final String CATALOG_XML = "application/vnd.vmware.vcloud.catalog+xml";
+ /**
+ * "application/vnd.vmware.vcloud.catalog+xml"
+ */
+ public static final MediaType CATALOG_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.catalog+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.tasksList+xml"
+ */
+ public static final String TASKSLIST_XML = "application/vnd.vmware.vcloud.tasksList+xml";
+ /**
+ * "application/vnd.vmware.vcloud.tasksList+xml"
+ */
+ public static final MediaType TASKSLIST_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.tasksList+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.catalogItem+xml"
+ */
+ public static final String CATALOGITEM_XML = "application/vnd.vmware.vcloud.catalogItem+xml";
+ /**
+ * "application/vnd.vmware.vcloud.catalogItem+xml"
+ */
+ public static final MediaType CATALOGITEM_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.catalogItem+xml");
+ /**
+ * "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ */
+ public static final String NETWORKCONNECTIONSECTION_XML = "application/vnd.vmware.vcloud.networkConnectionSection+xml";
+ /**
+ * "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ */
+ public static final MediaType NETWORKCONNECTIONSECTION_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.networkConnectionSection+xml");
+ /**
+ * "application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ */
+ public static final String VIRTUALHARDWARESECTION_XML = "application/vnd.vmware.vcloud.virtualHardwareSection+xml";
+ /**
+ * "application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ */
+ public static final MediaType VIRTUALHARDWARESECTION_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.virtualHardwareSection+xml");
+ /**
+ * "application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ */
+ public static final String GUESTCUSTOMIZATIONSECTION_XML = "application/vnd.vmware.vcloud.guestCustomizationSection+xml";
+ /**
+ * "application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ */
+ public static final MediaType GUESTCUSTOMIZATIONSECTION_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.guestCustomizationSection+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.networkSection+xml"
+ */
+ public static final String NETWORKSECTION_XML = "application/vnd.vmware.vcloud.networkSection+xml";
+ /**
+ * "application/vnd.vmware.vcloud.networkSection+xml"
+ */
+ public static final MediaType NETWORKSECTION_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.networkSection+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.task+xml"
+ */
+ public static final String TASK_XML = "application/vnd.vmware.vcloud.task+xml";
+ /**
+ * "application/vnd.vmware.vcloud.task+xml"
+ */
+ public static final MediaType TASK_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.task+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.undeployVAppParams+xml"
+ */
+ public static final String UNDEPLOYVAPPPARAMS_XML = "application/vnd.vmware.vcloud.undeployVAppParams+xml";
+ /**
+ * "application/vnd.vmware.vcloud.undeployVAppParams+xml"
+ */
+ public static final MediaType UNDEPLOYVAPPPARAMS_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.undeployVAppParams+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.deployVAppParams+xml"
+ */
+ public static final String DEPLOYVAPPPARAMS_XML = "application/vnd.vmware.vcloud.deployVAppParams+xml";
+ /**
+ * "application/vnd.vmware.vcloud.deployVAppParams+xml"
+ */
+ public static final MediaType DEPLOYVAPPPARAMS_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.deployVAppParams+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vApp+xml"
+ */
+ public static final String VAPP_XML = "application/vnd.vmware.vcloud.vApp+xml";
+ /**
+ * "application/vnd.vmware.vcloud.vApp+xml"
+ */
+ public static final MediaType VAPP_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vApp+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vm+xml"
+ */
+ public static final String VM_XML = "application/vnd.vmware.vcloud.vm+xml";
+ /**
+ * "application/vnd.vmware.vcloud.vm+xml"
+ */
+ public static final MediaType VM_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vm+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vAppTemplate+xml"
+ */
+ public static final String VAPPTEMPLATE_XML = "application/vnd.vmware.vcloud.vAppTemplate+xml";
+ /**
+ * "application/vnd.vmware.vcloud.vAppTemplate+xml"
+ */
+ public static final MediaType VAPPTEMPLATE_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.vAppTemplate+xml");
+ /**
+ * "application/vnd.vmware.vcloud.network+xml"
+ */
+ public static final String NETWORK_XML = "application/vnd.vmware.vcloud.network+xml";
+ /**
+ * "application/vnd.vmware.vcloud.network+xml"
+ */
+ public static final MediaType NETWORK_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.network+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.rasdItem+xml"
+ */
+ public static final String RASDITEM_XML = "application/vnd.vmware.vcloud.rasdItem+xml";
+ /**
+ * "application/vnd.vmware.vcloud.rasdItem+xml"
+ */
+ public static final MediaType RASDITEM_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.rasdItem+xml");
+ /**
+ * "application/vnd.vmware.vcloud.session+xml"
+ */
+ public static final String SESSION_XML = "application/vnd.vmware.vcloud.session+xml";
+
+ /**
+ * "application/vnd.vmware.vcloud.session+xml"
+ */
+ public static final MediaType SESSION_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.session+xml");
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudResponseException.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudResponseException.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudResponseException.java
new file mode 100755
index 0000000..0f94f9d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudResponseException.java
@@ -0,0 +1,69 @@
+/*
+ * 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.vcloud;
+
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.vcloud.domain.VCloudError;
+
+/**
+ * Encapsulates an VCloud Error.
+ *
+ * @author Adrian Cole
+ *
+ */
+public class VCloudResponseException extends HttpResponseException {
+
+ private org.jclouds.vcloud.domain.VCloudError error;
+
+ public VCloudResponseException(HttpCommand command, HttpResponse response, VCloudError error) {
+ super(String.format("request %s failed with code %s, error: %s", command.getCurrentRequest().getRequestLine(), response
+ .getStatusCode(), error.toString()), command, response);
+ this.setError(error);
+
+ }
+
+ public VCloudResponseException(HttpCommand command, HttpResponse response, VCloudError error, Throwable cause) {
+ super(String.format("request %1$s failed with error: %2$s", command.getCurrentRequest().getRequestLine(), error
+ .toString()), command, response, cause);
+ this.setError(error);
+
+ }
+
+ public VCloudResponseException(String message, HttpCommand command, HttpResponse response, VCloudError error) {
+ super(message, command, response);
+ this.setError(error);
+
+ }
+
+ public VCloudResponseException(String message, HttpCommand command, HttpResponse response, VCloudError error,
+ Throwable cause) {
+ super(message, command, response, cause);
+ this.setError(error);
+
+ }
+
+ public void setError(VCloudError error) {
+ this.error = error;
+ }
+
+ public VCloudError getError() {
+ return error;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudToken.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudToken.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudToken.java
new file mode 100755
index 0000000..1ef288e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudToken.java
@@ -0,0 +1,37 @@
+/*
+ * 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.vcloud;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * A VCloud Session Token
+ *
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface VCloudToken {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java
new file mode 100755
index 0000000..db22b1a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java
@@ -0,0 +1,38 @@
+/*
+ * 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.vcloud;
+
+import java.io.Closeable;
+import java.net.URI;
+import java.util.SortedMap;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.vcloud.xml.SupportedVersionsHandler;
+import org.jclouds.vcloud.http.filters.VCloudSupportedVersions;
+
+@RequestFilters(VCloudSupportedVersions.class)
+public interface VCloudVersionsApi extends Closeable {
+
+ @GET
+ @XMLResponseParser(SupportedVersionsHandler.class)
+ @Path("/versions")
+ SortedMap<String, URI> getSupportedVersions();
+}
[37/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiExpectTest.java
new file mode 100644
index 0000000..ab9be8d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiExpectTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.VirtualInterface;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests parsing and guice wiring of VirtualInterfaceApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "VirtualInterfaceApiLiveTest")
+public class VirtualInterfaceApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testListVirtualInterfaces() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/os-virtual-interfaces");
+ VirtualInterfaceApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/virtual_interfaces_list.json")).build()
+ ).getVirtualInterfaceExtensionForZone("az-1.region-a.geo-1").get();
+
+ VirtualInterface vif = Iterables.getOnlyElement(api.listOnServer("1"));
+ assertEquals(vif.getId(), "02315827-b05c-4668-9c05-75c68838074a");
+ assertEquals(vif.getMacAddress(), "fa:16:3e:09:71:34");
+ }
+
+ public void testListVirtualInterfacesFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/os-virtual-interfaces");
+ VirtualInterfaceApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVirtualInterfaceExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.listOnServer("1").isEmpty());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java
new file mode 100644
index 0000000..4f36035
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertNotNull;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.VirtualInterface;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of VirtualInterfaceApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "VirtualInterfaceApiLiveTest", singleThreaded = true)
+public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest {
+ private Optional<? extends VirtualInterfaceApi> apiOption;
+ private String zone;
+
+
+ @BeforeClass(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ apiOption = api.getVirtualInterfaceExtensionForZone(zone);
+ }
+
+ public void testListVirtualInterfaces() {
+ if (apiOption.isPresent()) {
+ Server testServer = null;
+ try {
+ testServer = createServerInZone(zone);
+ Set<? extends VirtualInterface> results = apiOption.get().listOnServer(testServer.getId()).toSet();
+ for (VirtualInterface vif : results) {
+ assertNotNull(vif.getId());
+ assertNotNull(vif.getMacAddress());
+ }
+ } finally {
+ if (testServer != null) {
+ api.getServerApiForZone(zone).delete(testServer.getId());
+ }
+ }
+ }
+}
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiExpectTest.java
new file mode 100644
index 0000000..c177ce2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiExpectTest.java
@@ -0,0 +1,460 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.DateService;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.Volume;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeSnapshot;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeOptions;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeSnapshotOptions;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests VolumeApi guice wiring and parsing
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "VolumeApiExpectTest")
+public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
+ private DateService dateService = new SimpleDateFormatDateService();
+
+ public void testListVolumes() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends Volume> volumes = api.list().toSet();
+ assertEquals(volumes, ImmutableSet.of(testVolume()));
+ }
+
+ public void testListVolumesFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends Volume> volumes = api.list().toSet();
+ assertTrue(volumes.isEmpty());
+ }
+
+ public void testListVolumesInDetail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/detail");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_detail.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends Volume> volumes = api.listInDetail().toSet();
+ assertEquals(volumes, ImmutableSet.of(testVolume()));
+ }
+
+ public void testListVolumesInDetailFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/detail");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends Volume> volumes = api.listInDetail().toSet();
+ assertTrue(volumes.isEmpty());
+ }
+
+ public void testCreateVolume() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint)
+ .method("POST")
+ .payload(payloadFromStringWithContentType("{\"volume\":{\"display_name\":\"jclouds-test-volume\",\"display_description\":\"description of test volume\",\"size\":1}}", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Volume volume = api.create(1, CreateVolumeOptions.Builder.name("jclouds-test-volume").description("description of test volume"));
+ assertEquals(volume, testVolume());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testCreateVolumeFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint)
+ .endpoint(endpoint)
+ .method("POST")
+ .payload(payloadFromStringWithContentType("{\"volume\":{\"display_name\":\"jclouds-test-volume\",\"display_description\":\"description of test volume\",\"size\":1}}", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(404).payload(payloadFromResource("/volume_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.create(1, CreateVolumeOptions.Builder.name("jclouds-test-volume").description("description of test volume"));
+ }
+
+ public void testGetVolume() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Volume volume = api.get("1");
+ assertEquals(volume, testVolume());
+ // double-check equals()
+ assertEquals(volume.getStatus(), Volume.Status.IN_USE);
+ assertEquals(volume.getDescription(), "This is a test volume");
+ assertEquals(volume.getZone(), "nova");
+ assertEquals(volume.getName(), "test");
+ assertEquals(volume.getStatus(), Volume.Status.IN_USE);
+ assertEquals(Iterables.getOnlyElement(volume.getAttachments()), testAttachment());
+ }
+
+ public void testGetVolumeFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertNull(api.get("1"));
+ }
+
+ public void testDeleteVolume() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.delete("1"));
+ }
+
+ public void testDeleteVolumeFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.delete("1"));
+ }
+
+ public void testListAttachments() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1").toSet();
+ assertEquals(attachments, ImmutableSet.of(testAttachment()));
+ // double-check individual fields
+ VolumeAttachment attachment = Iterables.getOnlyElement(attachments);
+ assertEquals(attachment.getDevice(), "/dev/vdc");
+ assertEquals(attachment.getServerId(), "b4785058-cb80-491b-baa3-e4ee6546450e");
+ assertEquals(attachment.getId(), "1");
+ assertEquals(attachment.getVolumeId(), "1");
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testListAttachmentsFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-2/os-volume_attachments");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(401).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.listAttachmentsOnServer("instance-2");
+ }
+
+ public void testGetAttachment() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeAttachment attachment = api.getAttachmentForVolumeOnServer("1", "instance-1");
+ assertEquals(attachment, testAttachment());
+ }
+
+ public void testGetAttachmentFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertNull(api.getAttachmentForVolumeOnServer("1", "instance-1"));
+ }
+
+ public void testAttachVolume() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"volumeAttachment\":{\"volumeId\":\"1\",\"device\":\"/dev/vdc\"}}", MediaType.APPLICATION_JSON)).endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeAttachment result = api.attachVolumeToServerAsDevice("1", "instance-1", "/dev/vdc");
+ assertEquals(result, testAttachment());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testAttachVolumeFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"volumeAttachment\":{\"volumeId\":\"1\",\"device\":\"/dev/vdc\"}}", MediaType.APPLICATION_JSON)).endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.attachVolumeToServerAsDevice("1", "instance-1","/dev/vdc");
+ }
+
+ public void testDetachVolume() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.detachVolumeFromServer("1", "instance-1"));
+ }
+
+ public void testDetachVolumeFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.detachVolumeFromServer("1", "instance-1"));
+ }
+
+ public void testListSnapshots() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends VolumeSnapshot> snapshots = api.listSnapshots().toSet();
+ assertEquals(snapshots, ImmutableSet.of(testSnapshot()));
+ }
+
+ public void testListSnapshotsFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends VolumeSnapshot> snapshots = api.listSnapshots().toSet();
+ assertTrue(snapshots.isEmpty());
+ }
+
+ public void testGetSnapshot() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeSnapshot snapshot = api.getSnapshot("1");
+ assertEquals(snapshot, testSnapshot());
+ }
+
+ public void testGetSnapshotFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertNull(api.getSnapshot("1"));
+ }
+
+ public void testListSnapshotsInDetail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/detail");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_detail.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toSet();
+ assertEquals(snapshots, ImmutableSet.of(testSnapshot()));
+
+ // double-check individual fields
+ VolumeSnapshot snappy = Iterables.getOnlyElement(snapshots);
+ assertEquals(snappy.getId(), "7");
+ assertEquals(snappy.getVolumeId(), "9");
+ assertEquals(snappy.getStatus(), Volume.Status.AVAILABLE);
+ assertEquals(snappy.getDescription(), "jclouds live test snapshot");
+ assertEquals(snappy.getName(), "jclouds-live-test");
+ assertEquals(snappy.getSize(), 1);
+ }
+
+ public void testListSnapshotsInDetailFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/detail");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toSet();
+ assertTrue(snapshots.isEmpty());
+ }
+
+ public void testCreateSnapshot() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint)
+ .method("POST")
+ .payload(payloadFromStringWithContentType("{\"snapshot\":{\"display_name\":\"jclouds-live-test\",\"volume_id\":\"13\",\"display_description\":\"jclouds live test snapshot\",\"force\":\"true\"}}", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeSnapshot snapshot = api.createSnapshot("13", CreateVolumeSnapshotOptions.Builder.name("jclouds-live-test").description("jclouds live test snapshot").force());
+ assertEquals(snapshot, testSnapshot());
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testCreateSnapshotFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint)
+ .method("POST")
+ .payload(payloadFromStringWithContentType("{\"snapshot\":{\"display_name\":\"jclouds-live-test\",\"volume_id\":\"13\",\"display_description\":\"jclouds live test snapshot\",\"force\":\"true\"}}", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(401).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.createSnapshot("13", CreateVolumeSnapshotOptions.Builder.name("jclouds-live-test").description("jclouds live test snapshot").force());
+ }
+
+ public void testDeleteSnapshot() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_details.json")).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.deleteSnapshot("1"));
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testDeleteSnapshotFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/1");
+ VolumeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(401).build()
+ ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.deleteSnapshot("1");
+ }
+
+ protected Volume testVolume() {
+ return Volume.builder().status(Volume.Status.IN_USE).description("This is a test volume").zone("nova").name("test")
+ .attachments(ImmutableSet.of(testAttachment())).size(1).id("1").created(dateService.iso8601SecondsDateParse("2012-04-23 12:16:45")).build();
+ }
+
+ protected VolumeAttachment testAttachment() {
+ return VolumeAttachment.builder().device("/dev/vdc").serverId("b4785058-cb80-491b-baa3-e4ee6546450e").id("1").volumeId("1").build();
+ }
+
+ protected VolumeSnapshot testSnapshot() {
+ return VolumeSnapshot.builder().id("7").volumeId("9").description("jclouds live test snapshot").status(Volume.Status.AVAILABLE)
+ .name("jclouds-live-test").size(1).created(dateService.iso8601SecondsDateParse("2012-04-24 13:34:42")).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java
new file mode 100644
index 0000000..a7f14ad
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java
@@ -0,0 +1,274 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.jclouds.util.Predicates2.retry;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.Volume;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeSnapshot;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeOptions;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeSnapshotOptions;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of VolumeApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "VolumeApiLiveTest", singleThreaded = true)
+public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
+
+ private Optional<? extends VolumeApi> volumeOption;
+ private String zone;
+
+ private Volume testVolume;
+ private VolumeSnapshot testSnapshot;
+
+ @BeforeClass(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ volumeOption = api.getVolumeExtensionForZone(zone);
+ }
+
+ @AfterClass(groups = { "integration", "live" })
+ @Override
+ protected void tearDown() {
+ if (volumeOption.isPresent()) {
+ if (testSnapshot != null) {
+ final String snapshotId = testSnapshot.getId();
+ assertTrue(volumeOption.get().deleteSnapshot(snapshotId));
+ assertTrue(retry(new Predicate<VolumeApi>() {
+ public boolean apply(VolumeApi volumeApi) {
+ return volumeOption.get().getSnapshot(snapshotId) == null;
+ }
+ }, 30 * 1000L).apply(volumeOption.get()));
+ }
+ if (testVolume != null) {
+ final String volumeId = testVolume.getId();
+ assertTrue(volumeOption.get().delete(volumeId));
+ assertTrue(retry(new Predicate<VolumeApi>() {
+ public boolean apply(VolumeApi volumeApi) {
+ return volumeOption.get().get(volumeId) == null;
+ }
+ }, 180 * 1000L).apply(volumeOption.get()));
+ }
+ }
+ super.tearDown();
+ }
+
+ public void testCreateVolume() {
+ if (volumeOption.isPresent()) {
+ testVolume = volumeOption.get().create(
+ 1,
+ CreateVolumeOptions.Builder.name("jclouds-test-volume").description("description of test volume")
+ .availabilityZone(zone));
+ assertTrue(retry(new Predicate<VolumeApi>() {
+ public boolean apply(VolumeApi volumeApi) {
+ return volumeOption.get().get(testVolume.getId()).getStatus() == Volume.Status.AVAILABLE;
+ }
+ }, 180 * 1000L).apply(volumeOption.get()));
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateVolume")
+ public void testListVolumes() {
+ if (volumeOption.isPresent()) {
+ Set<? extends Volume> volumes = volumeOption.get().list().toSet();
+ assertNotNull(volumes);
+ boolean foundIt = false;
+ for (Volume vol : volumes) {
+ Volume details = volumeOption.get().get(vol.getId());
+ assertNotNull(details);
+ if (Objects.equal(details.getId(), testVolume.getId())) {
+ foundIt = true;
+ }
+ }
+ assertTrue(foundIt, "Failed to find the volume we created in list() response");
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateVolume")
+ public void testListVolumesInDetail() {
+ if (volumeOption.isPresent()) {
+ Set<? extends Volume> volumes = volumeOption.get().listInDetail().toSet();
+ assertNotNull(volumes);
+ boolean foundIt = false;
+ for (Volume vol : volumes) {
+ Volume details = volumeOption.get().get(vol.getId());
+ assertNotNull(details);
+ assertNotNull(details.getId());
+ assertNotNull(details.getCreated());
+ assertTrue(details.getSize() > -1);
+
+ assertEquals(details.getId(), vol.getId());
+ assertEquals(details.getSize(), vol.getSize());
+ assertEquals(details.getName(), vol.getName());
+ assertEquals(details.getDescription(), vol.getDescription());
+ assertEquals(details.getCreated(), vol.getCreated());
+ if (Objects.equal(details.getId(), testVolume.getId())) {
+ foundIt = true;
+ }
+ }
+ assertTrue(foundIt, "Failed to find the volume we previously created in listInDetail() response");
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateVolume")
+ public void testCreateSnapshot() {
+ if (volumeOption.isPresent()) {
+ testSnapshot = volumeOption.get().createSnapshot(
+ testVolume.getId(),
+ CreateVolumeSnapshotOptions.Builder.name("jclouds-live-test").description(
+ "jclouds live test snapshot").force());
+ assertNotNull(testSnapshot);
+ assertNotNull(testSnapshot.getId());
+ final String snapshotId = testSnapshot.getId();
+ assertNotNull(testSnapshot.getStatus());
+ assertTrue(testSnapshot.getSize() > -1);
+ assertNotNull(testSnapshot.getCreated());
+
+ assertTrue(retry(new Predicate<VolumeApi>() {
+ public boolean apply(VolumeApi volumeApi) {
+ return volumeOption.get().getSnapshot(snapshotId).getStatus() == Volume.Status.AVAILABLE;
+ }
+ }, 30 * 1000L).apply(volumeOption.get()));
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateSnapshot")
+ public void testListSnapshots() {
+ if (volumeOption.isPresent()) {
+ Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshots().toSet();
+ assertNotNull(snapshots);
+ boolean foundIt = false;
+ for (VolumeSnapshot snap : snapshots) {
+ VolumeSnapshot details = volumeOption.get().getSnapshot(snap.getId());
+ if (Objects.equal(snap.getVolumeId(), testVolume.getId())) {
+ foundIt = true;
+ }
+ assertNotNull(details);
+ assertEquals(details.getId(), snap.getId());
+ assertEquals(details.getVolumeId(), snap.getVolumeId());
+ }
+ assertTrue(foundIt, "Failed to find the snapshot we previously created in listSnapshots() response");
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateSnapshot")
+ public void testListSnapshotsInDetail() {
+ if (volumeOption.isPresent()) {
+ Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshotsInDetail().toSet();
+ assertNotNull(snapshots);
+ boolean foundIt = false;
+ for (VolumeSnapshot snap : snapshots) {
+ VolumeSnapshot details = volumeOption.get().getSnapshot(snap.getId());
+ if (Objects.equal(snap.getVolumeId(), testVolume.getId())) {
+ foundIt = true;
+ assertSame(details, testSnapshot);
+ }
+ assertSame(details, snap);
+ }
+
+ assertTrue(foundIt, "Failed to find the snapshot we created in listSnapshotsInDetail() response");
+ }
+ }
+
+ private void assertSame(VolumeSnapshot a, VolumeSnapshot b) {
+ assertNotNull(a);
+ assertNotNull(b);
+ assertEquals(a.getId(), b.getId());
+ assertEquals(a.getDescription(), b.getDescription());
+ assertEquals(a.getName(), b.getName());
+ assertEquals(a.getVolumeId(), b.getVolumeId());
+ }
+
+ @Test(dependsOnMethods = "testCreateVolume")
+ public void testAttachments() {
+ if (volumeOption.isPresent()) {
+ String server_id = null;
+ try {
+ final String serverId = server_id = createServerInZone(zone).getId();
+
+ Set<? extends VolumeAttachment> attachments = volumeOption.get().listAttachmentsOnServer(serverId).toSet();
+ assertNotNull(attachments);
+ final int before = attachments.size();
+
+ VolumeAttachment testAttachment = volumeOption.get().attachVolumeToServerAsDevice(testVolume.getId(),
+ serverId, "/dev/vdf");
+ assertNotNull(testAttachment.getId());
+ assertEquals(testAttachment.getVolumeId(), testVolume.getId());
+
+ assertTrue(retry(new Predicate<VolumeApi>() {
+ public boolean apply(VolumeApi volumeApi) {
+ return volumeOption.get().listAttachmentsOnServer(serverId).size() > before;
+ }
+ }, 60 * 1000L).apply(volumeOption.get()));
+
+ attachments = volumeOption.get().listAttachmentsOnServer(serverId).toSet();
+ assertNotNull(attachments);
+ assertEquals(attachments.size(), before + 1);
+
+ assertEquals(volumeOption.get().get(testVolume.getId()).getStatus(), Volume.Status.IN_USE);
+
+ boolean foundIt = false;
+ for (VolumeAttachment att : attachments) {
+ VolumeAttachment details = volumeOption.get()
+ .getAttachmentForVolumeOnServer(att.getVolumeId(), serverId);
+ assertNotNull(details);
+ assertNotNull(details.getId());
+ assertNotNull(details.getServerId());
+ assertNotNull(details.getVolumeId());
+ if (Objects.equal(details.getVolumeId(), testVolume.getId())) {
+ foundIt = true;
+ assertEquals(details.getDevice(), "/dev/vdf");
+ assertEquals(details.getServerId(), serverId);
+ }
+ }
+
+ assertTrue(foundIt, "Failed to find the attachment we created in listAttachments() response");
+
+ volumeOption.get().detachVolumeFromServer(testVolume.getId(), serverId);
+ assertTrue(retry(new Predicate<VolumeApi>() {
+ public boolean apply(VolumeApi volumeApi) {
+ return volumeOption.get().listAttachmentsOnServer(serverId).size() == before;
+ }
+ }, 60 * 1000L).apply(volumeOption.get()));
+
+ } finally {
+ if (server_id != null)
+ api.getServerApiForZone(zone).delete(server_id);
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiExpectTest.java
new file mode 100644
index 0000000..1b4857d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiExpectTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.DateService;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.Volume;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests VolumeAttachmentApi Guice wiring and parsing
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "VolumeAttachmentApiExpectTest")
+public class VolumeAttachmentApiExpectTest extends BaseNovaApiExpectTest {
+ private DateService dateService = new SimpleDateFormatDateService();
+
+ public void testListAttachments() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
+ VolumeAttachmentApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build()
+ ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1").toSet();
+ assertEquals(attachments, ImmutableSet.of(testAttachment()));
+ // double-check individual fields
+ VolumeAttachment attachment = Iterables.getOnlyElement(attachments);
+ assertEquals(attachment.getDevice(), "/dev/vdc");
+ assertEquals(attachment.getServerId(), "b4785058-cb80-491b-baa3-e4ee6546450e");
+ assertEquals(attachment.getId(), "1");
+ assertEquals(attachment.getVolumeId(), "1");
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testListAttachmentsFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-2/os-volume_attachments");
+ VolumeAttachmentApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(401).build()
+ ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.listAttachmentsOnServer("instance-2");
+ }
+
+ public void testGetAttachment() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
+ VolumeAttachmentApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
+ ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeAttachment attachment = api.getAttachmentForVolumeOnServer("1", "instance-1");
+ assertEquals(attachment, testAttachment());
+ }
+
+ public void testGetAttachmentFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
+ VolumeAttachmentApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertNull(api.getAttachmentForVolumeOnServer("1", "instance-1"));
+ }
+
+ public void testAttachVolume() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
+ VolumeAttachmentApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"volumeAttachment\":{\"volumeId\":\"1\",\"device\":\"/dev/vdc\"}}", MediaType.APPLICATION_JSON)).endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
+ ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeAttachment result = api.attachVolumeToServerAsDevice("1", "instance-1", "/dev/vdc");
+ assertEquals(result, testAttachment());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testAttachVolumeFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
+ VolumeAttachmentApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"volumeAttachment\":{\"volumeId\":\"1\",\"device\":\"/dev/vdc\"}}", MediaType.APPLICATION_JSON)).endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
+
+ api.attachVolumeToServerAsDevice("1", "instance-1","/dev/vdc");
+ }
+
+ public void testDetachVolume() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
+ VolumeAttachmentApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
+ ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.detachVolumeFromServer("1", "instance-1"));
+ }
+
+ public void testDetachVolumeFail() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
+ VolumeAttachmentApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.detachVolumeFromServer("1", "instance-1"));
+ }
+
+ protected Volume testVolume() {
+ return Volume.builder().status(Volume.Status.IN_USE).description("This is a test volume").zone("nova").name("test")
+ .attachments(ImmutableSet.of(testAttachment())).size(1).id("1").created(dateService.iso8601SecondsDateParse("2012-04-23 12:16:45")).build();
+ }
+
+ protected VolumeAttachment testAttachment() {
+ return VolumeAttachment.builder().device("/dev/vdc").serverId("b4785058-cb80-491b-baa3-e4ee6546450e").id("1").volumeId("1").build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiLiveTest.java
new file mode 100644
index 0000000..cc853d8
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiLiveTest.java
@@ -0,0 +1,156 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.jclouds.util.Predicates2.retry;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.Volume;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeOptions;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of Volume Attachment API
+ *
+ * @author Everett Toews
+ */
+@Test(groups = "live", testName = "VolumeAttachmentApiLiveTest", singleThreaded = true)
+public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest {
+
+ private Optional<? extends VolumeApi> volumeApi;
+ private Optional<? extends VolumeAttachmentApi> volumeAttachmentApi;
+
+ private String zone;
+ private Volume testVolume;
+
+ @BeforeClass(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ volumeApi = api.getVolumeExtensionForZone(zone);
+ volumeAttachmentApi = api.getVolumeAttachmentExtensionForZone(zone);
+ }
+
+ @AfterClass(groups = { "integration", "live" })
+ @Override
+ protected void tearDown() {
+ if (volumeApi.isPresent()) {
+ if (testVolume != null) {
+ final String volumeId = testVolume.getId();
+ assertTrue(volumeApi.get().delete(volumeId));
+ assertTrue(retry(new Predicate<VolumeApi>() {
+ public boolean apply(VolumeApi volumeApi) {
+ return volumeApi.get(volumeId) == null;
+ }
+ }, 180 * 1000L).apply(volumeApi.get()));
+ }
+ }
+
+ super.tearDown();
+ }
+
+ public void testCreateVolume() {
+ if (volumeApi.isPresent()) {
+ CreateVolumeOptions options = CreateVolumeOptions.Builder
+ .name("jclouds-test-volume")
+ .description("description of test volume")
+ .availabilityZone(zone);
+
+ testVolume = volumeApi.get().create(1, options);
+ assertTrue(retry(new Predicate<VolumeApi>() {
+ public boolean apply(VolumeApi volumeApi) {
+ return volumeApi.get(testVolume.getId()).getStatus() == Volume.Status.AVAILABLE;
+ }
+ }, 180 * 1000L).apply(volumeApi.get()));
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateVolume")
+ public void testAttachments() {
+ if (volumeApi.isPresent()) {
+ String server_id = null;
+ try {
+ final String serverId = server_id = createServerInZone(zone).getId();
+
+ Set<? extends VolumeAttachment> attachments =
+ volumeAttachmentApi.get().listAttachmentsOnServer(serverId).toSet();
+ assertNotNull(attachments);
+ final int before = attachments.size();
+
+ VolumeAttachment testAttachment = volumeAttachmentApi.get().attachVolumeToServerAsDevice(
+ testVolume.getId(), serverId, "/dev/vdf");
+ assertNotNull(testAttachment.getId());
+ assertEquals(testAttachment.getVolumeId(), testVolume.getId());
+
+ assertTrue(retry(new Predicate<VolumeAttachmentApi>() {
+ public boolean apply(VolumeAttachmentApi volumeAttachmentApi) {
+ return volumeAttachmentApi.listAttachmentsOnServer(serverId).size() > before;
+ }
+ }, 60 * 1000L).apply(volumeAttachmentApi.get()));
+
+ attachments = volumeAttachmentApi.get().listAttachmentsOnServer(serverId).toSet();
+ assertNotNull(attachments);
+ assertEquals(attachments.size(), before + 1);
+
+ assertEquals(volumeApi.get().get(testVolume.getId()).getStatus(), Volume.Status.IN_USE);
+
+ boolean foundIt = false;
+ for (VolumeAttachment att : attachments) {
+ VolumeAttachment details = volumeAttachmentApi.get()
+ .getAttachmentForVolumeOnServer(att.getVolumeId(), serverId);
+ assertNotNull(details);
+ assertNotNull(details.getId());
+ assertNotNull(details.getServerId());
+ assertNotNull(details.getVolumeId());
+ if (Objects.equal(details.getVolumeId(), testVolume.getId())) {
+ foundIt = true;
+ assertEquals(details.getDevice(), "/dev/vdf");
+ assertEquals(details.getServerId(), serverId);
+ }
+ }
+
+ assertTrue(foundIt, "Failed to find the attachment we created in listAttachments() response");
+
+ volumeAttachmentApi.get().detachVolumeFromServer(testVolume.getId(), serverId);
+ assertTrue(retry(new Predicate<VolumeAttachmentApi>() {
+ public boolean apply(VolumeAttachmentApi volumeAttachmentApi) {
+ return volumeAttachmentApi.listAttachmentsOnServer(serverId).size() == before;
+ }
+ }, 60 * 1000L).apply(volumeAttachmentApi.get()));
+
+ } finally {
+ if (server_id != null)
+ api.getServerApiForZone(zone).delete(server_id);
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiExpectTest.java
new file mode 100644
index 0000000..36d8d0f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiExpectTest.java
@@ -0,0 +1,259 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.DateService;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.domain.VolumeType;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeTypeOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests guice wiring and parsing of VolumeTypeApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "VolumeTypeApiExpectTest")
+public class VolumeTypeApiExpectTest extends BaseNovaApiExpectTest {
+ private DateService dateService = new SimpleDateFormatDateService();
+
+ public void testListVolumeTypes() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_list.json")).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ Set<? extends VolumeType> types = api.list().toSet();
+ assertEquals(types, ImmutableSet.of(testVolumeType()));
+ }
+
+ public void testGetVolumeType() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/8");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type.json")).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeType type = api.get("8");
+ assertEquals(type, testVolumeType());
+ }
+
+ public void testGetVolumeTypeFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/8");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertNull(api.get("8"));
+ }
+
+ public void testCreateVolumeType() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"volume_type\":{\"name\":\"jclouds-test-1\"}}", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type.json")).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeType type = api.create("jclouds-test-1");
+ assertEquals(type, testVolumeType());
+ }
+
+ public void testCreateVolumeTypeWithOptsNONE() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"volume_type\":{\"name\":\"jclouds-test-1\",\"extra_specs\":{}}}", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type.json")).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeType type = api.create("jclouds-test-1", CreateVolumeTypeOptions.NONE);
+ assertEquals(type, testVolumeType());
+ }
+
+ public void testCreateVolumeTypeWithOptsSet() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("POST")
+ .payload(payloadFromStringWithContentType("{\"volume_type\":{\"name\":\"jclouds-test-1\",\"extra_specs\":{\"x\": \"y\"}}}", MediaType.APPLICATION_JSON))
+ .build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type.json")).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ VolumeType type = api.create("jclouds-test-1", CreateVolumeTypeOptions.Builder.specs(ImmutableMap.of("x", "y")));
+ assertEquals(type, testVolumeType());
+ }
+
+ public void testDeleteVolumeType() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/8");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.delete("8"));
+ }
+
+ public void testDeleteVolumeTypeFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/8");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.delete("8"));
+ }
+
+ public void testGetAllExtraSpecs() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/9/extra_specs");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_extra_specs.json")).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.getExtraSpecs("9"), ImmutableMap.of("test", "value1"));
+ }
+
+ public void testGetAllExtraSpecsFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/9/extra_specs");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.getExtraSpecs("9").isEmpty());
+ }
+
+ public void testSetAllExtraSpecs() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/9/extra_specs");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint)
+ .method("POST")
+ .payload(payloadFromStringWithContentType("{\"extra_specs\":{\"test1\":\"somevalue\"}}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.updateExtraSpecs("9", ImmutableMap.of("test1", "somevalue")));
+ }
+
+ public void testSetExtraSpec() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint)
+ .method("PUT")
+ .payload(payloadFromStringWithContentType("{\"test1\":\"somevalue\"}", MediaType.APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.updateExtraSpec("5", "test1", "somevalue"));
+ }
+
+ public void testGetExtraSpec() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"test1\":\"another value\"}", MediaType.APPLICATION_JSON)).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertEquals(api.getExtraSpec("5", "test1"), "another value");
+ }
+
+ public void testGetExtraSpecFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertNull(api.getExtraSpec("5", "test1"));
+ }
+
+ public void testDeleteExtraSpec() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertTrue(api.deleteExtraSpec("5", "test1"));
+ }
+
+ public void testDeleteExtraSpecFailNotFound() {
+ URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
+ VolumeTypeApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
+ authenticatedGET().endpoint(endpoint).method("DELETE").build(),
+ HttpResponse.builder().statusCode(404).build()
+ ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
+
+ assertFalse(api.deleteExtraSpec("5", "test1"));
+ }
+
+ public VolumeType testVolumeType() {
+ return VolumeType.builder().id("8").name("jclouds-test-1").created(dateService.iso8601SecondsDateParse("2012-05-10 12:33:06")).extraSpecs(ImmutableMap.of("test", "value1", "test1", "wibble")).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java
new file mode 100644
index 0000000..02b0f50
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.openstack.nova.v2_0.extensions;
+
+import static org.jclouds.util.Predicates2.retry;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.VolumeType;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateVolumeTypeOptions;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of VolumeTypeApi
+ *
+ * @author Adam Lowe
+ */
+@Test(groups = "live", testName = "VolumeTypeApiLiveTest", singleThreaded = true)
+public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest {
+
+ private Optional<? extends VolumeTypeApi> volumeTypeOption;
+ private String zone;
+
+ private VolumeType testVolumeType;
+
+ @BeforeGroups(groups = {"integration", "live"})
+ @Override
+ public void setup() {
+ super.setup();
+ zone = Iterables.getLast(api.getConfiguredZones(), "nova");
+ volumeTypeOption = api.getVolumeTypeExtensionForZone(zone);
+ }
+
+
+ @AfterClass(groups = { "integration", "live" })
+ @Override
+ protected void tearDown() {
+ if (volumeTypeOption.isPresent()) {
+ if (testVolumeType != null) {
+ final String id = testVolumeType.getId();
+ assertTrue(volumeTypeOption.get().delete(id));
+ assertTrue(retry(new Predicate<VolumeTypeApi>() {
+ public boolean apply(VolumeTypeApi volumeApi) {
+ return volumeApi.get(id) == null;
+ }
+ }, 5 * 1000L).apply(volumeTypeOption.get()));
+ }
+ }
+ super.tearDown();
+ }
+
+ public void testCreateVolumeType() {
+ if (volumeTypeOption.isPresent()) {
+ testVolumeType = volumeTypeOption.get().create(
+ "jclouds-test-1", CreateVolumeTypeOptions.Builder.specs(ImmutableMap.of("test", "value1")));
+ assertTrue(retry(new Predicate<VolumeTypeApi>() {
+ public boolean apply(VolumeTypeApi volumeTypeApi) {
+ return volumeTypeApi.get(testVolumeType.getId()) != null;
+ }
+ }, 180 * 1000L).apply(volumeTypeOption.get()));
+
+ assertEquals(volumeTypeOption.get().get(testVolumeType.getId()).getName(), "jclouds-test-1");
+ assertEquals(volumeTypeOption.get().get(testVolumeType.getId()).getExtraSpecs(), ImmutableMap.of("test", "value1"));
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateVolumeType")
+ public void testListVolumeTypes() {
+ if (volumeTypeOption.isPresent()) {
+ Set<? extends VolumeType> volumeTypes = volumeTypeOption.get().list().toSet();
+ assertNotNull(volumeTypes);
+ boolean foundIt = false;
+ for (VolumeType vt : volumeTypes) {
+ VolumeType details = volumeTypeOption.get().get(vt.getId());
+ assertNotNull(details);
+ if (Objects.equal(details.getId(), testVolumeType.getId())) {
+ foundIt = true;
+ }
+ }
+ assertTrue(foundIt, "Failed to find the volume type we created in list() response");
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateVolumeType")
+ public void testExtraSpecs() {
+ if (volumeTypeOption.isPresent()) {
+ assertEquals(volumeTypeOption.get().getExtraSpecs(testVolumeType.getId()), ImmutableMap.of("test", "value1"));
+ assertEquals(volumeTypeOption.get().getExtraSpec(testVolumeType.getId(), "test"), "value1");
+ assertTrue(volumeTypeOption.get().updateExtraSpecs(testVolumeType.getId(), ImmutableMap.of("test1", "wibble")));
+ }
+ }
+
+ @Test(dependsOnMethods = "testCreateVolumeType")
+ public void testUpdateIndividualSpec() {
+ if (volumeTypeOption.isPresent()) {
+ assertTrue(volumeTypeOption.get().updateExtraSpec(testVolumeType.getId(), "test1", "freddy"));
+ assertEquals(volumeTypeOption.get().getExtraSpec(testVolumeType.getId(), "test1"), "freddy");
+ }
+ }
+}
[36/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiExpectTest.java
new file mode 100644
index 0000000..4c91ec2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiExpectTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseExtensionListTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseExtensionTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests annotation parsing of {@code ExtensionAsyncApi}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ExtensionApiExpectTest")
+public class ExtensionApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testListExtensionsWhenResponseIs2xx() throws Exception {
+ HttpRequest listExtensions = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/extensions")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listExtensionsResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/extension_list.json")).build();
+
+ NovaApi apiWhenExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listExtensions, listExtensionsResponse);
+
+ assertEquals(apiWhenExtensionsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenExtensionsExist.getExtensionApiForZone("az-1.region-a.geo-1").list().toString(),
+ new ParseExtensionListTest().expected().toString());
+ }
+
+ public void testListExtensionsWhenReponseIs404IsEmpty() throws Exception {
+ HttpRequest listExtensions = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/extensions")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listExtensionsResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listExtensions, listExtensionsResponse);
+
+ assertTrue(apiWhenNoServersExist.getExtensionApiForZone("az-1.region-a.geo-1").list().isEmpty());
+ }
+
+ // TODO: gson deserializer for Multimap
+ public void testGetExtensionByAliasWhenResponseIs2xx() throws Exception {
+
+ HttpRequest getExtension = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/extensions/RS-PIE")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getExtensionResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/extension_details.json")).build();
+
+ NovaApi apiWhenExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getExtension, getExtensionResponse);
+
+ assertEquals(apiWhenExtensionsExist.getExtensionApiForZone("az-1.region-a.geo-1").get("RS-PIE")
+ .toString(), new ParseExtensionTest().expected().toString());
+ }
+
+ public void testGetExtensionByAliasWhenResponseIs404() throws Exception {
+ HttpRequest getExtension = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/extensions/RS-PIE")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getExtensionResponse = HttpResponse.builder().statusCode(404)
+ .payload(payloadFromResource("/extension_details.json")).build();
+
+ NovaApi apiWhenNoExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getExtension, getExtensionResponse);
+
+ assertNull(apiWhenNoExtensionsExist.getExtensionApiForZone("az-1.region-a.geo-1").get("RS-PIE"));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java
new file mode 100644
index 0000000..b81a761
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.v2_0.domain.Extension;
+import org.jclouds.openstack.v2_0.features.ExtensionApi;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@link ExtensionApi}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", testName = "ExtensionApiLiveTest")
+public class ExtensionApiLiveTest extends BaseNovaApiLiveTest {
+
+ /**
+ * Tests the listing of Extensions.
+ *
+ * @throws Exception
+ */
+ @Test(description = "GET /v${apiVersion}/{tenantId}/extensions")
+ public void testListExtensions() throws Exception {
+ for (String zoneId : zones) {
+ ExtensionApi extensionApi = api.getExtensionApiForZone(zoneId);
+ Set<? extends Extension> response = extensionApi.list();
+ assertNotNull(response);
+ assertFalse(response.isEmpty());
+ for (Extension extension : response) {
+ assertNotNull(extension.getId());
+ assertNotNull(extension.getName());
+ assertNotNull(extension.getDescription());
+ assertNotNull(extension.getNamespace());
+ assertNotNull(extension.getUpdated());
+ assertNotNull(extension.getLinks());
+ }
+ }
+ }
+
+ /**
+ * Tests retrieval of Extensions using their alias.
+ *
+ * @throws Exception
+ */
+ @Test(description = "GET /v${apiVersion}/{tenantId}/extensions/{alias}", dependsOnMethods = { "testListExtensions" })
+ public void testGetExtensionByAlias() throws Exception {
+ for (String zoneId : zones) {
+ ExtensionApi extensionApi = api.getExtensionApiForZone(zoneId);
+ Set<? extends Extension> response = extensionApi.list();
+ for (Extension extension : response) {
+ Extension details = extensionApi.get(extension.getId());
+ assertNotNull(details);
+ assertEquals(details.getId(), extension.getId());
+ assertEquals(details.getName(), extension.getName());
+ assertEquals(details.getDescription(), extension.getDescription());
+ assertEquals(details.getNamespace(), extension.getNamespace());
+ assertEquals(details.getUpdated(), extension.getUpdated());
+ assertEquals(details.getLinks(), extension.getLinks());
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiExpectTest.java
new file mode 100644
index 0000000..22af220
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiExpectTest.java
@@ -0,0 +1,164 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseCreateFlavorTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseFlavorListTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseFlavorTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests annotation parsing of {@code FlavorAsyncApi}
+ *
+ * @author Jeremy Daggett, Ilja Bobkevic
+ */
+@Test(groups = "unit", testName = "FlavorApiExpectTest")
+public class FlavorApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testListFlavorsWhenResponseIs2xx() throws Exception {
+ HttpRequest listFlavors = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listFlavorsResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/flavor_list.json")).build();
+
+ NovaApi apiWhenFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listFlavors, listFlavorsResponse);
+
+ assertEquals(apiWhenFlavorsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenFlavorsExist.getFlavorApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+ new ParseFlavorListTest().expected().toString());
+ }
+
+ public void testListFlavorsWhenReponseIs404IsEmpty() throws Exception {
+ HttpRequest listFlavors = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listFlavorsResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listFlavors, listFlavorsResponse);
+
+ assertTrue(apiWhenNoServersExist.getFlavorApiForZone("az-1.region-a.geo-1").list().concat().isEmpty());
+ }
+
+ // TODO: gson deserializer for Multimap
+ public void testGetFlavorWhenResponseIs2xx() throws Exception {
+
+ HttpRequest getFlavor = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/52415800-8b69-11e0-9b19-734f1195ff37")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getFlavorResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/flavor_details.json")).build();
+
+ NovaApi apiWhenFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getFlavor, getFlavorResponse);
+
+ assertEquals(
+ apiWhenFlavorsExist.getFlavorApiForZone("az-1.region-a.geo-1").get("52415800-8b69-11e0-9b19-734f1195ff37")
+ .toString(), new ParseFlavorTest().expected().toString());
+ }
+
+ public void testGetFlavorWhenResponseIs404() throws Exception {
+ HttpRequest getFlavor = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/123")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getFlavorResponse = HttpResponse.builder().statusCode(404)
+ .payload(payloadFromResource("/flavor_details.json")).build();
+
+ NovaApi apiWhenNoFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getFlavor, getFlavorResponse);
+
+ assertNull(apiWhenNoFlavorsExist.getFlavorApiForZone("az-1.region-a.geo-1").get("123"));
+
+ }
+
+ public void testCreateFlavor200() throws Exception {
+ ParseCreateFlavorTest parser = new ParseCreateFlavorTest();
+ HttpRequest listFlavors = HttpRequest
+ .builder()
+ .method(HttpMethod.POST)
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors")
+ .addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON)
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromResource(parser.resource())).build();
+
+ HttpResponse listFlavorsResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource(parser.resource())).build();
+
+ NovaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listFlavors, listFlavorsResponse);
+
+ assertEquals(
+ api.getFlavorApiForZone("az-1.region-a.geo-1").create(Flavor.builder()
+ .id("1cb47a44-9b84-4da4-bf81-c1976e8414ab")
+ .name("128 MB Server").ram(128).vcpus(1)
+ .disk(10).build())
+ .toString(), parser.expected().toString());
+ }
+
+ public void testDeleteFlavor202() throws Exception {
+ String flavorId = "1cb47a44-9b84-4da4-bf81-c1976e8414ab";
+
+ HttpRequest updateMetadata = HttpRequest
+ .builder()
+ .method(HttpMethod.DELETE)
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/" + flavorId)
+ .addHeader(HttpHeaders.ACCEPT, MediaType.WILDCARD)
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse updateMetadataResponse = HttpResponse.builder().statusCode(204).build();
+
+ NovaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, updateMetadata, updateMetadataResponse);
+
+ api.getFlavorApiForZone("az-1.region-a.geo-1").delete(flavorId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java
new file mode 100644
index 0000000..2af0d54
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.Flavor;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@link FlavorApi}
+ *
+ * @author Jeremy Daggett
+ */
+@Test(groups = "live", testName = "FlavorApiLiveTest")
+public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
+
+ /**
+ * Tests the listing of Flavors.
+ *
+ * @throws Exception
+ */
+ @Test(description = "GET /v${apiVersion}/{tenantId}/flavors")
+ public void testListFlavors() throws Exception {
+ for (String zoneId : zones) {
+ FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
+ Set<? extends Resource> response = flavorApi.list().concat().toSet();
+ assertNotNull(response);
+ assertFalse(response.isEmpty());
+ for (Resource flavor : response) {
+ assertNotNull(flavor.getId());
+ assertNotNull(flavor.getName());
+ assertNotNull(flavor.getLinks());
+ }
+ }
+ }
+
+ /**
+ * Tests the listing of Flavors in detail.
+ *
+ * @throws Exception
+ */
+ @Test(description = "GET /v${apiVersion}/{tenantId}/flavors/detail")
+ public void testListFlavorsInDetail() throws Exception {
+ for (String zoneId : zones) {
+ FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
+ Set<? extends Flavor> response = flavorApi.listInDetail().concat().toSet();
+ assertNotNull(response);
+ assertFalse(response.isEmpty());
+ for (Flavor flavor : response) {
+ assertNotNull(flavor.getId());
+ assertNotNull(flavor.getName());
+ assertNotNull(flavor.getLinks());
+ assertTrue(flavor.getRam() > 0);
+ assertTrue(flavor.getDisk() > 0);
+ assertTrue(flavor.getVcpus() > 0);
+ }
+ }
+ }
+
+ /**
+ * Tests getting Flavors by id.
+ *
+ * @throws Exception
+ */
+ @Test(description = "GET /v${apiVersion}/{tenantId}/flavors/{id}", dependsOnMethods = { "testListFlavorsInDetail" })
+ public void testGetFlavorById() throws Exception {
+ for (String zoneId : zones) {
+ FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
+ Set<? extends Flavor> response = flavorApi.listInDetail().concat().toSet();
+ for (Flavor flavor : response) {
+ Flavor details = flavorApi.get(flavor.getId());
+ assertNotNull(details);
+ assertEquals(details.getId(), flavor.getId());
+ assertEquals(details.getName(), flavor.getName());
+ assertEquals(details.getLinks(), flavor.getLinks());
+ assertEquals(details.getRam(), flavor.getRam());
+ assertEquals(details.getDisk(), flavor.getDisk());
+ assertEquals(details.getVcpus(), flavor.getVcpus());
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiExpectTest.java
new file mode 100644
index 0000000..85407d1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiExpectTest.java
@@ -0,0 +1,377 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseImageListTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseImageTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseMetadataListTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseMetadataUpdateTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests annotation parsing of {@code ImageAsyncApi}
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "ImageAsyncApiTest")
+public class ImageApiExpectTest extends BaseNovaApiExpectTest {
+ public void testListImagesWhenResponseIs2xx() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/image_list.json")).build();
+
+ NovaApi apiWhenImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, list, listResponse);
+
+ assertEquals(apiWhenImagesExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenImagesExist.getImageApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+ new ParseImageListTest().expected().toString());
+ }
+
+ public void testListImagesWhenReponseIs404IsEmpty() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, list, listResponse);
+
+ assertTrue(apiWhenNoServersExist.getImageApiForZone("az-1.region-a.geo-1").list().concat().isEmpty());
+ }
+
+ public void testGetImageWhenResponseIs2xx() throws Exception {
+
+ HttpRequest getImage = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/52415800-8b69-11e0-9b19-734f5736d2a2")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getImageResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/image_details.json")).build();
+
+ NovaApi apiWhenImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getImage, getImageResponse);
+
+ assertEquals(
+ apiWhenImagesExist.getImageApiForZone("az-1.region-a.geo-1").get("52415800-8b69-11e0-9b19-734f5736d2a2")
+ .toString(), new ParseImageTest().expected().toString());
+ }
+
+ public void testGetImageWhenResponseIs404() throws Exception {
+ HttpRequest getImage = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/52415800-8b69-11e0-9b19-734f5736d2a2")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getImageResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getImage, getImageResponse);
+
+ assertNull(apiWhenNoImagesExist.getImageApiForZone("az-1.region-a.geo-1").get(
+ "52415800-8b69-11e0-9b19-734f5736d2a2"));
+
+ }
+
+ public void testListMetadataWhenResponseIs2xx() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ HttpRequest getMetadata = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/metadata_list.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getMetadata, getMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getImageApiForZone("az-1.region-a.geo-1").getMetadata(imageId).toString(),
+ new ParseMetadataListTest().expected().toString());
+ }
+
+ public void testListMetadataWhenResponseIs404() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ HttpRequest getMetadata = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getMetadata, getMetadataResponse);
+
+ try {
+ apiWhenServerExists.getImageApiForZone("az-1.region-a.geo-1").getMetadata(imageId);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testSetMetadataWhenResponseIs2xx() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 1")
+ .put("Image Version", "2.1")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("PUT")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 1\",\"Image Version\":\"2.1\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/metadata_list.json")).build();
+
+ NovaApi apiWhenImageExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ assertEquals(apiWhenImageExists.getImageApiForZone("az-1.region-a.geo-1").setMetadata(imageId, metadata).toString(),
+ new ParseMetadataListTest().expected().toString());
+ }
+
+ public void testSetMetadataWhenResponseIs404() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 1")
+ .put("Image Version", "2.1")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("PUT")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" +imageId + "/metadata")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 1\",\"Image Version\":\"2.1\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ try {
+ apiWhenServerExists.getImageApiForZone("az-1.region-a.geo-1").setMetadata(imageId, metadata);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testUpdateMetadataWhenResponseIs2xx() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 2")
+ .put("Server Description", "Simple Server")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 2\",\"Server Description\":\"Simple Server\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/metadata_updated.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getImageApiForZone("az-1.region-a.geo-1").updateMetadata(imageId, metadata).toString(),
+ new ParseMetadataUpdateTest().expected().toString());
+ }
+
+ public void testUpdateMetadataWhenResponseIs404() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 2")
+ .put("Server Description", "Simple Server")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + imageId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 2\",\"Server Description\":\"Simple Server\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404)
+ .payload(payloadFromResource("/metadata_updated.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ try {
+ apiWhenServerExists.getImageApiForZone("az-1.region-a.geo-1").setMetadata(imageId, metadata);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testGetMetadataItemWhenResponseIs2xx() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ String key = "Image%20Version";
+
+ HttpRequest getMetadata = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata/" + key)
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromString("{\"metadata\":{\"Image Version\":\"2.5\"}}")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getMetadata, getMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getImageApiForZone("az-1.region-a.geo-1").getMetadata(imageId, "Image Version").toString(),
+ "2.5");
+ }
+
+ public void testGetMetadataItemWhenResponseIs404() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ String key = "Image%20Version";
+
+ HttpRequest getMetadata = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata/" + key)
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(404)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Image Version\":\"2.5\"}}", "application/json")).build();
+
+ NovaApi apiWhenImageExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getMetadata, getMetadataResponse);
+
+ assertNull(apiWhenImageExists.getImageApiForZone("az-1.region-a.geo-1").getMetadata(imageId, key));
+ }
+
+ public void testSetMetadataItemWhenResponseIs2xx() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ String key = "Image Version";
+
+ HttpRequest updateMetadata = HttpRequest
+ .builder()
+ .method("PUT")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata/" + "Image%20Version")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Image Version\":\"2.5\"}}", "application/json"))
+ .build();
+
+ HttpResponse updateMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Image Version\":\"2.5\"}}", "application/json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, updateMetadata, updateMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getImageApiForZone("az-1.region-a.geo-1").updateMetadata(imageId, key, "2.5").toString(),
+ "2.5");
+ }
+
+ public void testDeleteMetadataItemWhenResponseIs2xx() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ String key = "Image%20Version";
+
+ HttpRequest deleteMetadata = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata/" + key)
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse deleteMetadataResponse = HttpResponse.builder().statusCode(204).build();
+
+ NovaApi apiWhenImageExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, deleteMetadata, deleteMetadataResponse);
+
+ apiWhenImageExists.getImageApiForZone("az-1.region-a.geo-1").deleteMetadata(imageId, key);
+ }
+
+ public void testDeleteMetadataItemWhenResponseIs404() throws Exception {
+ String imageId = "52415800-8b69-11e0-9b19-734f5736d2a2";
+ String key = "Image%20Version";
+
+ HttpRequest deleteMetadata = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata/" + key)
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse deleteMetadataResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenImageExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, deleteMetadata, deleteMetadataResponse);
+
+ apiWhenImageExists.getImageApiForZone("az-1.region-a.geo-1").deleteMetadata(imageId, key);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java
new file mode 100644
index 0000000..83d0b62
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@link ImageApi}
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "live", testName = "ImageApiLiveTest")
+public class ImageApiLiveTest extends BaseNovaApiLiveTest {
+
+ @Test(description = "GET /v${apiVersion}/{tenantId}/images")
+ public void testListImages() throws Exception {
+ for (String zoneId : zones) {
+ ImageApi imageApi = api.getImageApiForZone(zoneId);
+ Set<? extends Resource> response = imageApi.list().concat().toSet();
+ assertNotNull(response);
+ assertFalse(response.isEmpty());
+ for (Resource image : response) {
+ assertNotNull(image.getId());
+ assertNotNull(image.getName());
+ assertNotNull(image.getLinks());
+ }
+ }
+ }
+
+ @Test(description = "GET /v${apiVersion}/{tenantId}/images/detail")
+ public void testListImagesInDetail() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ ImageApi imageApi = api.getImageApiForZone(zoneId);
+ Set<? extends Image> response = imageApi.listInDetail().concat().toSet();
+ assertNotNull(response);
+ assertFalse(response.isEmpty());
+ for (Image image : response) {
+ assertNotNull(image.getId());
+ assertNotNull(image.getName());
+ assertNotNull(image.getLinks());
+ assertNotNull(image.getCreated());
+ // image.getMinDisk() can be zero
+ // image.getMinRam() can be zero
+ assertTrue(image.getProgress() >= 0 && image.getProgress() <= 100);
+ assertNotNull(image.getStatus());
+ // image.getServer() can be null
+ // image.getTenantId() can be null
+ // image.getUpdated() can be null
+ // image.getUserId() can be null
+ }
+ }
+ }
+
+ @Test(description = "GET /v${apiVersion}/{tenantId}/images/{id}", dependsOnMethods = { "testListImagesInDetail" })
+ public void testGetImageById() throws Exception {
+ for (String zoneId : api.getConfiguredZones()) {
+ ImageApi imageApi = api.getImageApiForZone(zoneId);
+ Set<? extends Image> response = imageApi.listInDetail().concat().toSet();
+ for (Image image : response) {
+ Image details = imageApi.get(image.getId());
+ assertNotNull(details);
+ assertEquals(details.getId(), image.getId());
+ assertEquals(details.getName(), image.getName());
+ assertEquals(details.getLinks(), image.getLinks());
+ assertEquals(details.getCreated(), image.getCreated());
+ assertEquals(details.getMinDisk(), image.getMinDisk());
+ assertEquals(details.getMinRam(), image.getMinRam());
+ assertEquals(details.getProgress(), image.getProgress());
+ assertEquals(details.getStatus(), image.getStatus());
+ assertEquals(details.getServer(), image.getServer());
+ assertEquals(details.getTenantId(), image.getTenantId());
+ assertEquals(details.getUpdated(), image.getUpdated());
+ assertEquals(details.getUserId(), image.getUserId());
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiExpectTest.java
new file mode 100644
index 0000000..070dcf6
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiExpectTest.java
@@ -0,0 +1,746 @@
+/*
+ * 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.openstack.nova.v2_0.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
+import org.jclouds.openstack.nova.v2_0.options.RebuildServerOptions;
+import org.jclouds.openstack.nova.v2_0.parse.ParseCreatedServerTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseMetadataListTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseMetadataUpdateTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerDiagnostics;
+
+/**
+ * Tests annotation parsing of {@code ServerAsyncApi}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ServerAsyncApiTest")
+public class ServerApiExpectTest extends BaseNovaApiExpectTest {
+
+ public void testListServersWhenResponseIs2xx() throws Exception {
+ HttpRequest listServers = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_list.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listServers, listServersResponse);
+
+ assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+ new ParseServerListTest().expected().toString());
+ }
+
+ public void testListServersWhenReponseIs404IsEmpty() throws Exception {
+ HttpRequest listServers = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listServersResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listServers, listServersResponse);
+
+ assertTrue(apiWhenNoServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().isEmpty());
+ }
+
+ public void testCreateServerWhenResponseIs202() throws Exception {
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\"}}","application/json"))
+ .build();
+
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server.json","application/json; charset=UTF-8")).build();
+
+ NovaApi apiWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, createServer, createServerResponse);
+
+ assertEquals(apiWithNewServer.getServerApiForZone("az-1.region-a.geo-1").create("test-e92", "1241", "100").toString(),
+ new ParseCreatedServerTest().expected().toString());
+ }
+
+ public void testCreateServerInAvailabilityZoneWhenResponseIs202() throws Exception {
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"availability_zone\":\"nova\"}}","application/json"))
+ .build();
+
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server_in_zone.json","application/json; charset=UTF-8")).build();
+
+ NovaApi apiWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, createServer, createServerResponse);
+
+ CreateServerOptions options = new CreateServerOptions().availabilityZone("nova");
+
+ assertEquals(apiWithNewServer.getServerApiForZone("az-1.region-a.geo-1").create("test-e92", "1241", "100", options).toString(),
+ new ParseCreatedServerTest().expected().toString());
+ }
+
+ public void testCreateServerWithSecurityGroupsWhenResponseIs202() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"security_groups\":[{\"name\":\"group1\"},{\"name\":\"group2\"}]}}","application/json"))
+ .build();
+
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server.json","application/json; charset=UTF-8")).build();
+
+
+ NovaApi apiWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, createServer, createServerResponse);
+
+ assertEquals(apiWithNewServer.getServerApiForZone("az-1.region-a.geo-1").create("test-e92", "1241",
+ "100", new CreateServerOptions().securityGroupNames("group1", "group2")).toString(),
+ new ParseCreatedServerTest().expected().toString());
+ }
+
+ public void testCreateServerWithNetworksWhenResponseIs202() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"networks\":[{\"uuid\":\"b3856ac0-f481-11e2-b778-0800200c9a66\"},{\"uuid\":\"bf0f0f90-f481-11e2-b778-0800200c9a66\"}]}}","application/json"))
+ .build();
+
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server.json","application/json; charset=UTF-8")).build();
+
+
+ NovaApi apiWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, createServer, createServerResponse);
+
+ assertEquals(apiWithNewServer.getServerApiForZone("az-1.region-a.geo-1").create("test-e92", "1241",
+ "100", new CreateServerOptions().networks("b3856ac0-f481-11e2-b778-0800200c9a66", "bf0f0f90-f481-11e2-b778-0800200c9a66")).toString(),
+ new ParseCreatedServerTest().expected().toString());
+ }
+
+ public void testCreateServerWithDiskConfigAuto() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"OS-DCF:diskConfig\":\"AUTO\"}}","application/json"))
+ .build();
+
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server_disk_config_auto.json","application/json; charset=UTF-8")).build();
+
+
+ NovaApi apiWithNewServer = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ createServer, createServerResponse);
+
+ assertEquals(apiWithNewServer.getServerApiForZone("az-1.region-a.geo-1").create("test-e92", "1241",
+ "100", new CreateServerOptions().diskConfig(Server.DISK_CONFIG_AUTO)).toString(),
+ new ParseCreatedServerTest().expectedWithDiskConfig(Server.DISK_CONFIG_AUTO).toString());
+ }
+
+ public void testCreateServerWithDiskConfigManual() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"OS-DCF:diskConfig\":\"MANUAL\"}}","application/json"))
+ .build();
+
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server_disk_config_manual.json","application/json; charset=UTF-8")).build();
+
+
+ NovaApi apiWithNewServer = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ createServer, createServerResponse);
+
+ assertEquals(apiWithNewServer.getServerApiForZone("az-1.region-a.geo-1").create("test-e92", "1241",
+ "100", new CreateServerOptions().diskConfig(Server.DISK_CONFIG_MANUAL)).toString(),
+ new ParseCreatedServerTest().expectedWithDiskConfig(Server.DISK_CONFIG_MANUAL).toString());
+ }
+
+ public void testRebuildServerWhenResponseIs202() throws Exception {
+ String serverId = "52415800-8b69-11e0-9b19-734f565bc83b";
+ HttpRequest rebuildServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId +"/action")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"rebuild\":{\"adminPass\":\"password\",\"imageRef\":\"1234\",\"name\":\"newName\",\"accessIPv4\":\"1.1.1.1\",\"accessIPv6\":\"fe80::100\"}}","application/json"))
+ .build();
+
+ HttpResponse rebuildServerResponse = HttpResponse.builder().statusCode(202).build();
+
+ NovaApi apiRebuildServer = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, rebuildServer, rebuildServerResponse);
+
+ RebuildServerOptions options = new RebuildServerOptions().withImage("1234").name("newName").adminPass("password").ipv4Address("1.1.1.1").ipv6Address("fe80::100");
+
+ apiRebuildServer.getServerApiForZone("az-1.region-a.geo-1").rebuild(serverId, options);
+ }
+
+ public void testCreateImageWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+ String imageId = "456";
+ String imageName = "foo";
+
+ HttpRequest createImage = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/action")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"createImage\":{\"name\":\"" + imageName + "\", \"metadata\": {}}}", "application/json"))
+ .build();
+
+ HttpResponse createImageResponse = HttpResponse.builder()
+ .statusCode(200)
+ .headers(
+ ImmutableMultimap.<String, String> builder()
+ .put("Location", "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId).build()).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, createImage, createImageResponse);
+
+ assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").createImageFromServer(imageName, serverId),
+ imageId);
+ }
+
+ public void testCreateImageWhenResponseIs404IsEmpty() throws Exception {
+ String serverId = "123";
+ String imageName = "foo";
+
+ HttpRequest createImage = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/action")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"createImage\":{\"name\":\"" + imageName + "\", \"metadata\": {}}}", "application/json"))
+ .build();
+
+ HttpResponse createImageResponse = HttpResponse.builder().statusCode(404).build();
+ NovaApi apiWhenServerDoesNotExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, createImage, createImageResponse);
+
+ try {
+ apiWhenServerDoesNotExist.getServerApiForZone("az-1.region-a.geo-1").createImageFromServer(imageName, serverId);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testStopServerWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+ HttpRequest stopServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/action")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"os-stop\":null}", "application/json"))
+ .build();
+
+ HttpResponse stopServerResponse = HttpResponse.builder().statusCode(202).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, stopServer, stopServerResponse);
+
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").stop(serverId);
+ }
+
+ public void testStopServerWhenResponseIs404() throws Exception {
+ String serverId = "123";
+ HttpRequest stopServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/action")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+
+ .payload(payloadFromStringWithContentType(
+ "{\"os-stop\":null}", "application/json"))
+ .build();
+
+ HttpResponse stopServerResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, stopServer, stopServerResponse);
+
+ try {
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").stop(serverId);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testStartServerWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+ HttpRequest startServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/action")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+
+ .payload(payloadFromStringWithContentType(
+ "{\"os-start\":null}", "application/json"))
+ .build();
+
+ HttpResponse startServerResponse = HttpResponse.builder().statusCode(202).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, startServer, startServerResponse);
+
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").start(serverId);
+ }
+
+ public void testStartServerWhenResponseIs404() throws Exception {
+ String serverId = "123";
+ HttpRequest startServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/action")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"os-startp\":null}", "application/json"))
+ .build();
+
+ HttpResponse startServerResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, startServer, startServerResponse);
+
+ try {
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").start(serverId);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testListMetadataWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+
+ HttpRequest getMetadata = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/metadata_list.json")).build();
+
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getMetadata, getMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").getMetadata(serverId).toString(),
+ new ParseMetadataListTest().expected().toString());
+ }
+
+ public void testListMetadataWhenResponseIs404() throws Exception {
+ String serverId = "123";
+ HttpRequest getMetadata = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getMetadata, getMetadataResponse);
+
+ try {
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").getMetadata(serverId);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testSetMetadataWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 1")
+ .put("Image Version", "2.1")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("PUT")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 1\",\"Image Version\":\"2.1\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/metadata_list.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").setMetadata(serverId, metadata).toString(),
+ new ParseMetadataListTest().expected().toString());
+ }
+
+ public void testSetMetadataWhenResponseIs404() throws Exception {
+ String serverId = "123";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 1")
+ .put("Image Version", "2.1")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("PUT")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 1\",\"Image Version\":\"2.1\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ try {
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").setMetadata(serverId, metadata);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testUpdateMetadataWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 2")
+ .put("Server Description", "Simple Server")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 2\",\"Server Description\":\"Simple Server\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/metadata_updated.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").updateMetadata(serverId, metadata).toString(),
+ new ParseMetadataUpdateTest().expected().toString());
+ }
+
+ public void testUpdateMetadataWhenResponseIs404() throws Exception {
+ String serverId = "123";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 2")
+ .put("Server Description", "Simple Server")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 2\",\"Server Description\":\"Simple Server\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404)
+ .payload(payloadFromResource("/metadata_updated.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ try {
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").setMetadata(serverId, metadata);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testGetMetadataItemWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+ String key = "Server Label";
+
+ HttpRequest getMetadata = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata/" + "Server%20Label")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/metadata_item.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getMetadata, getMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").getMetadata(serverId, key).toString(),
+ "Web Head 1");
+ }
+
+ public void testGetMetadataItemWhenResponseIs404() throws Exception {
+ String serverId = "123";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 1")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 2\",\"Server Description\":\"Simple Server\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404)
+ .payload(payloadFromResource("/metadata_updated.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ try {
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").setMetadata(serverId, metadata);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testSetMetadataItemWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 2")
+ .put("Server Description", "Simple Server")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 2\",\"Server Description\":\"Simple Server\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/metadata_updated.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").updateMetadata(serverId, metadata).toString(),
+ new ParseMetadataUpdateTest().expected().toString());
+ }
+
+ public void testSetMetadataItemWhenResponseIs404() throws Exception {
+ String serverId = "123";
+ ImmutableMap<String, String> metadata = new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 2")
+ .put("Server Description", "Simple Server")
+ .build();
+
+ HttpRequest setMetadata = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 2\",\"Server Description\":\"Simple Server\"}}","application/json"))
+ .build();
+
+ HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404)
+ .payload(payloadFromResource("/metadata_updated.json")).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, setMetadata, setMetadataResponse);
+
+ try {
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").setMetadata(serverId, metadata);
+ fail("Expected an exception.");
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ public void testDeleteMetadataItemWhenResponseIs2xx() throws Exception {
+ String serverId = "123";
+ String key = "Server%20Label";
+
+ HttpRequest updateMetadata = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata/" + key)
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse updateMetadataResponse = HttpResponse.builder().statusCode(204).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, updateMetadata, updateMetadataResponse);
+
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").deleteMetadata(serverId, key);
+
+ }
+
+ public void testDeleteMetadataItemWhenResponseIs404() throws Exception {
+ String serverId = "123";
+ String key = "Server%20Label";
+
+ HttpRequest deleteMetadata = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/metadata/" + key)
+ .addHeader("Accept", "*/*")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ HttpResponse deleteMetadataResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, deleteMetadata, deleteMetadataResponse);
+
+ apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").deleteMetadata(serverId, key);
+
+ }
+
+ public void testGetDiagnosticsWhenResponseIs200() throws Exception {
+
+ String serverId = "123";
+ HttpRequest getDiagnostics = HttpRequest
+ .builder()
+ .method("GET")
+ .addHeader("Accept", "application/json")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/"+ serverId + "/diagnostics")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+
+ HttpResponse serverDiagnosticsResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/server_diagnostics.json","application/json; charset=UTF-8")).build();
+
+ NovaApi apiWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, getDiagnostics, serverDiagnosticsResponse);
+ assertEquals(apiWithNewServer.getServerApiForZone("az-1.region-a.geo-1").getDiagnostics(serverId),
+ new ParseServerDiagnostics().expected());
+ }
+
+
+ public void testGetDiagnosticsWhenResponseIs403Or404Or500() throws Exception {
+
+ String serverId = "123";
+ HttpRequest getDiagnostics = HttpRequest
+ .builder()
+ .method("GET")
+ .addHeader("Accept", "application/json")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/"+ serverId + "/diagnostics")
+ .addHeader("X-Auth-Token", authToken)
+ .build();
+
+ for (int statusCode : ImmutableSet.of(403, 404, 500)) {
+ assertTrue(!requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, getDiagnostics,
+ HttpResponse.builder().statusCode(statusCode).build()).getServerApiForZone("az-1.region-a.geo-1").getDiagnostics(serverId).isPresent());
+ }
+ }
+
+
+
+}
[19/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptionsTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptionsTest.java
new file mode 100755
index 0000000..dd84c98
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptionsTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.vcloud.options;
+
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.description;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code InstantiateVAppTemplateOptions}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class InstantiateVAppTemplateOptionsTest {
+
+ Injector injector = Guice.createInjector(new SaxParserModule());
+
+ @Test
+ public void testAddNetworkConfig() {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ options.addNetworkConfig(new NetworkConfig("default", URI.create("http://localhost"), FenceMode.BRIDGED));
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getNetworkName(), "default");
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getParentNetwork(), URI.create("http://localhost"));
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getFenceMode(), FenceMode.BRIDGED);
+ }
+
+ @Test
+ public void testAddNetworkConfigStatic() {
+ InstantiateVAppTemplateOptions options = addNetworkConfig(new NetworkConfig("default",
+ URI.create("http://localhost"), FenceMode.BRIDGED));
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getNetworkName(), "default");
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getParentNetwork(), URI.create("http://localhost"));
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getFenceMode(), FenceMode.BRIDGED);
+ }
+
+ @Test
+ public void testDescription() {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ options.description("foo");
+ assertEquals(options.getDescription(), "foo");
+ }
+
+ @Test
+ public void testDescriptionStatic() {
+ InstantiateVAppTemplateOptions options = description("foo");
+ assertEquals(options.getDescription(), "foo");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest.java
new file mode 100755
index 0000000..d33bb32
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.vcloud.suppliers;
+
+import static org.easymock.EasyMock.createMock;
+import static org.testng.Assert.assertEquals;
+
+import java.util.NoSuchElementException;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.name.Names;
+
+/**
+ * Tests behavior of
+ * {@code OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest")
+public class OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest {
+ ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull = Guice.createInjector().getInstance(
+ ValueOfConfigurationKeyOrNull.class);
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testIllegalArgumentWhenResourcesEmpty() {
+ new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull, "foo",
+ Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableSet.<ReferenceType> of());
+ }
+
+ @Test
+ public void testReturnsOnlyResource() {
+ ReferenceType reference = createMock(ReferenceType.class);
+
+ assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
+ "foo", Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableSet.<ReferenceType> of(reference)),
+ reference);
+
+ }
+
+ @Test
+ public void testReturnsFirstResourceWhenConfigurationUnspecified() {
+ ReferenceType reference1 = createMock(ReferenceType.class);
+ ReferenceType reference2 = createMock(ReferenceType.class);
+
+ assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
+ "foo", Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableList.<ReferenceType> of(reference1,
+ reference2)), reference1);
+
+ }
+
+ @Test
+ public void testReturnsResourceMatchingDefaultPredicateWhenConfigurationUnspecified() {
+ ReferenceType reference1 = createMock(ReferenceType.class);
+ ReferenceType reference2 = createMock(ReferenceType.class);
+
+ assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
+ "foo", Predicates.equalTo(reference2)).apply(ImmutableList.<ReferenceType> of(reference1, reference2)),
+ reference2);
+
+ }
+
+ @Test
+ public void testReturnsResourceWithNameMatchingConfigurationKey() {
+ ReferenceType reference1 = new ReferenceTypeImpl("travis tritt", null, null);
+ ReferenceType reference2 = new ReferenceTypeImpl("hail mary", null, null);
+
+ assertEquals(
+ new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(Guice.createInjector(
+ new AbstractModule() {
+ protected void configure() {
+ bindConstant().annotatedWith(Names.named("foo")).to(".*mary.*");
+ }
+ }).getInstance(ValueOfConfigurationKeyOrNull.class), "foo", Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableList
+ .<ReferenceType> of(reference1, reference2)), reference2);
+
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testThrowsNoSuchElementWhenNoneMatchConfigurationKey() {
+ ReferenceType reference1 = new ReferenceTypeImpl("travis tritt", null, null);
+ ReferenceType reference2 = new ReferenceTypeImpl("hail mary", null, null);
+
+ new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(Guice.createInjector(new AbstractModule() {
+ protected void configure() {
+ bindConstant().annotatedWith(Names.named("foo")).to(".*happy.*");
+ }
+ }).getInstance(ValueOfConfigurationKeyOrNull.class), "foo", Predicates.<ReferenceType> alwaysTrue())
+ .apply(ImmutableList.<ReferenceType> of(reference1, reference2));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/utils/TestUtils.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/utils/TestUtils.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/utils/TestUtils.java
new file mode 100755
index 0000000..9a30266
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/utils/TestUtils.java
@@ -0,0 +1,32 @@
+/*
+ * 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.vcloud.utils;
+
+
+/**
+ * Utility class for test
+ *
+ * @author Andrew Phillips
+ */
+public class TestUtils {
+ public static final Object[][] NO_INVOCATIONS = new Object[0][0];
+ public static final Object[][] SINGLE_NO_ARG_INVOCATION = { new Object[0] };
+
+ public static boolean isWindowsOs() {
+ return System.getProperty("os.name", "").toLowerCase().contains("windows");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogHandlerTest.java
new file mode 100755
index 0000000..86cb8ac
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogHandlerTest.java
@@ -0,0 +1,135 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code CatalogHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class CatalogHandlerTest {
+
+ private Injector injector;
+
+ private Factory factory;
+
+ public void testVCloud1_0() {
+ InputStream is = getClass().getResourceAsStream("/catalog-blank.xml");
+ injector = Guice.createInjector(new SaxParserModule());
+ factory = injector.getInstance(ParseSax.Factory.class);
+ Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
+ assertEquals(result, new CatalogImpl("Jclouds-private", "application/vnd.vmware.vcloud.catalog+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081"), new ReferenceTypeImpl(null,
+ "application/vnd.vmware.vcloud.org+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")), null, ImmutableMap
+ .<String, ReferenceType> of(), ImmutableList.<Task> of(), false, false));
+ }
+
+ public void testTerremark() {
+ InputStream is = getClass().getResourceAsStream("/catalog.xml");
+ injector = Guice.createInjector(new SaxParserModule());
+ factory = injector.getInstance(ParseSax.Factory.class);
+ Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
+ assertEquals(result.getName(), "Miami Environment 1");
+ assert result.getDescription() == null;
+
+ assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"));
+ assertEquals(result.get("CentOS 5.3 (32-bit)"), new ReferenceTypeImpl("CentOS 5.3 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/5")));
+ assertEquals(result.get("CentOS 5.3 (64-bit)"), new ReferenceTypeImpl("CentOS 5.3 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/6")));
+ assertEquals(result.get("RHEL 5.3 (32-bit)"), new ReferenceTypeImpl("RHEL 5.3 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/7")));
+ assertEquals(result.get("RHEL 5.3 (64-bit)"), new ReferenceTypeImpl("RHEL 5.3 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/8")));
+ assertEquals(result.get("Ubuntu JeOS 9.04 (32-bit)"), new ReferenceTypeImpl("Ubuntu JeOS 9.04 (32-bit)",
+ CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/11")));
+ assertEquals(result.get("Ubuntu JeOS 9.04 (64-bit)"), new ReferenceTypeImpl("Ubuntu JeOS 9.04 (64-bit)",
+ CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/12")));
+ assertEquals(result.get("Ubuntu Server 9.04 (32-bit)"), new ReferenceTypeImpl("Ubuntu Server 9.04 (32-bit)",
+ CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/9")));
+ assertEquals(result.get("Ubuntu Server 9.04 (64-bit)"), new ReferenceTypeImpl("Ubuntu Server 9.04 (64-bit)",
+ CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/10")));
+ assertEquals(result.get("Windows 2003 Enterprise R2 (32-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Enterprise R2 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/1")));
+ assertEquals(result.get("Windows 2003 Enterprise R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Enterprise R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/2")));
+ assertEquals(result.get("Windows 2003 Standard R2 (32-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Standard R2 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/3")));
+ assertEquals(result.get("Windows 2003 Standard R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Standard R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/4")));
+ assertEquals(result.get("Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/23")));
+ assertEquals(result.get("Windows Server 2008 Enterprise (32-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Enterprise (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/13")));
+ assertEquals(result.get("Windows Server 2008 Enterprise (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Enterprise (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/15")));
+ assertEquals(result.get("Windows Server 2008 Enterprise R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Enterprise R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/16")));
+ assertEquals(result.get("Windows Server 2008 Standard (32-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Standard (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/17")));
+ assertEquals(result.get("Windows Server 2008 Standard (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Standard (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/18")));
+ assertEquals(result.get("Windows Server 2008 Standard R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Standard R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/19")));
+ assertEquals(result.get("Windows Server 2008 Standard w.SQL 2008 Web (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Standard w.SQL 2008 Web (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/14")));
+ assertEquals(result.get("Windows Web Server 2008 (32-bit)"), new ReferenceTypeImpl(
+ "Windows Web Server 2008 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/20")));
+ assertEquals(result.get("Windows Web Server 2008 (64-bit)"), new ReferenceTypeImpl(
+ "Windows Web Server 2008 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/21")));
+ assertEquals(result.get("Windows Web Server 2008 R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows Web Server 2008 R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java
new file mode 100755
index 0000000..25c48cd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSortedMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code CatalogItemHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class CatalogItemHandlerTest {
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/catalogItem-hosting.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);
+
+ assertEquals(result, new CatalogItemImpl("Windows 2008 Datacenter 64 Bit", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"), "Windows 2008 Datacenter 64 Bit",
+ new ReferenceTypeImpl("Windows 2008 Datacenter 64 Bit",
+ "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")),
+ ImmutableSortedMap.of("Foo", "Bar", "Hello", "World"
+
+ )));
+
+ }
+
+ public void testApplyInputStreamWithNamespaceUsingVcloud() {
+ InputStream is = getClass().getResourceAsStream("/catalogItem-carrenza-with-vcloud-namespace.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);
+
+ assertEquals(result, new CatalogItemImpl("ubuntu10.10x64",
+ URI.create("https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"),
+ null, new ReferenceTypeImpl("ubuntu10.10x64", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834")),
+ ImmutableSortedMap.<String,String>of()));
+ }
+
+ public void testApplyInputStreamWithNamespaceUsingDefault() {
+ InputStream is = getClass().getResourceAsStream("/catalogItem-carrenza-with-default-namespace.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);
+
+ assertEquals(result, new CatalogItemImpl("ubuntu10.10x64",
+ URI.create("https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"),
+ null, new ReferenceTypeImpl("ubuntu10.10x64", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834")),
+ ImmutableSortedMap.<String,String>of()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandlerTest.java
new file mode 100755
index 0000000..5608d96
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandlerTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.UnknownHostException;
+
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code GuestCustomizationSectionHandler}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "GuestCustomizationSectionHandlerTest")
+public class GuestCustomizationSectionHandlerTest extends BaseHandlerTest {
+
+ public void testDefault() throws UnknownHostException {
+ InputStream is = getClass().getResourceAsStream("/guestCustomization.xml");
+
+ GuestCustomizationSection result = factory.create(injector.getInstance(GuestCustomizationSectionHandler.class))
+ .parse(is);
+
+ checkGuestCustomization(result);
+
+ }
+
+ @Test(enabled = false)
+ public static void checkGuestCustomization(GuestCustomizationSection result) {
+ assertEquals(result.getType(), VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML);
+ assertEquals(result.getHref(),
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"));
+ assertEquals(result.getInfo(), "Specifies Guest OS Customization Settings");
+ assertEquals(result.isEnabled(), Boolean.TRUE);
+ assertEquals(result.shouldChangeSid(), Boolean.FALSE);
+ assertEquals(result.getVirtualMachineId(), "2087535248");
+ assertEquals(result.isJoinDomainEnabled(), Boolean.FALSE);
+ assertEquals(result.useOrgSettings(), Boolean.FALSE);
+ assertEquals(result.getDomainName(), null);
+ assertEquals(result.getDomainUserName(), null);
+ assertEquals(result.getDomainUserPassword(), null);
+ assertEquals(result.isAdminPasswordEnabled(), Boolean.TRUE);
+ assertEquals(result.isAdminPasswordAuto(), Boolean.TRUE);
+ assertEquals(result.getAdminPassword(), null);
+ assertEquals(result.isResetPasswordRequired(), Boolean.FALSE);
+ assertEquals(result.getCustomizationScript(), "cat > /root/foo.txt<<EOF\nI '\"love\"' {asc|!}*&\nEOF\n");
+ assertEquals(result.getComputerName(), "RHEL5");
+ assertEquals(
+ result.getEdit(),
+ new ReferenceTypeImpl(null, VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionHandlerTest.java
new file mode 100755
index 0000000..03ed047
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionHandlerTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.UnknownHostException;
+
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code NetworkConnectionHandler}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "NetworkConnectionHandlerTest")
+public class NetworkConnectionHandlerTest extends BaseHandlerTest {
+
+ public void testDefault() throws UnknownHostException {
+ InputStream is = getClass().getResourceAsStream("/networkconnection.xml");
+
+ NetworkConnection result = factory.create(injector.getInstance(NetworkConnectionHandler.class)).parse(is);
+
+ checkNetworkConnection(result);
+
+ }
+
+ @Test(enabled = false)
+ public static void checkNetworkConnection(NetworkConnection result) {
+ assertEquals(result.getNetwork(), "internet01");
+ assertEquals(result.getNetworkConnectionIndex(), 0);
+ assertEquals(result.getIpAddress(), "174.47.101.164");
+ assertEquals(result.getExternalIpAddress(), null);
+ assertEquals(result.isConnected(), true);
+ assertEquals(result.getMACAddress(), "00:50:56:01:01:f2");
+ assertEquals(result.getIpAddressAllocationMode(), IpAddressAllocationMode.POOL);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandlerTest.java
new file mode 100755
index 0000000..aec8c25
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandlerTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code NetworkConnectionSectionHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class NetworkConnectionSectionHandlerTest {
+ public void testVCloud1_0() {
+ InputStream is = getClass().getResourceAsStream("/networkconnectionsection.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ NetworkConnectionSection result = factory.create(injector.getInstance(NetworkConnectionSectionHandler.class))
+ .parse(is);
+ checkNetworkConnectionSection(result);
+ }
+
+ @Test(enabled = false)
+ static void checkNetworkConnectionSection(NetworkConnectionSection result) {
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"));
+ assertEquals(result.getType(), VCloudMediaType.NETWORKCONNECTIONSECTION_XML);
+ assertEquals(result.getInfo(), "Specifies the available VM network connections");
+ assertEquals(result.getPrimaryNetworkConnectionIndex(), Integer.valueOf(0));
+ assertEquals(result.getEdit(), new ReferenceTypeImpl(null, VCloudMediaType.NETWORKCONNECTIONSECTION_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/")));
+ NetworkConnectionHandlerTest.checkNetworkConnection(Iterables.getOnlyElement(result.getConnections()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java
new file mode 100755
index 0000000..738a5a1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code OrgHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class OrgHandlerTest {
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/org-1.0.xml");
+
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+
+ Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
+ assertEquals(result.getName(), "ExampleOrg");
+ assertEquals(result.getFullName(), "ExampleOrg");
+ assertEquals(result.getDescription(), "Example Corp's Primary Organization.");
+ assertEquals(result.getHref(), URI.create("http://vcloud.example.com/api/v1.0/org/5"));
+ assertEquals(result.getCatalogs(), ImmutableMap.of("Main Catalog", new ReferenceTypeImpl("Main Catalog",
+ CATALOG_XML, URI.create("http://vcloud.example.com/api/v1.0/catalog/32")), "Shared Catalog",
+ new ReferenceTypeImpl("Shared Catalog", CATALOG_XML, URI
+ .create("http://vcloud.example.com/api/v1.0/catalog/37"))));
+ assertEquals(result.getVDCs(), ImmutableMap.of("ExampleVdc01", new ReferenceTypeImpl("ExampleVdc01",
+ VCloudMediaType.VDC_XML, URI.create("http://vcloud.example.com/api/v1.0/vdc/5"))));
+ assertEquals(result.getNetworks(), ImmutableMap.of("TestNetwork", new ReferenceTypeImpl("TestNetwork",
+ VCloudMediaType.NETWORK_XML, URI.create("http://vcloud.example.com/api/v1.0/network/14")),
+ "ProductionNetwork", new ReferenceTypeImpl("ProductionNetwork", VCloudMediaType.NETWORK_XML, URI
+ .create("http://vcloud.example.com/api/v1.0/network/54"))));
+ assertEquals(result.getTasksList(), new ReferenceTypeImpl(null, TASKSLIST_XML, URI
+ .create("http://vcloud.example.com/api/v1.0/tasksList/5")));
+ }
+
+ public void testTerremark() {
+ InputStream is = getClass().getResourceAsStream("/org.xml");
+
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+
+ Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
+ assertEquals(result.getName(), "adrian@jclouds.org");
+ assertEquals(result.getFullName(), "adrian@jclouds.org");
+ assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
+ assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new ReferenceTypeImpl(
+ "Miami Environment 1 Catalog", CATALOG_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"))));
+ assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new ReferenceTypeImpl(
+ "Miami Environment 1", VCloudMediaType.VDC_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"))));
+ assertEquals(result.getTasksList(), new ReferenceTypeImpl("Miami Environment 1 Tasks List", TASKSLIST_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/32")));
+ }
+
+ public void testHosting() {
+ InputStream is = getClass().getResourceAsStream("/org-hosting.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
+ assertEquals(result.getName(), "Customer 188849");
+ assertEquals(result.getFullName(), "Customer 188849");
+ assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849"));
+ assertEquals(result.getCatalogs(), ImmutableMap.of("HMS Shared Catalog", new ReferenceTypeImpl(
+ "HMS Shared Catalog", CATALOG_XML, URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))));
+ assertEquals(result.getVDCs(), ImmutableMap.of("188849 Virtual DataCenter", new ReferenceTypeImpl(
+ "188849 Virtual DataCenter", VCloudMediaType.VDC_XML, URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"))));
+ assertEquals(result.getTasksList(), new ReferenceTypeImpl("188849 Task List", TASKSLIST_XML, URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849")));
+ }
+
+ public void testSavvis() {
+ InputStream is = getClass().getResourceAsStream("/org-savvis.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
+ assertEquals(result, new OrgImpl("607968.0", null, null, "607968.0", "Gravitant Inc", ImmutableMap
+ .<String, ReferenceType> of(), ImmutableMap.<String, ReferenceType> of("GravDataCenter1(Saved)",
+ new ReferenceTypeImpl("GravDataCenter1(Saved)", "application/vnd.vmware.vcloud.vdc+xml", URI
+ .create("https://api.symphonyVPDC.savvis.net/rest/api/v0.8/org/607968.0/vdc/2826"))),
+ ImmutableMap.<String, ReferenceType> of(), null, ImmutableSet.<Task> of()));
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java
new file mode 100755
index 0000000..7887a56
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests behavior of {@code OrgListHandler}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "OrgListHandlerTest")
+public class OrgListHandlerTest extends BaseHandlerTest {
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/orglist.xml");
+
+ Map<String, ReferenceType> result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is);
+ assertEquals(result, ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ "application/vnd.vmware.vcloud.org+xml", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+ }
+
+
+ public void testSavvis() {
+ InputStream is = getClass().getResourceAsStream("/orglist-savvis.xml");
+
+ Map<String, ReferenceType> result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is);
+ assertEquals(result, ImmutableMap.of("SAVVISStation Integration Testing", new ReferenceTypeImpl("SAVVISStation Integration Testing",
+ "application/vnd.vmware.vcloud.org+xml", URI.create("https://api.sandbox.symphonyvpdc.savvis.net/rest/api/v0.8/org/100000.0"))));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java
new file mode 100755
index 0000000..e350131
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.network.DhcpService;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.IpRange;
+import org.jclouds.vcloud.domain.network.IpScope;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code OrgNetworkHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class OrgNetworkHandlerTest {
+ public void testIsolated() {
+ InputStream is = getClass().getResourceAsStream("/orgnetwork-isolated.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is);
+ assertEquals(result.getName(), "isolation01");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml");
+ assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assert result.getConfiguration() != null;
+
+ assertEquals(result.getConfiguration().getIpScope(), new IpScope(false, "192.168.15.1", "255.255.255.0",
+ "23.172.173.113", null, null,
+ ImmutableSet.<IpRange> of(new IpRange("192.168.15.100", "192.168.15.199")), ImmutableSet.<String> of()));
+ assertEquals(result.getConfiguration().getParentNetwork(), null);
+ assertEquals(result.getConfiguration().getFenceMode(), FenceMode.ISOLATED);
+ assert result.getConfiguration().getFeatures() != null;
+
+ assertEquals(result.getConfiguration().getFeatures().getDhcpService(), new DhcpService(false, 3600, 7200,
+ new IpRange("192.168.15.2", "192.168.15.99")));
+ assertEquals(result.getConfiguration().getFeatures().getFirewallService(), null);
+ assertEquals(result.getConfiguration().getFeatures().getNatService(), null);
+
+ assertEquals(result.getNetworkPool(), null);
+ assertEquals(result.getAllowedExternalIpAddresses(), ImmutableSet.<String> of());
+
+ }
+
+ public void testBridged() {
+ InputStream is = getClass().getResourceAsStream("/orgnetwork-bridged.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is);
+ assertEquals(result.getName(), "internet01");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml");
+ assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assert result.getConfiguration() != null;
+
+ assertEquals(result.getConfiguration().getIpScope(), new IpScope(true, "174.47.101.161", "255.255.255.224",
+ "24.172.173.113", null, null,
+ ImmutableSet.<IpRange> of(new IpRange("174.47.101.164", "174.47.101.190")), ImmutableSet.<String> of()));
+ assertEquals(result.getConfiguration().getParentNetwork(), null);
+ assertEquals(result.getConfiguration().getFenceMode(), FenceMode.BRIDGED);
+ assert result.getConfiguration().getFeatures() == null;
+ assertEquals(result.getNetworkPool(), null);
+ assertEquals(result.getAllowedExternalIpAddresses(), ImmutableSet.<String> of());
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/SupportedVersionsHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/SupportedVersionsHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/SupportedVersionsHandlerTest.java
new file mode 100755
index 0000000..e9f8cbb
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/SupportedVersionsHandlerTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.SortedMap;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSortedMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code SupportedVersionsHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class SupportedVersionsHandlerTest {
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/versions.xml");
+
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+
+ SortedMap<String, URI> result = factory.create(
+ injector.getInstance(SupportedVersionsHandler.class)).parse(is);
+ assertEquals(result, ImmutableSortedMap.of("0.8", URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/login")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java
new file mode 100755
index 0000000..45d5d07
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java
@@ -0,0 +1,135 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.date.DateService;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.VCloudError.MinorCode;
+import org.jclouds.vcloud.domain.internal.ErrorImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code TaskHandler}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "TaskHandlerTest")
+public class TaskHandlerTest extends BaseHandlerTest {
+
+ private DateService dateService;
+
+ @BeforeTest
+ @Override
+ protected void setUpInjector() {
+ super.setUpInjector();
+ dateService = injector.getInstance(DateService.class);
+ }
+
+ public void testHrefWhenTaskElementIsNamespaced() {
+ InputStream is = getClass().getResourceAsStream("/task-vcd15.xml");
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+ assertEquals(result.getHref(), URI.create("https://mycloud.greenhousedata.com/api/v1.0/task/77a33fd4-3401-423c-8167-6711fc51ee9a"));
+ }
+
+ public void test() {
+ InputStream is = getClass().getResourceAsStream("/task-1.0.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+
+ Task expects = new TaskImpl(URI.create("https://vcenterprise.bluelock.com/api/v1.0/task/3cc08ir8oczbze3n1a3"),
+ "Creating Virtual Application vApp_acole_2(607806320)", TaskStatus.RUNNING, dateService
+ .iso8601DateParse("2010-08-23T02:09:52.443-04:00"), dateService
+ .iso8601DateParse("9999-12-31T23:59:59.999-05:00"), dateService
+ .iso8601DateParse("2010-11-21T02:09:52.443-05:00"), new ReferenceTypeImpl("vApp_acole_2",
+ VCloudMediaType.VAPP_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"))
+
+ , null
+
+ );
+ assertEquals(result, expects);
+
+ }
+
+ public void testTerremark() {
+ InputStream is = getClass().getResourceAsStream("/task.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+ Task expects = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"), null,
+ TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"), dateService
+ .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1",
+ VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null
+
+ );
+ assertEquals(result, expects);
+
+ }
+
+ public void testSelf() {
+ InputStream is = getClass().getResourceAsStream("/task-self.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+
+ Task expects = new TaskImpl(URI.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"), null,
+ TaskStatus.QUEUED, null, null, null, null, null);
+ assertEquals(result, expects);
+
+ }
+
+ public void testApplyInputStream2() {
+ InputStream is = getClass().getResourceAsStream("/task-hosting.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+
+ Task expects = new TaskImpl(URI.create("https://vcloud.safesecureweb.com/api/v0.8/task/97806"), null,
+ TaskStatus.SUCCESS, dateService.iso8601SecondsDateParse("2010-01-14T20:04:51Z"), dateService
+ .iso8601SecondsDateParse("2010-01-14T20:05:02Z"), dateService
+ .iso8601SecondsDateParse("2010-01-15T20:05:02Z"),
+
+ new ReferenceTypeImpl("188849-96", VCloudMediaType.VAPP_XML, URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96")), null);
+ assertEquals(result, expects);
+ }
+
+ public void testError() {
+ InputStream is = getClass().getResourceAsStream("/task-error.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+
+ Task expects = new TaskImpl(URI.create("http://10.150.4.49/api/v0.8/task/23"), null, TaskStatus.ERROR,
+ dateService.iso8601SecondsDateParse("2009-12-07T19:05:02Z"), dateService
+ .iso8601SecondsDateParse("2009-12-10T14:40:32Z"), null, new ReferenceTypeImpl("testapp1",
+ VCloudMediaType.VAPP_XML, URI.create("http://10.150.4.49/api/v0.8/vapp/1")), new ErrorImpl(
+ "Error processing job", 500, MinorCode.UNRECOGNIZED,
+ " Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00", null));
+ assertEquals(result, expects);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java
new file mode 100755
index 0000000..a5c83d5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.date.DateService;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.TasksList;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSortedSet;
+
+/**
+ * Tests behavior of {@code TasksListHandler}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "TasksListHandlerTest")
+public class TasksListHandlerTest extends BaseHandlerTest {
+
+ private DateService dateService;
+
+ @BeforeTest
+ @Override
+ protected void setUpInjector() {
+ super.setUpInjector();
+ dateService = injector.getInstance(DateService.class);
+ }
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/taskslist.xml");
+
+ TasksList result = factory.create(injector.getInstance(TasksListHandler.class)).parse(is);
+ assertEquals(result.getLocation(), URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/1"));
+ Task task1 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"),
+ null, TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:30:19.587Z"), dateService
+ .iso8601DateParse("2009-08-24T21:30:32.63Z"), null, new ReferenceTypeImpl("Server1",
+ VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
+ Task task2 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
+ null, TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"), dateService
+ .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1",
+ VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
+ assertEquals(result.getTasks(), ImmutableSortedSet.of(task1, task2));
+ }
+
+ public void testApplyInputStreamHosting() {
+ InputStream is = getClass().getResourceAsStream("/taskslist-hosting.xml");
+
+ TasksList result = factory.create(injector.getInstance(TasksListHandler.class)).parse(is);
+ assertEquals(result.getLocation(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java
new file mode 100755
index 0000000..e6c05c7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code VAppHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class VAppHandlerTest {
+
+ public void testRhelOffStatic() {
+ InputStream is = getClass().getResourceAsStream("/vapp-rhel-off-static.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule() {
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ }
+ });
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ assertEquals(result.getName(), "vApp_acole_2");
+ assertEquals(result.getDescription(), "foo");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vApp+xml");
+ assertEquals(result.getStatus(), Status.OFF);
+ assertEquals(
+ result.getVDC(),
+ new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assert result.isOvfDescriptorUploaded();
+ assert result.getNetworkSection() != null;
+ Vm vm = Iterables.getOnlyElement(result.getChildren());
+ VmHandlerTest.checkVm(vm);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java
new file mode 100755
index 0000000..0accf60
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java
@@ -0,0 +1,164 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.date.DateService;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.ovf.Network;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code VAppTemplateHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class VAppTemplateHandlerTest {
+
+ public void testUbuntuTemplate() {
+ VAppTemplate result = parseTemplate();
+ assertEquals(result.getName(), "Ubuntu Template");
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
+ assertEquals(result.getStatus(), Status.OFF);
+ assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assertEquals(result.getVAppScopedLocalId(), null);
+ assert result.isOvfDescriptorUploaded();
+ Vm vm = Iterables.getOnlyElement(result.getChildren());
+ assertEquals(vm.getName(), "Ubuntu1004");
+ assertEquals(vm.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194"));
+ // NOTE this is vAppTemplate not VM!
+ assertEquals(vm.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
+ assertEquals(vm.getStatus(), null);
+ assertEquals(vm.getParent(), new ReferenceTypeImpl(null, VCloudMediaType.VAPPTEMPLATE_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921")));
+ assertEquals(vm.getDescription(), null);
+ assertEquals(vm.getTasks(), ImmutableList.of());
+ assertEquals(vm.getVAppScopedLocalId(), "02_ubuntu_template");
+
+ GuestCustomizationSection guestC = vm.getGuestCustomizationSection();
+
+ assertEquals(guestC.getType(), VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML);
+ assertEquals(
+ guestC.getHref(),
+ URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194/guestCustomizationSection/"));
+ assertEquals(guestC.getInfo(), "Specifies Guest OS Customization Settings");
+ assertEquals(guestC.isEnabled(), Boolean.TRUE);
+ assertEquals(guestC.shouldChangeSid(), Boolean.FALSE);
+ assertEquals(guestC.getVirtualMachineId(), "172837194");
+ assertEquals(guestC.isJoinDomainEnabled(), Boolean.FALSE);
+ assertEquals(guestC.useOrgSettings(), Boolean.FALSE);
+ assertEquals(guestC.getDomainName(), null);
+ assertEquals(guestC.getDomainUserName(), null);
+ assertEquals(guestC.getDomainUserPassword(), null);
+ assertEquals(guestC.isAdminPasswordEnabled(), Boolean.TRUE);
+ assertEquals(guestC.isAdminPasswordAuto(), Boolean.TRUE);
+ assertEquals(guestC.getAdminPassword(), "%3eD%gmF");
+ assertEquals(guestC.isResetPasswordRequired(), Boolean.FALSE);
+ assertEquals(
+ guestC.getCustomizationScript(),
+ "#!/bin/bash if [ \"$1\" = \"postcustomization\" ]; then echo \"post customization\" touch /root/.postcustomization sleep 30 #regenerate keys /bin/rm /etc/ssh/ssh_host_* /usr/sbin/dpkg-reconfigure openssh-server echo \"completed\" fi");
+ assertEquals(guestC.getComputerName(), "Ubuntu1004");
+ assertEquals(guestC.getEdit(), null);
+
+ VCloudNetworkSection network = result.getNetworkSection();
+ assertEquals(
+ network.getHref(),
+ URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/networkSection/"));
+ assertEquals(network.getType(), VCloudMediaType.NETWORKSECTION_XML);
+ assertEquals(network.getInfo(), "The list of logical networks");
+ assertEquals(network.getNetworks(), ImmutableSet.of(new Network("vAppNet-vApp Internal", null)));
+
+ }
+
+ public static VAppTemplate parseTemplate() {
+ InputStream is = VAppTemplateHandlerTest.class.getResourceAsStream("/vAppTemplate.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
+ return result;
+ }
+
+ public void testCopyingTemplate() {
+ InputStream is = getClass().getResourceAsStream("/vAppTemplate-copying.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ DateService dateService = injector.getInstance(DateService.class);
+
+ VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
+ assertEquals(result.getName(), "Ubuntu10.04_v2");
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
+ assertEquals(result.getStatus(), Status.UNRESOLVED);
+ assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/105186609")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of(new TaskImpl(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/task/q62gxhi32xgd9yrqvr"),
+ "Copying Virtual Application Template Ubuntu10.04_v2(699683881)", TaskStatus.RUNNING, dateService
+ .iso8601DateParse("2010-09-17T23:20:46.039-04:00"), dateService
+ .iso8601DateParse("9999-12-31T23:59:59.999-05:00"), dateService
+ .iso8601DateParse("2010-12-16T23:20:46.039-05:00"), new ReferenceTypeImpl("Ubuntu10.04_v2",
+ "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881")),
+ null)));
+ assertEquals(result.getVAppScopedLocalId(), null);
+ assert result.isOvfDescriptorUploaded();
+ assertEquals(result.getChildren(), ImmutableList.of());
+ assertEquals(result.getNetworkSection(), null);
+
+ }
+
+ public void testVAppTemplateWithNewlinesAndNamespacedElements() {
+ InputStream is = getClass().getResourceAsStream("/vAppTemplate1.0-vcd15_withNewlines.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+
+ factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
+ }
+
+
+}
[16/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-hosting.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-hosting.xml
new file mode 100755
index 0000000..c746cba
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-hosting.xml
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VApp href="https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="188849-96"
+ status="2" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 vapp.xsd"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns="http://www.vmware.com/vcloud/v0.8"
+ xmlns:vmw="http://www.vmware.com/schema/ovf"
+ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" size="20971520">
+
+ <NetworkConnectionSection>
+ <Info xmlns="http://schemas.dmtf.org/ovf/envelope/1">Network Information about the vApp</Info>
+ <NetworkConnection Network="Network 1">
+ <IpAddress>204.12.11.167</IpAddress>
+ </NetworkConnection>
+ </NetworkConnectionSection>
+
+ <VirtualHardwareSection xmlns="http://schemas.dmtf.org/ovf/envelope/1">
+ <Info>Virtual hardware</Info>
+ <System>
+ <AutomaticRecoveryAction xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <AutomaticShutdownAction xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <AutomaticStartupAction xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <AutomaticStartupActionDelay
+ xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <AutomaticStartupActionSequenceNumber
+ xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <ConfigurationDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <ConfigurationFile xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <ConfigurationID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <CreationTime xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <Description xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData">Virtual Hardware Family</ElementName>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData">0</InstanceID>
+ <LogDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <RecoveryFile xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <SnapshotDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <SuspendDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <SwapFileDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <VirtualSystemIdentifier
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData">SimpleVM</VirtualSystemIdentifier>
+ <VirtualSystemType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData">vmx-07</VirtualSystemType>
+ </System>
+ <Item>
+ <Address xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AddressOnParent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AllocationUnits
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">hertz * 10^6</AllocationUnits>
+ <AutomaticAllocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticDeallocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ConsumerVisibility xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Description
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">Number of Virtual CPUs</Description>
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1 virtual CPU(s)</ElementName>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</InstanceID>
+ <Limit xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <MappingBehavior xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <OtherResourceType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Parent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <PoolID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Reservation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceSubType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</ResourceType>
+ <VirtualQuantity
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</VirtualQuantity>
+ <Weight xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ </Item>
+ <Item>
+ <Address xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AddressOnParent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AllocationUnits
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">byte * 2^20</AllocationUnits>
+ <AutomaticAllocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticDeallocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ConsumerVisibility xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Description
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">Memory Size</Description>
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">512MB of memory</ElementName>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</InstanceID>
+ <Limit xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <MappingBehavior xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <OtherResourceType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Parent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <PoolID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Reservation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceSubType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</ResourceType>
+ <VirtualQuantity
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">512</VirtualQuantity>
+ <Weight xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ </Item>
+ <Item>
+ <Address
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">0</Address>
+ <AddressOnParent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AllocationUnits xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticAllocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticDeallocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ConsumerVisibility xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Description
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">SCSI Controller</Description>
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">SCSI Controller 0</ElementName>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</InstanceID>
+ <Limit xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <MappingBehavior xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <OtherResourceType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Parent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <PoolID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Reservation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceSubType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">lsilogic</ResourceSubType>
+ <ResourceType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">6</ResourceType>
+ <VirtualQuantity xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Weight xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ </Item>
+ <Item>
+ <Address xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AddressOnParent
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">0</AddressOnParent>
+ <AllocationUnits xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticAllocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticDeallocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ConsumerVisibility xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Description xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">Hard Disk 1</ElementName>
+ <HostResource
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">20971520</HostResource>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">9</InstanceID>
+ <Limit xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <MappingBehavior xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <OtherResourceType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Parent
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</Parent>
+ <PoolID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Reservation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceSubType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">17</ResourceType>
+ <VirtualQuantity
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">20971520</VirtualQuantity>
+ <Weight xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ </Item>
+ </VirtualHardwareSection>
+</VApp>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-none.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-none.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-none.xml
new file mode 100755
index 0000000..62b4f32
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-none.xml
@@ -0,0 +1,237 @@
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="true" status="4" name="customize-750" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://1.1.1.1/api/v1.0/sch
ema/master.xsd">
+ <Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/powerOff"/>
+ <Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reboot"/>
+ <Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reset"/>
+ <Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/shutdown"/>
+ <Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/suspend"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/deploy"/>
+ <Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-98934665/action/undeploy"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/controlAccess"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://1.1.1.1/api/v1.0/vdc/1"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/"/>
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>7776000</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Centos-5.5_x64"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/"/>
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="none">
+ <ovf:Description/>
+ </ovf:Network>
+ <ovf:Network ovf:name="none">
+ <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/"/>
+ <NetworkConfig networkName="none">
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>172.16.7.1</Gateway>
+ <Netmask>255.255.255.0</Netmask>
+ <Dns1>208.95.232.10</Dns1>
+ <Dns2>208.95.232.11</Dns2>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>172.16.7.230</StartAddress>
+ <EndAddress>172.16.7.239</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Direct" href="https://1.1.1.1/api/v1.0/network/282371363"/>
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>172.16.7.2</StartAddress>
+ <EndAddress>172.16.7.229</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>true</IsDeployed>
+ </NetworkConfig>
+ <NetworkConfig networkName="none">
+ <Description>This is a special place-holder used for disconnected network interfaces.</Description>
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>196.254.254.254</Gateway>
+ <Netmask>255.255.0.0</Netmask>
+ <Dns1>196.254.254.254</Dns1>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="true" status="4" name="Centos-5.5_x64" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1">
+ <Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/powerOff"/>
+ <Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reboot"/>
+ <Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reset"/>
+ <Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/shutdown"/>
+ <Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/suspend"/>
+ <Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/action/undeploy"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1"/>
+ <Link rel="screen:thumbnail" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen"/>
+ <Link rel="screen:acquireTicket" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen/action/acquireTicket"/>
+ <Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
+ <Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
+ <Description/>
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>Centos-5.5_x64</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:02:38</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="NONE">none</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="15360" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>2048 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ </ovf:Item>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/"/>
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="none">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IsConnected>false</IsConnected>
+ <MACAddress>00:50:56:01:02:38</MACAddress>
+ <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"/>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>1</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <AdminPassword>secret</AdminPassword>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>cat > /root/foo.txt<<EOF
+I love candy
+EOF
+</CustomizationScript>
+ <ComputerName>Centos-5.5_x64</ComputerName>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/"/>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>Centos-5.5_x64</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-pool.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-pool.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-pool.xml
new file mode 100755
index 0000000..1ac8ff3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-pool.xml
@@ -0,0 +1,227 @@
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="true" status="4" name="my-appExample" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://1.1.1.1/api/v1.0/sch
ema/master.xsd">
+ <Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/powerOff"/>
+ <Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reboot"/>
+ <Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reset"/>
+ <Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/shutdown"/>
+ <Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/suspend"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/deploy"/>
+ <Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/undeploy"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/controlAccess"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://1.1.1.1/api/v1.0/vdc/1"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
+ <Description>Example FTP Server vApp</Description>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/"/>
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="my-app"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/"/>
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="Direct">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/"/>
+ <NetworkConfig networkName="Direct">
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>172.16.7.1</Gateway>
+ <Netmask>255.255.255.0</Netmask>
+ <Dns1>1.1.1.2</Dns1>
+ <Dns2>1.1.1.3</Dns2>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>172.16.7.230</StartAddress>
+ <EndAddress>172.16.7.239</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Direct" href="https://1.1.1.1/api/v1.0/network/282371363"/>
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>172.16.7.2</StartAddress>
+ <EndAddress>172.16.7.229</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ <NatRule>
+ <OneToOneVmRule>
+ <MappingMode>automatic</MappingMode>
+ <VAppScopedVmId>100c208b-4f43-40bb-98d6-a046f6e48c3a</VAppScopedVmId>
+ <VmNicId>0</VmNicId>
+ </OneToOneVmRule>
+ </NatRule>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>true</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="true" status="4" name="my-app" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1">
+ <Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/powerOff"/>
+ <Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reboot"/>
+ <Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reset"/>
+ <Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/shutdown"/>
+ <Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/suspend"/>
+ <Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/action/undeploy"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1"/>
+ <Link rel="screen:thumbnail" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen"/>
+ <Link rel="screen:acquireTicket" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen/action/acquireTicket"/>
+ <Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
+ <Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
+ <Description/>
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>my-app</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:02:33</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="172.16.7.230" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Direct</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="15360" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>2048 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ </ovf:Item>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/"/>
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="Direct">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>172.16.7.230</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:02:33</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"/>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>1</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <AdminPassword>Favor</AdminPassword>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript/>
+ <ComputerName>my-app</ComputerName>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/"/>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>100c208b-4f43-40bb-98d6-a046f6e48c3a</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-rhel-off-static.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-rhel-off-static.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-rhel-off-static.xml
new file mode 100755
index 0000000..7e29ffc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vapp-rhel-off-static.xml
@@ -0,0 +1,325 @@
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ deployed="false" status="8" name="vApp_acole_2"
+ type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="power:powerOn"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/power/action/powerOn" />
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/deploy" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/controlAccess/" />
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/controlAccess" />
+ <Link rel="recompose"
+ type="application/vnd.vmware.vcloud.recomposeVAppParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/recomposeVApp" />
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ <Link rel="remove"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ <Description>foo</Description>
+ <LeaseSettingsSection
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/leaseSettingsSection/"
+ ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/leaseSettingsSection/" />
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/startupSection/"
+ vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff"
+ ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0"
+ ovf:id="RHEL5" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.startupSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/startupSection/" />
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkSection/"
+ vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="internet01">
+ <ovf:Description />
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection
+ type="application/vnd.vmware.vcloud.networkConfigSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkConfigSection/"
+ ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.networkConfigSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkConfigSection/" />
+ <NetworkConfig networkName="internet01">
+ <Description />
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>174.47.101.161</Gateway>
+ <Netmask>255.255.255.224</Netmask>
+ <Dns1>24.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>174.47.101.164</StartAddress>
+ <EndAddress>174.47.101.190</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork
+ type="application/vnd.vmware.vcloud.network+xml"
+ name="internet01"
+ href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723" />
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>174.47.101.162</StartAddress>
+ <EndAddress>174.47.101.163</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ <NatRule>
+ <OneToOneVmRule>
+ <MappingMode>automatic</MappingMode>
+ <VAppScopedVmId>10_rhel_template</VAppScopedVmId>
+ <VmNicId>0</VmNicId>
+ </OneToOneVmRule>
+ </NatRule>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="false" status="8" name="RHEL5"
+ type="application/vnd.vmware.vcloud.vm+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248">
+ <Link rel="power:powerOn"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/power/action/powerOn" />
+ <Link rel="deploy"
+ type="application/vnd.vmware.vcloud.deployVAppParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/action/deploy" />
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
+ <Link rel="remove"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
+ <Link rel="screen:thumbnail"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen" />
+ <Link rel="screen:acquireTicket"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen/action/acquireTicket" />
+ <Link rel="media:insertMedia"
+ type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/insertMedia" />
+ <Link rel="media:ejectMedia"
+ type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/ejectMedia" />
+ <Description />
+ <ovf:VirtualHardwareSection
+ xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"
+ vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>RHEL5</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:01:f2</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="174.47.101.164"
+ vcloud:primaryNetworkConnection="true"
+ vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource
+ vcloud:capacity="30720" vcloud:busType="6"
+ vcloud:busSubType="lsilogic" />
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>384 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>384</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ </ovf:Item>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/media" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection
+ xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"
+ vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/" />
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.164</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f2</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/" />
+ </NetworkConnectionSection>
+ <GuestCustomizationSection
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>2087535248</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>cat > /root/foo.txt<<EOF
+I '"love"' {asc|!}*&
+EOF
+</CustomizationScript>
+ <ComputerName>RHEL5</ComputerName>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/" />
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>10_rhel_template</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
[30/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceNameToEndpoint.java
new file mode 100755
index 0000000..79d990e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceNameToEndpoint.java
@@ -0,0 +1,81 @@
+/*
+ * 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.vcloud.binders;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Supplier;
+/**
+ *
+ * @author Adrian Cole
+ */
+public abstract class OrgNameVDCNameResourceNameToEndpoint implements MapBinder {
+
+ protected final Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap;
+ protected final Supplier<ReferenceType> defaultOrg;
+ protected final Supplier<ReferenceType> defaultVDC;
+
+ @Inject
+ public OrgNameVDCNameResourceNameToEndpoint(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
+ @Org Supplier<ReferenceType> defaultOrg, @org.jclouds.vcloud.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
+ this.orgVDCMap = orgVDCMap;
+ this.defaultOrg = defaultOrg;
+ this.defaultVDC = defaultVDC;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object vDC = postParams.get("vdcName");
+ Object resource = postParams.get("resourceName");
+ if (org == null)
+ org = defaultOrg.get().getName();
+ if (vDC == null)
+ vDC = defaultVDC.get().getName();
+ Map<String, Map<String, org.jclouds.vcloud.domain.VDC>> orgToVDCs = orgVDCMap.get();
+ checkState(orgToVDCs != null, "could not get map of org name to vdcs!");
+ Map<String, org.jclouds.vcloud.domain.VDC> vDCs = orgToVDCs.get(org);
+ if (vDCs == null)
+ throw new NoSuchElementException("org " + org + " not found in " + orgToVDCs.keySet());
+ org.jclouds.vcloud.domain.VDC vDCObject = vDCs.get(vDC);
+ if (vDCObject == null)
+ throw new NoSuchElementException("vdc " + vDC + " in org " + org + " not found in " + vDCs.keySet());
+ URI endpoint = getEndpointOfResourceInVDC(org, vDC, resource, vDCObject);
+ return (R) request.toBuilder().endpoint(endpoint).build();
+ }
+
+ protected abstract URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource, VDC vDCObject);
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceContextModule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceContextModule.java
new file mode 100755
index 0000000..2c994af
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceContextModule.java
@@ -0,0 +1,39 @@
+/*
+ * 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.vcloud.compute.config;
+
+import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
+import org.jclouds.domain.Location;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+/**
+ * Configures the {@link VCloudComputeServiceContext}; requires {@link VCloudComputeClientImpl}
+ * bound.
+ *
+ * @author Adrian Cole
+ */
+public class VCloudComputeServiceContextModule extends
+ ComputeServiceAdapterContextModule<VApp, VAppTemplate, VAppTemplate, Location> {
+
+ @Override
+ protected void configure() {
+ super.configure();
+ install(new VCloudComputeServiceDependenciesModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
new file mode 100755
index 0000000..b975b96
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
@@ -0,0 +1,154 @@
+/*
+ * 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.vcloud.compute.config;
+
+
+import java.util.Map;
+
+import javax.inject.Singleton;
+
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.domain.Location;
+import org.jclouds.functions.IdentityFunction;
+import org.jclouds.vcloud.compute.functions.HardwareForVApp;
+import org.jclouds.vcloud.compute.functions.HardwareForVAppTemplate;
+import org.jclouds.vcloud.compute.functions.ImageForVAppTemplate;
+import org.jclouds.vcloud.compute.functions.VAppToNodeMetadata;
+import org.jclouds.vcloud.compute.internal.VCloudTemplateBuilderImpl;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.compute.strategy.VCloudComputeServiceAdapter;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.functions.VAppTemplatesInOrg;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class VCloudComputeServiceDependenciesModule extends AbstractModule {
+
+ @VisibleForTesting
+ public static final Map<Status, NodeMetadata.Status> toPortableNodeStatus = ImmutableMap
+ .<Status, NodeMetadata.Status> builder()
+ .put(Status.OFF, NodeMetadata.Status.SUSPENDED)
+ .put(Status.ON, NodeMetadata.Status.RUNNING)
+ .put(Status.RESOLVED, NodeMetadata.Status.PENDING)
+ .put(Status.MIXED, NodeMetadata.Status.PENDING)
+ .put(Status.UNKNOWN, NodeMetadata.Status.UNRECOGNIZED)
+ .put(Status.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED)
+ .put(Status.DEPLOYED, NodeMetadata.Status.PENDING)
+ .put(Status.SUSPENDED, NodeMetadata.Status.SUSPENDED)
+ .put(Status.WAITING_FOR_INPUT, NodeMetadata.Status.PENDING)
+ .put(Status.INCONSISTENT, NodeMetadata.Status.PENDING)
+ .put(Status.ERROR, NodeMetadata.Status.ERROR)
+ .put(Status.UNRESOLVED, NodeMetadata.Status.PENDING).build();
+
+ @Singleton
+ @Provides
+ protected Map<Status, NodeMetadata.Status> toPortableNodeStatus() {
+ return toPortableNodeStatus;
+ }
+
+ @VisibleForTesting
+ public static final Map<Status, Image.Status> toPortableImageStatus = ImmutableMap
+ .<Status, Image.Status> builder()
+ .put(Status.RESOLVED, Image.Status.AVAILABLE)
+ .put(Status.OFF, Image.Status.AVAILABLE)
+ .put(Status.MIXED, Image.Status.PENDING)
+ .put(Status.UNKNOWN, Image.Status.UNRECOGNIZED)
+ .put(Status.UNRECOGNIZED, Image.Status.UNRECOGNIZED)
+ .put(Status.DEPLOYED, Image.Status.PENDING)
+ .put(Status.PENDING_DESCRIPTOR, Image.Status.PENDING)
+ .put(Status.COPYING, Image.Status.PENDING)
+ .put(Status.PENDING_CONTENTS, Image.Status.PENDING)
+ .put(Status.QUARANTINED, Image.Status.PENDING)
+ .put(Status.QUARANTINE_EXPIRED, Image.Status.ERROR)
+ .put(Status.REJECTED, Image.Status.ERROR)
+ .put(Status.TRANSFER_TIMEOUT, Image.Status.ERROR)
+ .put(Status.ERROR, Image.Status.ERROR)
+ .put(Status.UNRESOLVED, Image.Status.PENDING).build();
+
+ @Singleton
+ @Provides
+ protected Map<Status, Image.Status> toPortableImageStatus() {
+ return toPortableImageStatus;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral<ComputeServiceAdapter<VApp, VAppTemplate, VAppTemplate, Location>>() {
+ }).to(VCloudComputeServiceAdapter.class);
+
+ bind(new TypeLiteral<Function<VApp, NodeMetadata>>() {
+ }).to(VAppToNodeMetadata.class);
+
+ bind(TemplateOptions.class).to(VCloudTemplateOptions.class);
+ bind(TemplateBuilder.class).to(VCloudTemplateBuilderImpl.class);
+
+ bind(new TypeLiteral<Function<VApp, Hardware>>() {
+ }).to(new TypeLiteral<HardwareForVApp>() {
+ });
+
+ bind(new TypeLiteral<Function<Org, Iterable<VAppTemplate>>>() {
+ }).to(VAppTemplatesInOrg.class);
+ bind(new TypeLiteral<Function<VAppTemplate, Image>>() {
+ }).to(ImageForVAppTemplate.class);
+ bind(new TypeLiteral<Function<VAppTemplate, Hardware>>() {
+ }).to(HardwareForVAppTemplate.class);
+
+ // we aren't converting from a provider-specific type
+ bind(new TypeLiteral<Function<Location, Location>>() {
+ }).to(Class.class.cast(IdentityFunction.class));
+ }
+
+
+ @Provides
+ @Singleton
+ public Supplier<NetworkConfig> networkConfig(@Network Supplier<ReferenceType> network,
+ final FenceMode defaultFenceMode) {
+ return Suppliers.compose(new Function<ReferenceType, NetworkConfig>() {
+
+ @Override
+ public NetworkConfig apply(ReferenceType input) {
+ return new NetworkConfig(input.getName(), input.getHref(), defaultFenceMode);
+ }
+
+ }, network);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java
new file mode 100755
index 0000000..346016a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java
@@ -0,0 +1,69 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import java.net.URI;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.Memoized;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class FindLocationForResource implements Function<ReferenceType, Location> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ final Supplier<Set<? extends Location>> locations;
+
+ @Inject
+ public FindLocationForResource(@Memoized Supplier<Set<? extends Location>> locations) {
+ this.locations = locations;
+ }
+
+ /**
+ * searches for a location associated with this resource.
+ *
+ * @throws NoSuchElementException
+ * if not found
+ */
+ public Location apply(ReferenceType resource) {
+ for (Location input : locations.get()) {
+ do {
+ // The "name" isn't always present, ex inside a vApp we have a rel
+ // link that only includes href and type.
+ if (URI.create(input.getId()).equals(resource.getHref()))
+ return input;
+ } while ((input = input.getParent()) != null);
+ }
+ throw new NoSuchElementException(String.format("resource: %s not found in locations: %s", resource,
+ locations.get()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVApp.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVApp.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVApp.java
new file mode 100755
index 0000000..558c78a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVApp.java
@@ -0,0 +1,71 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.HardwareBuilder;
+import org.jclouds.compute.predicates.ImagePredicates;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.VirtualHardwareSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.Vm;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Adrian Cole
+ */
+public class HardwareForVApp implements Function<VApp, Hardware> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final Function<ReferenceType, Location> findLocationForResource;
+ private final VCloudHardwareBuilderFromResourceAllocations rasdToHardwareBuilder;
+
+ @Inject
+ protected HardwareForVApp(Function<ReferenceType, Location> findLocationForResource,
+ VCloudHardwareBuilderFromResourceAllocations rasdToHardwareBuilder) {
+ this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
+ this.rasdToHardwareBuilder = checkNotNull(rasdToHardwareBuilder, "rasdToHardwareBuilder");
+ }
+
+ @Override
+ public Hardware apply(VApp from) {
+ checkNotNull(from, "VApp");
+ // TODO make this work with composite vApps
+ Vm vm = from.getChildren().size() == 0 ? null : Iterables.get(from.getChildren(), 0);
+ if (vm == null)
+ return null;
+
+ VirtualHardwareSection hardware = vm.getVirtualHardwareSection();
+ HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
+ builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
+ builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
+ ImagePredicates.idEquals(from.getHref().toASCIIString()));
+ builder.hypervisor("VMware");
+ return builder.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVAppTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVAppTemplate.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVAppTemplate.java
new file mode 100755
index 0000000..2671c26
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVAppTemplate.java
@@ -0,0 +1,84 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.HardwareBuilder;
+import org.jclouds.compute.predicates.ImagePredicates;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.ovf.VirtualHardwareSection;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class HardwareForVAppTemplate implements Function<VAppTemplate, Hardware> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final Function<VAppTemplate, Envelope> templateToEnvelope;
+ private final FindLocationForResource findLocationForResource;
+ private final VCloudHardwareBuilderFromResourceAllocations rasdToHardwareBuilder;
+
+ @Inject
+ protected HardwareForVAppTemplate(Function<VAppTemplate, Envelope> templateToEnvelope,
+ FindLocationForResource findLocationForResource,
+ VCloudHardwareBuilderFromResourceAllocations rasdToHardwareBuilder) {
+ this.templateToEnvelope = checkNotNull(templateToEnvelope, "templateToEnvelope");
+ this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
+ this.rasdToHardwareBuilder = checkNotNull(rasdToHardwareBuilder, "rasdToHardwareBuilder");
+ }
+
+ @Override
+ public Hardware apply(VAppTemplate from) {
+ checkNotNull(from, "VAppTemplate");
+
+ Envelope ovf = templateToEnvelope.apply(from);
+
+ if (ovf.getVirtualSystem().getVirtualHardwareSections().size() > 1) {
+ logger.warn("multiple hardware choices found. using first", ovf);
+ }
+ VirtualHardwareSection hardware = Iterables.get(ovf.getVirtualSystem().getVirtualHardwareSections(), 0);
+ HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
+ if (from.getVDC() != null) {
+ builder.location(findLocationForResource.apply(from.getVDC()));
+ } else {
+ // otherwise, it could be in a public catalog, which is not assigned to a VDC
+ }
+ builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
+ ImagePredicates.idEquals(from.getHref().toASCIIString()));
+ builder.hypervisor("VMware");
+ return builder.build();
+
+ }
+
+ protected String getName(String name) {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java
new file mode 100755
index 0000000..9afc714
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java
@@ -0,0 +1,82 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.domain.CIMOperatingSystem;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class ImageForVAppTemplate implements Function<VAppTemplate, Image> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ public Logger logger = Logger.NULL;
+
+ private final Map<Status, Image.Status> toPortableImageStatus;
+ private final Function<VAppTemplate, Envelope> templateToEnvelope;
+ private final FindLocationForResource findLocationForResource;
+
+
+ @Inject
+ protected ImageForVAppTemplate(Map<Status, Image.Status> toPortableImageStatus, Function<VAppTemplate, Envelope> templateToEnvelope,
+ FindLocationForResource findLocationForResource) {
+ this.toPortableImageStatus = checkNotNull(toPortableImageStatus, "toPortableImageStatus");
+ this.templateToEnvelope = checkNotNull(templateToEnvelope, "templateToEnvelope");
+ this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
+ }
+
+ @Override
+ public Image apply(VAppTemplate from) {
+ checkNotNull(from, "VAppTemplate");
+ Envelope ovf = templateToEnvelope.apply(from);
+
+ ImageBuilder builder = new ImageBuilder();
+ builder.ids(from.getHref().toASCIIString());
+ builder.uri(from.getHref());
+ builder.name(from.getName());
+ if (from.getVDC() != null) {
+ builder.location(findLocationForResource.apply(from.getVDC()));
+ } else {
+ // otherwise, it could be in a public catalog, which is not assigned to a VDC
+ }
+ builder.description(from.getDescription() != null ? from.getDescription() : from.getName());
+ builder.operatingSystem(CIMOperatingSystem.toComputeOs(ovf));
+ builder.status(toPortableImageStatus.get(from.getStatus()));
+ return builder.build();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadata.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadata.java
new file mode 100755
index 0000000..bebbbce
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadata.java
@@ -0,0 +1,112 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static com.google.common.collect.Iterables.filter;
+import static org.jclouds.compute.util.ComputeServiceUtils.addMetadataAndParseTagsFromCommaDelimitedValue;
+import static org.jclouds.compute.util.ComputeServiceUtils.groupFromMapOrName;
+import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getCredentialsFrom;
+import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getIpsFromVApp;
+import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.toComputeOs;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.NodeMetadataBuilder;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.domain.Credentials;
+import org.jclouds.logging.Logger;
+import org.jclouds.util.InetAddresses2.IsPrivateIPAddress;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+
+import com.google.common.base.Function;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableMap;
+
+/** @author Adrian Cole */
+@Singleton
+public class VAppToNodeMetadata implements Function<VApp, NodeMetadata> {
+ @Resource
+ protected static Logger logger = Logger.NULL;
+
+ protected final FindLocationForResource findLocationForResourceInVDC;
+ protected final Function<VApp, Hardware> hardwareForVApp;
+ protected final Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus;
+ protected final Map<String, Credentials> credentialStore;
+ protected final GroupNamingConvention nodeNamingConvention;
+
+ @Inject
+ protected VAppToNodeMetadata(Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus, Map<String, Credentials> credentialStore,
+ FindLocationForResource findLocationForResourceInVDC, Function<VApp, Hardware> hardwareForVApp,
+ GroupNamingConvention.Factory namingConvention) {
+ this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
+ this.hardwareForVApp = checkNotNull(hardwareForVApp, "hardwareForVApp");
+ this.findLocationForResourceInVDC = checkNotNull(findLocationForResourceInVDC, "findLocationForResourceInVDC");
+ this.credentialStore = checkNotNull(credentialStore, "credentialStore");
+ this.vAppStatusToNodeStatus = checkNotNull(vAppStatusToNodeStatus, "vAppStatusToNodeStatus");
+ }
+
+ public NodeMetadata apply(VApp from) {
+ NodeMetadataBuilder builder = new NodeMetadataBuilder();
+ builder.ids(from.getHref().toASCIIString());
+ builder.uri(from.getHref());
+ builder.name(from.getName());
+ String groupName = "";
+ Map<String, String> metadataMap;
+
+ if (!isNullOrEmpty(from.getDescription())
+ && from.getDescription().indexOf('=') != -1
+ && from.getDescription().indexOf('\n') != -1) {
+ try {
+ metadataMap = Splitter.on('\n').withKeyValueSeparator("=").split(from.getDescription());
+
+ addMetadataAndParseTagsFromCommaDelimitedValue(builder, metadataMap);
+ } catch (IllegalArgumentException iae) {
+ // no op
+ metadataMap = ImmutableMap.of();
+ }
+ } else {
+ metadataMap = ImmutableMap.of();
+ }
+ builder.hostname(from.getName());
+ builder.location(findLocationForResourceInVDC.apply(from.getVDC()));
+ builder.group(groupFromMapOrName(metadataMap, from.getName(), nodeNamingConvention));
+ builder.operatingSystem(toComputeOs(from, null));
+ builder.hardware(hardwareForVApp.apply(from));
+ builder.status(vAppStatusToNodeStatus.get(from.getStatus()));
+ Set<String> addresses = getIpsFromVApp(from);
+ builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE)));
+ builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE));
+
+ // normally, we don't affect the credential store when reading vApps.
+ // However, login user, etc, is actually in the metadata, so lets see
+ Credentials fromApi = getCredentialsFrom(from);
+ if (fromApi != null && !credentialStore.containsKey("node#" + from.getHref().toASCIIString()))
+ credentialStore.put("node#" + from.getHref().toASCIIString(), fromApi);
+ return builder.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VCloudHardwareBuilderFromResourceAllocations.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VCloudHardwareBuilderFromResourceAllocations.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VCloudHardwareBuilderFromResourceAllocations.java
new file mode 100755
index 0000000..302ff47
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VCloudHardwareBuilderFromResourceAllocations.java
@@ -0,0 +1,43 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import javax.inject.Singleton;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.functions.HardwareBuilderFromResourceAllocations;
+import org.jclouds.compute.domain.Volume;
+import org.jclouds.compute.domain.internal.VolumeImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudHardDisk;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class VCloudHardwareBuilderFromResourceAllocations extends HardwareBuilderFromResourceAllocations {
+ @Override
+ public Volume apply(ResourceAllocationSettingData from) {
+ if (from instanceof VCloudHardDisk) {
+ VCloudHardDisk vDisk = VCloudHardDisk.class.cast(from);
+ return new VolumeImpl(from.getAddressOnParent() + "", Volume.Type.LOCAL, vDisk.getCapacity() / 1024f, null,
+ "0".equals(from.getAddressOnParent()), true);
+ } else {
+ return super.apply(from);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException.java
new file mode 100755
index 0000000..cecd812
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException.java
@@ -0,0 +1,77 @@
+/*
+ * 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.vcloud.compute.functions;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.concurrent.ExecutionException;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.cache.LoadingCache;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException implements
+ Function<VAppTemplate, Envelope> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final LoadingCache<URI, Envelope> envelopes;
+
+ @Inject
+ protected ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException(LoadingCache<URI, Envelope> envelopes) {
+ this.envelopes = checkNotNull(envelopes, "envelopes");
+ }
+
+ @Override
+ public Envelope apply(VAppTemplate from) {
+ checkArgument(from.getChildren().size() == 1, "multiple vms are not supported: %s", from);
+
+ checkArgument(from.getNetworkSection().getNetworks().size() == 1,
+ "multiple network connections are not supported: %s", from);
+
+ checkArgument(from.isOvfDescriptorUploaded(), "ovf descriptor is not uploaded: %s", from);
+ Envelope ovf = getOVFForVAppTemplateAndValidate(from);
+ return ovf;
+ }
+
+ private Envelope getOVFForVAppTemplateAndValidate(VAppTemplate from) throws IllegalArgumentException {
+ Envelope ovf;
+ try {
+ ovf = envelopes.get(from.getHref());
+ checkArgument(ovf.getVirtualSystem().getVirtualHardwareSections().size() > 0,
+ "no hardware sections exist in ovf %s", ovf);
+ } catch (ExecutionException e) {
+ throw new IllegalArgumentException("no ovf envelope found for: " + from, e);
+ }
+ return ovf;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/internal/VCloudTemplateBuilderImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/internal/VCloudTemplateBuilderImpl.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/internal/VCloudTemplateBuilderImpl.java
new file mode 100755
index 0000000..49a1f78
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/internal/VCloudTemplateBuilderImpl.java
@@ -0,0 +1,48 @@
+/*
+ * 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.vcloud.compute.internal;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.domain.internal.TemplateBuilderImpl;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.domain.Location;
+
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class VCloudTemplateBuilderImpl extends TemplateBuilderImpl {
+
+ @Inject
+ protected VCloudTemplateBuilderImpl(@Memoized Supplier<Set<? extends Location>> locations,
+ @Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> sizes,
+ Supplier<Location> defaultLocation, @Named("DEFAULT") Provider<TemplateOptions> optionsProvider,
+ @Named("DEFAULT") Provider<TemplateBuilder> defaultTemplateProvider) {
+ super(locations, images, sizes, defaultLocation, optionsProvider, defaultTemplateProvider);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptions.java
new file mode 100755
index 0000000..f60aae2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptions.java
@@ -0,0 +1,350 @@
+/*
+ * 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.vcloud.compute.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Strings.emptyToNull;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Contains options supported in the {@code ComputeService#runNode} operation on
+ * the "vcloud" provider. <h2>
+ * Usage</h2> The recommended way to instantiate a VCloudTemplateOptions object
+ * is to statically import VCloudTemplateOptions.* and invoke a static creation
+ * method followed by an instance mutator (if needed):
+ * <p/>
+ * <code>
+ * import static org.jclouds.compute.options.VCloudTemplateOptions.Builder.*;
+ * <p/>
+ * ComputeService client = // get connection
+ * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
+ * Set<NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
+ * <code>
+ *
+ * @author Adrian Cole
+ */
+public class VCloudTemplateOptions extends TemplateOptions implements Cloneable {
+ @Override
+ public VCloudTemplateOptions clone() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ copyTo(options);
+ return options;
+ }
+
+ @Override
+ public void copyTo(TemplateOptions to) {
+ super.copyTo(to);
+ if (to instanceof VCloudTemplateOptions) {
+ VCloudTemplateOptions eTo = VCloudTemplateOptions.class.cast(to);
+ if (getCustomizationScript() != null)
+ eTo.customizationScript(getCustomizationScript());
+ if (getDescription() != null)
+ eTo.description(getDescription());
+ if (getIpAddressAllocationMode() != null)
+ eTo.ipAddressAllocationMode(getIpAddressAllocationMode());
+ if (getIpAddressAllocationMode() != null)
+ eTo.ipAddressAllocationMode(getIpAddressAllocationMode());
+ if (getParentNetwork() != null)
+ eTo.parentNetwork(getParentNetwork());
+ if (getFenceMode() != null)
+ eTo.fenceMode(getFenceMode());
+ }
+ }
+
+ private String description = null;
+ private String customizationScript = null;
+ private IpAddressAllocationMode ipAddressAllocationMode = null;
+ private URI parentNetwork = null;
+ private FenceMode fenceMode = null;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ VCloudTemplateOptions that = VCloudTemplateOptions.class.cast(o);
+ return super.equals(that) && equal(this.description, that.description)
+ && equal(this.customizationScript, that.customizationScript)
+ && equal(this.ipAddressAllocationMode, that.ipAddressAllocationMode)
+ && equal(this.parentNetwork, that.parentNetwork);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), description, customizationScript, ipAddressAllocationMode,
+ parentNetwork);
+ }
+
+ @Override
+ public ToStringHelper string() {
+ return super.string().add("description", description).add("customizationScript", customizationScript)
+ .add("ipAddressAllocationMode", ipAddressAllocationMode).add("parentNetwork", parentNetwork);
+ }
+
+ /**
+ * Optional description. Used for the Description of the vApp created by this
+ * instantiation.
+ */
+ public VCloudTemplateOptions description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Specifies the customizationScript used to run instances with
+ */
+ public VCloudTemplateOptions customizationScript(String customizationScript) {
+ this.customizationScript = checkNotNull(emptyToNull(customizationScript), "customizationScript must be defined");
+ return this;
+ }
+
+ /**
+ * Specifies the ipAddressAllocationMode used to for network interfaces on
+ * the VMs
+ */
+ public VCloudTemplateOptions ipAddressAllocationMode(IpAddressAllocationMode ipAddressAllocationMode) {
+ this.ipAddressAllocationMode = ipAddressAllocationMode;
+ return this;
+ }
+
+ /**
+ * Specifies the parentNetwork to connect the the network interfaces on the
+ * VMs to.
+ *
+ * @see InstantiateVAppTemplateOptions#addNetworkConfig
+ */
+ public VCloudTemplateOptions parentNetwork(URI parentNetwork) {
+ this.parentNetwork = parentNetwork;
+ return this;
+ }
+
+ /**
+ * How to connect to the parent network
+ *
+ * @see InstantiateVAppTemplateOptions#addNetworkConfig
+ */
+ public VCloudTemplateOptions fenceMode(FenceMode fenceMode) {
+ this.fenceMode = fenceMode;
+ return this;
+ }
+
+ public static class Builder {
+ /**
+ * @see VCloudTemplateOptions#description
+ */
+ public static VCloudTemplateOptions description(String description) {
+ return new VCloudTemplateOptions().description(description);
+ }
+
+ /**
+ * @see VCloudTemplateOptions#customizationScript
+ */
+ public static VCloudTemplateOptions customizationScript(String customizationScript) {
+ return new VCloudTemplateOptions().customizationScript(customizationScript);
+ }
+
+ /**
+ * @see VCloudTemplateOptions#ipAddressAllocationMode
+ */
+ public static VCloudTemplateOptions ipAddressAllocationMode(IpAddressAllocationMode ipAddressAllocationMode) {
+ return new VCloudTemplateOptions().ipAddressAllocationMode(ipAddressAllocationMode);
+ }
+
+ /**
+ * @see VCloudTemplateOptions#parentNetwork(URI parentNetwork)
+ */
+ public static VCloudTemplateOptions parentNetwork(URI parentNetwork) {
+ return new VCloudTemplateOptions().parentNetwork(parentNetwork);
+ }
+
+ /**
+ * @see VCloudTemplateOptions#fenceMode(FenceMode)
+ */
+ public static VCloudTemplateOptions fenceMode(FenceMode fenceMode) {
+ return new VCloudTemplateOptions().fenceMode(fenceMode);
+ }
+
+ // methods that only facilitate returning the correct object type
+ /**
+ * @see TemplateOptions#inboundPorts
+ */
+ public static VCloudTemplateOptions inboundPorts(int... ports) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.inboundPorts(ports));
+ }
+
+ /**
+ * @see TemplateOptions#port
+ */
+ public static VCloudTemplateOptions blockOnPort(int port, int seconds) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.blockOnPort(port, seconds));
+ }
+
+ /**
+ * @see TemplateOptions#userMetadata(Map)
+ */
+ public static VCloudTemplateOptions userMetadata(Map<String, String> userMetadata) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.userMetadata(userMetadata));
+ }
+
+ /**
+ * @see TemplateOptions#userMetadata(String, String)
+ */
+ public static VCloudTemplateOptions userMetadata(String key, String value) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.userMetadata(key, value));
+ }
+
+ /**
+ * @see TemplateOptions#nodeNames(Iterable)
+ */
+ public static VCloudTemplateOptions nodeNames(Iterable<String> nodeNames) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.nodeNames(nodeNames));
+ }
+
+ /**
+ * @see TemplateOptions#networks(Iterable)
+ */
+ public static VCloudTemplateOptions networks(Iterable<String> networks) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.networks(networks));
+ }
+
+ }
+
+ /**
+ * @return description of the vApp
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return customizationScript on the vms
+ */
+ public String getCustomizationScript() {
+ return customizationScript;
+ }
+
+ /**
+ * @return ipAddressAllocationMode on the vms
+ */
+ public IpAddressAllocationMode getIpAddressAllocationMode() {
+ return ipAddressAllocationMode;
+ }
+
+ /**
+ * @return parentNetwork to connect to the vms
+ */
+ public URI getParentNetwork() {
+ return parentNetwork;
+ }
+
+ /**
+ * @return FenceMode to connect the parent network with
+ */
+ public FenceMode getFenceMode() {
+ return fenceMode;
+ }
+
+ // methods that only facilitate returning the correct object type
+
+ /**
+ * @see TemplateOptions#blockOnPort
+ */
+ @Override
+ public VCloudTemplateOptions blockOnPort(int port, int seconds) {
+ return VCloudTemplateOptions.class.cast(super.blockOnPort(port, seconds));
+ }
+
+ /**
+ *
+ * special thing is that we do assume if you are passing groups that you have
+ * everything you need already defined. for example, our option inboundPorts
+ * normally creates ingress rules accordingly but if we notice you've
+ * specified securityGroups, we do not mess with rules at all
+ *
+ * @see TemplateOptions#inboundPorts
+ */
+ @Override
+ public VCloudTemplateOptions inboundPorts(int... ports) {
+ return VCloudTemplateOptions.class.cast(super.inboundPorts(ports));
+ }
+
+ /**
+ * @see TemplateOptions#authorizePublicKey(String)
+ */
+ @Override
+ public VCloudTemplateOptions authorizePublicKey(String publicKey) {
+ return VCloudTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
+ }
+
+ /**
+ * @see TemplateOptions#installPrivateKey(String)
+ */
+ @Override
+ public VCloudTemplateOptions installPrivateKey(String privateKey) {
+ return VCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudTemplateOptions userMetadata(Map<String, String> userMetadata) {
+ return VCloudTemplateOptions.class.cast(super.userMetadata(userMetadata));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudTemplateOptions userMetadata(String key, String value) {
+ return VCloudTemplateOptions.class.cast(super.userMetadata(key, value));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudTemplateOptions nodeNames(Iterable<String> nodeNames) {
+ return VCloudTemplateOptions.class.cast(super.nodeNames(nodeNames));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudTemplateOptions networks(Iterable<String> networks) {
+ return VCloudTemplateOptions.class.cast(super.networks(networks));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
new file mode 100755
index 0000000..caecde6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
@@ -0,0 +1,302 @@
+/*
+ * 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.vcloud.compute.strategy;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.collect.Iterables.find;
+import static com.google.common.collect.Iterables.get;
+import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
+import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
+import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getCredentialsFrom;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Network;
+import org.jclouds.predicates.validators.DnsNameValidator;
+import org.jclouds.rest.annotations.BuildVersion;
+import org.jclouds.vcloud.TaskStillRunningException;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection.Builder;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicate;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Adrian Cole
+ */
+@Singleton
+public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected final VCloudApi client;
+ protected final Predicate<URI> successTester;
+ protected final LoadingCache<URI, VAppTemplate> vAppTemplates;
+ protected final NetworkConfigurationForNetworkAndOptions networkConfigurationForNetworkAndOptions;
+ protected final String buildVersion;
+
+
+ @Inject
+ protected InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn(VCloudApi client,
+ Predicate<URI> successTester, LoadingCache<URI, VAppTemplate> vAppTemplates, NetworkConfigurationForNetworkAndOptions networkConfigurationForNetworkAndOptions,
+ @BuildVersion String buildVersion) {
+ this.client = client;
+ this.successTester = successTester;
+ this.vAppTemplates = vAppTemplates;
+ this.networkConfigurationForNetworkAndOptions = networkConfigurationForNetworkAndOptions;
+ this.buildVersion = buildVersion;
+ }
+
+ /**
+ * per john ellis at bluelock, vCloud Director 1.5 is more strict than earlier versions.
+ * <p/>
+ * It appears to be 15 characters to match Windows' hostname limitation. Must be alphanumeric, at
+ * least one non-number character and hyphens and underscores are the only non-alpha character
+ * allowed.
+ */
+ public static enum ComputerNameValidator {
+ INSTANCE;
+
+ private DnsNameValidator validator;
+
+ ComputerNameValidator() {
+ this.validator = new DnsNameValidator(3, 15);
+ }
+
+ public void validate(@Nullable String t) throws IllegalArgumentException {
+ this.validator.validate(t);
+ }
+
+ }
+
+ public NodeAndInitialCredentials<VApp> createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
+ // no sense waiting until failures occur later
+ ComputerNameValidator.INSTANCE.validate(name);
+ VApp vAppResponse = instantiateVAppFromTemplate(name, template);
+ waitForTask(vAppResponse.getTasks().get(0));
+ logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
+
+ // vm data is available after instantiate completes
+ vAppResponse = client.getVAppApi().getVApp(vAppResponse.getHref());
+
+ // per above check, we know there is only a single VM
+ Vm vm = get(vAppResponse.getChildren(), 0);
+
+ template.getOptions().userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
+ VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());
+
+ // note we cannot do tasks in parallel or VCD will throw "is busy" errors
+
+ // note we must do this before any other customizations as there is a dependency on
+ // valid naming conventions before you can perform commands such as updateCPUCount
+ logger.trace(">> updating customization vm(%s) name->(%s)", vm.getName(), name);
+ waitForTask(updateVmWithNameAndCustomizationScript(vm, name, vOptions.getCustomizationScript()));
+ logger.trace("<< updated customization vm(%s)", name);
+
+ ensureVmHasAllocationModeOrPooled(vAppResponse, vOptions.getIpAddressAllocationMode());
+
+ int cpuCount = (int) getCores(template.getHardware());
+ logger.trace(">> updating cpuCount(%d) vm(%s)", cpuCount, vm.getName());
+ waitForTask(updateCPUCountOfVm(vm, cpuCount));
+ logger.trace("<< updated cpuCount vm(%s)", vm.getName());
+ int memoryMB = template.getHardware().getRam();
+ logger.trace(">> updating memoryMB(%d) vm(%s)", memoryMB, vm.getName());
+ waitForTask(updateMemoryMBOfVm(vm, memoryMB));
+ logger.trace("<< updated memoryMB vm(%s)", vm.getName());
+ logger.trace(">> deploying vApp(%s)", vAppResponse.getName());
+ waitForTask(client.getVAppApi().deployVApp(vAppResponse.getHref()));
+ logger.trace("<< deployed vApp(%s)", vAppResponse.getName());
+
+ // only after deploy is the password valid
+ vAppResponse = client.getVAppApi().getVApp(vAppResponse.getHref());
+
+ logger.trace(">> powering on vApp(%s)", vAppResponse.getName());
+ client.getVAppApi().powerOnVApp(vAppResponse.getHref());
+
+ return new NodeAndInitialCredentials<VApp>(vAppResponse, vAppResponse.getHref().toASCIIString(),
+ getCredentialsFrom(vAppResponse));
+
+ }
+
+ @VisibleForTesting
+ protected VApp instantiateVAppFromTemplate(String name, Template template) {
+ VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());
+
+ URI templateId = URI.create(template.getImage().getId());
+
+ VAppTemplate vAppTemplate = vAppTemplates.getUnchecked(templateId);
+
+ if (vAppTemplate.getChildren().size() > 1)
+ throw new UnsupportedOperationException("we currently do not support multiple vms in a vAppTemplate "
+ + vAppTemplate);
+
+ if (vAppTemplate.getNetworkSection().getNetworks().size() > 1)
+ throw new UnsupportedOperationException(
+ "we currently do not support multiple network connections in a vAppTemplate " + vAppTemplate);
+
+ Network networkToConnect = get(vAppTemplate.getNetworkSection().getNetworks(), 0);
+
+
+ NetworkConfig config = networkConfigurationForNetworkAndOptions.apply(networkToConnect, vOptions);
+
+ // note that in VCD 1.5, the network name after instantiation will be the same as the parent
+ InstantiateVAppTemplateOptions options = addNetworkConfig(config);
+
+ // TODO make disk size specifiable
+ // disk((long) ((template.getHardware().getVolumes().get(0).getSize()) *
+ // 1024 * 1024l));
+
+
+
+ String description = VCloudTemplateOptions.class.cast(template.getOptions()).getDescription();
+ if (description == null) {
+ Map<String, String> md = metadataAndTagsAsCommaDelimitedValue(template.getOptions());
+ description = Joiner.on('\n').withKeyValueSeparator("=").join(md);
+ }
+
+ options.description(description);
+ options.deploy(false);
+ options.powerOn(false);
+
+ URI VDC = URI.create(template.getLocation().getId());
+
+ logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
+
+ VApp vAppResponse = client.getVAppTemplateApi().createVAppInVDCByInstantiatingTemplate(name, VDC, templateId,
+ options);
+ return vAppResponse;
+ }
+
+ // TODO: filtering on "none" is a hack until we can filter on
+ // vAppTemplate.getNetworkConfigSection().getNetworkConfigs() where
+ // name = getChildren().NetworkConnectionSection.connection where ipallocationmode == none
+ static Predicate<Network> networkWithNoIpAllocation = new Predicate<Network>() {
+
+ @Override
+ public boolean apply(Network input) {
+ return "none".equals(input.getName());
+ }
+
+ };
+
+ public void waitForTask(Task task) {
+ if (!successTester.apply(task.getHref())) {
+ throw new TaskStillRunningException(task);
+ }
+ }
+ /**
+ * Naming constraints modifying a VM on a VApp in vCloud Director (at least v1.5) can be more
+ * strict than those in a vAppTemplate. For example, while it is possible to instantiate a
+ * vAppTemplate with a VM named (incorrectly) {@code Ubuntu_10.04}, you must change the name to a
+ * valid (alphanumeric underscore) name before you can update it.
+ */
+ public Task updateVmWithNameAndCustomizationScript(Vm vm, String name, @Nullable String customizationScript) {
+ GuestCustomizationSection guestConfiguration = vm.getGuestCustomizationSection();
+ guestConfiguration.setComputerName(name);
+ if (customizationScript != null) {
+ // In version 1.0.0, the api returns a script that loses newlines, so we cannot append to a
+ // customization script.
+ // TODO: parameterize whether to overwrite or append existing customization
+ if (!buildVersion.startsWith("1.0.0") && !"".endsWith(buildVersion)
+ && guestConfiguration.getCustomizationScript() != null)
+ customizationScript = guestConfiguration.getCustomizationScript() + "\n" + customizationScript;
+
+ guestConfiguration.setCustomizationScript(customizationScript);
+ }
+ return client.getVmApi().updateGuestCustomizationOfVm(guestConfiguration, vm.getHref());
+ }
+
+ public void ensureVmHasAllocationModeOrPooled(VApp vApp, @Nullable IpAddressAllocationMode ipAllocationMode) {
+ Network networkToConnect = find(vApp.getNetworkSection().getNetworks(), not(networkWithNoIpAllocation));
+
+ Vm vm = get(vApp.getChildren(), 0);
+
+ NetworkConnectionSection net = vm.getNetworkConnectionSection();
+ checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm);
+
+ NetworkConnection toConnect = findWithPoolAllocationOrFirst(net);
+
+ if (ipAllocationMode == null)
+ ipAllocationMode = toConnect.getIpAddressAllocationMode();
+
+ // make sure that we are in fact allocating ips
+ if (ipAllocationMode == IpAddressAllocationMode.NONE)
+ ipAllocationMode = IpAddressAllocationMode.POOL;
+
+ if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode
+ && toConnect.getNetwork().equals(networkToConnect.getName())) {
+ // then we don't need to change the network settings, and can save a call
+ } else {
+ Builder builder = net.toBuilder();
+ builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true)
+ .ipAddressAllocationMode(ipAllocationMode).build()));
+ logger.trace(">> updating networkConnection vm(%s)", vm.getName());
+
+ waitForTask(client.getVmApi().updateNetworkConnectionOfVm(builder.build(), vm.getHref()));
+ logger.trace("<< updated networkConnection vm(%s)", vm.getName());
+
+ }
+
+ }
+
+ private NetworkConnection findWithPoolAllocationOrFirst(NetworkConnectionSection net) {
+ return find(net.getConnections(), new Predicate<NetworkConnection>() {
+
+ @Override
+ public boolean apply(NetworkConnection input) {
+ return input.getIpAddressAllocationMode() == IpAddressAllocationMode.POOL;
+ }
+
+ }, get(net.getConnections(), 0));
+ }
+
+ public Task updateCPUCountOfVm(Vm vm, int cpuCount) {
+ return client.getVmApi().updateCPUCountOfVm(cpuCount, vm.getHref());
+ }
+
+ public Task updateMemoryMBOfVm(Vm vm, int memoryInMB) {
+ return client.getVmApi().updateMemoryMBOfVm(memoryInMB, vm.getHref());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/NetworkConfigurationForNetworkAndOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/NetworkConfigurationForNetworkAndOptions.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/NetworkConfigurationForNetworkAndOptions.java
new file mode 100755
index 0000000..7719efb
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/NetworkConfigurationForNetworkAndOptions.java
@@ -0,0 +1,80 @@
+/*
+ * 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.vcloud.compute.strategy;
+
+import java.net.URI;
+
+import javax.inject.Inject;
+
+import org.jclouds.ovf.Network;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Supplier;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Beta
+public class NetworkConfigurationForNetworkAndOptions {
+ protected final Supplier<NetworkConfig> defaultNetworkConfig;
+ protected final FenceMode defaultFenceMode;
+
+ @Inject
+ protected NetworkConfigurationForNetworkAndOptions(Supplier<NetworkConfig> defaultNetworkConfig,
+ FenceMode defaultFenceMode) {
+ this.defaultNetworkConfig = defaultNetworkConfig;
+ this.defaultFenceMode = defaultFenceMode;
+ }
+
+ /**
+ *
+ * returns a {@link NetworkConfig} used to instantiate a vAppTemplate to
+ * either the default parent (org) network, or one specified by options.
+ *
+ * @param networkToConnect
+ * network defined in the VAppTemplate you wish to connect to
+ * @param vOptions
+ * options to override defaults with
+ * @return
+ */
+ public NetworkConfig apply(Network networkToConnect, VCloudTemplateOptions vOptions) {
+ NetworkConfig config;
+ URI userDefinedParentNetwork = vOptions.getParentNetwork();
+ FenceMode fenceMode = vOptions.getFenceMode() != null ? vOptions.getFenceMode() : defaultFenceMode;
+ if (userDefinedParentNetwork != null) {
+ config = NetworkConfig.builder().networkName("jclouds").fenceMode(fenceMode)
+ .parentNetwork(userDefinedParentNetwork).build();
+ } else {
+ config = defaultNetworkConfig.get().toBuilder().fenceMode(fenceMode).build();
+ }
+
+ // if we only have a disconnected network, we are adding a new section
+ // for the upstream
+ if (InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.networkWithNoIpAllocation
+ .apply(networkToConnect)) {
+ // TODO: remove the disconnected entry
+ } else {
+ config = config.toBuilder().networkName(networkToConnect.getName()).build();
+ }
+ return config;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java
new file mode 100755
index 0000000..377c8f9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java
@@ -0,0 +1,263 @@
+/*
+ * 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.vcloud.compute.strategy;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.contains;
+import static com.google.common.collect.Iterables.filter;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.util.Throwables2;
+import org.jclouds.vcloud.TaskInErrorStateException;
+import org.jclouds.vcloud.TaskStillRunningException;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.suppliers.VAppTemplatesSupplier;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+
+/**
+ * defines the connection between the {@link org.jclouds.vcloud.VCloudApi} implementation and the jclouds
+ * {@link ComputeService}
+ *
+ */
+@Singleton
+public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp, VAppTemplate, VAppTemplate, Location> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected final VCloudApi client;
+ protected final Predicate<URI> successTester;
+ protected final InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn booter;
+ protected final Supplier<Map<String, Org>> nameToOrg;
+ protected final Supplier<Set<VAppTemplate>> templates;
+ protected final Function<VAppTemplate, Envelope> templateToEnvelope;
+
+ @Inject
+ protected VCloudComputeServiceAdapter(VCloudApi client, Predicate<URI> successTester,
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn booter,
+ Supplier<Map<String, Org>> nameToOrg, VAppTemplatesSupplier templates,
+ Function<VAppTemplate, Envelope> templateToEnvelope) {
+ this.client = checkNotNull(client, "client");
+ this.successTester = checkNotNull(successTester, "successTester");
+ this.booter = checkNotNull(booter, "booter");
+ this.nameToOrg = checkNotNull(nameToOrg, "nameToOrg");
+ this.templates = checkNotNull(templates, "templates");
+ this.templateToEnvelope = checkNotNull(templateToEnvelope, "templateToEnvelope");
+ }
+
+ @Override
+ public NodeAndInitialCredentials<VApp> createNodeWithGroupEncodedIntoName(String group, String name,
+ Template template) {
+ return booter.createNodeWithGroupEncodedIntoName(group, name, template);
+ }
+
+ @Override
+ public Iterable<VAppTemplate> listHardwareProfiles() {
+ return supportedTemplates();
+ }
+
+ private Iterable<VAppTemplate> supportedTemplates() {
+ return filter(templates.get(), new Predicate<VAppTemplate>() {
+
+ @Override
+ public boolean apply(VAppTemplate from) {
+ try {
+ templateToEnvelope.apply(from);
+ } catch (IllegalArgumentException e) {
+ logger.warn("Unsupported: " + e.getMessage());
+ return false;
+ } catch (RuntimeException e) {
+ IllegalArgumentException e2 = Throwables2.getFirstThrowableOfType(e, IllegalArgumentException.class);
+ if (e2 != null) {
+ logger.warn("Unsupported: " + e2.getMessage());
+ return false;
+ } else {
+ throw e;
+ }
+ }
+ return true;
+ }
+
+ });
+ }
+
+ @Override
+ public Iterable<VAppTemplate> listImages() {
+ return supportedTemplates();
+ }
+
+ @Override
+ public Iterable<VApp> listNodes() {
+ // TODO: parallel or cache
+ Builder<VApp> nodes = ImmutableSet.builder();
+ for (Org org : nameToOrg.get().values()) {
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ for (ReferenceType resource : client.getVDCApi().getVDC(vdc.getHref()).getResourceEntities().values()) {
+ if (resource.getType().equals(VCloudMediaType.VAPP_XML)) {
+ addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource);
+ }
+ }
+ }
+ }
+ return nodes.build();
+ }
+
+ @Override
+ public Iterable<VApp> listNodesByIds(final Iterable<String> ids) {
+ return filter(listNodes(), new Predicate<VApp>() {
+
+ @Override
+ public boolean apply(VApp vm) {
+ return contains(ids, vm.getHref().toASCIIString());
+ }
+ });
+ }
+
+ @VisibleForTesting
+ void addVAppToSetRetryingIfNotYetPresent(Builder<VApp> nodes, ReferenceType vdc, ReferenceType resource) {
+ VApp node = null;
+ int i = 0;
+ while (node == null && i++ < 3) {
+ try {
+ node = client.getVAppApi().getVApp(resource.getHref());
+ nodes.add(node);
+ } catch (NullPointerException e) {
+ logger.warn("vApp %s not yet present in vdc %s", resource.getName(), vdc.getName());
+ }
+ }
+ }
+
+ @Override
+ public Iterable<Location> listLocations() {
+ // Not using the adapter to determine locations
+ return ImmutableSet.<Location>of();
+ }
+
+ @Override
+ public VApp getNode(String in) {
+ URI id = URI.create(in);
+ return client.getVAppApi().getVApp(id);
+ }
+
+ @Override
+ public VAppTemplate getImage(String in) {
+ URI id = URI.create(in);
+ return client.getVAppTemplateApi().getVAppTemplate(id);
+ }
+
+ @Override
+ public void destroyNode(String id) {
+ URI vappId = URI.create(checkNotNull(id, "node.id"));
+ VApp vApp = cancelAnyRunningTasks(vappId);
+ if (vApp.getStatus() != Status.OFF) {
+ logger.debug(">> powering off VApp vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
+ try {
+ waitForTask(client.getVAppApi().powerOffVApp(vApp.getHref()));
+ vApp = client.getVAppApi().getVApp(vApp.getHref());
+ logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
+ } catch (IllegalStateException e) {
+ logger.warn(e, "<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
+ }
+ logger.debug(">> undeploying vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
+ try {
+ waitForTask(client.getVAppApi().undeployVApp(vApp.getHref()));
+ vApp = client.getVAppApi().getVApp(vApp.getHref());
+ logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
+ } catch (IllegalStateException e) {
+ logger.warn(e, "<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
+ }
+ }
+ logger.debug(">> deleting vApp(%s)", vApp.getHref());
+ waitForTask(client.getVAppApi().deleteVApp(vApp.getHref()));
+ logger.debug("<< deleted vApp(%s)", vApp.getHref());
+ }
+
+ VApp waitForPendingTasksToComplete(URI vappId) {
+ VApp vApp = client.getVAppApi().getVApp(vappId);
+ if (vApp.getTasks().size() == 0)
+ return vApp;
+ for (Task task : vApp.getTasks())
+ waitForTask(task);
+ return client.getVAppApi().getVApp(vappId);
+ }
+
+ VApp cancelAnyRunningTasks(URI vappId) {
+ VApp vApp = client.getVAppApi().getVApp(vappId);
+ if (vApp.getTasks().size() == 0)
+ return vApp;
+ for (Task task : vApp.getTasks()) {
+ try {
+ client.getTaskApi().cancelTask(task.getHref());
+ waitForTask(task);
+ } catch (TaskInErrorStateException e) {
+ }
+ }
+ return client.getVAppApi().getVApp(vappId);
+
+ }
+
+ public void waitForTask(Task task) {
+ if (!successTester.apply(task.getHref()))
+ throw new TaskStillRunningException(task);
+ }
+
+ @Override
+ public void rebootNode(String in) {
+ URI id = URI.create(checkNotNull(in, "node.id"));
+ waitForTask(client.getVAppApi().resetVApp(id));
+ }
+
+ @Override
+ public void resumeNode(String in) {
+ URI id = URI.create(checkNotNull(in, "node.id"));
+ waitForTask(client.getVAppApi().powerOnVApp(id));
+ }
+
+ @Override
+ public void suspendNode(String in) {
+ URI id = URI.create(checkNotNull(in, "node.id"));
+ waitForTask(client.getVAppApi().powerOffVApp(id));
+ }
+}
[17/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/ovf-multi-vm.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/ovf-multi-vm.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/ovf-multi-vm.xml
new file mode 100755
index 0000000..fa4bb37
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/ovf-multi-vm.xml
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ovf:Envelope xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <ovf:References/>
+ <ovf:NetworkSection>
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="vapp net">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <vcloud:NetworkConfigSection ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <vcloud:NetworkConfig networkName="vapp net">
+ <vcloud:Description/>
+ <vcloud:Configuration>
+ <vcloud:IpScope>
+ <vcloud:IsInherited>false</vcloud:IsInherited>
+ <vcloud:Gateway>192.168.2.1</vcloud:Gateway>
+ <vcloud:Netmask>255.255.255.0</vcloud:Netmask>
+ <vcloud:Dns1>195.225.219.131</vcloud:Dns1>
+ <vcloud:IpRanges>
+ <vcloud:IpRange>
+ <vcloud:StartAddress>192.168.2.100</vcloud:StartAddress>
+ <vcloud:EndAddress>192.168.2.199</vcloud:EndAddress>
+ </vcloud:IpRange>
+ </vcloud:IpRanges>
+ </vcloud:IpScope>
+ <vcloud:FenceMode>isolated</vcloud:FenceMode>
+ <vcloud:Features>
+ <vcloud:DhcpService>
+ <vcloud:IsEnabled>false</vcloud:IsEnabled>
+ <vcloud:DefaultLeaseTime>7200</vcloud:DefaultLeaseTime>
+ <vcloud:MaxLeaseTime>7200</vcloud:MaxLeaseTime>
+ <vcloud:IpRange/>
+ </vcloud:DhcpService>
+ </vcloud:Features>
+ </vcloud:Configuration>
+ <vcloud:IsDeployed>false</vcloud:IsDeployed>
+ </vcloud:NetworkConfig>
+ </vcloud:NetworkConfigSection>
+ <vcloud:LeaseSettingsSection ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <vcloud:DeploymentLeaseInSeconds>0</vcloud:DeploymentLeaseInSeconds>
+ <vcloud:StorageLeaseInSeconds>0</vcloud:StorageLeaseInSeconds>
+ </vcloud:LeaseSettingsSection>
+ <vcloud:CustomizationSection ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <vcloud:CustomizeOnInstantiate>true</vcloud:CustomizeOnInstantiate>
+ </vcloud:CustomizationSection>
+ <ovf:VirtualSystemCollection ovf:id="centos-web/db-5.5">
+ <ovf:Info>A collection of virtual machines: </ovf:Info>
+ <ovf:Name>centos-web/db-5.5</ovf:Name>
+ <ovf:StartupSection>
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="centos-web"/>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="centos-db"/>
+ </ovf:StartupSection>
+ <ovf:VirtualSystem ovf:id="centos-db">
+ <ovf:Info>A virtual machine: </ovf:Info>
+ <ovf:Name>centos-db</ovf:Name>
+ <ovf:OperatingSystemSection xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="100" vmw:osType="other26xLinux64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Other 2.6x Linux (64-bit)</ovf:Description>
+ </ovf:OperatingSystemSection>
+ <ovf:VirtualHardwareSection>
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>centos-db</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:06:81</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="192.168.2.100" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">vapp net</rasd:Connection>
+
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="8192" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3000</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>2048 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ </ovf:VirtualHardwareSection>
+ <vcloud:NetworkConnectionSection ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
+ <vcloud:NetworkConnection network="vapp net">
+ <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
+ <vcloud:IpAddress>192.168.2.100</vcloud:IpAddress>
+ <vcloud:IsConnected>true</vcloud:IsConnected>
+ <vcloud:MACAddress>00:50:56:01:06:81</vcloud:MACAddress>
+ <vcloud:IpAddressAllocationMode>POOL</vcloud:IpAddressAllocationMode>
+ </vcloud:NetworkConnection>
+ </vcloud:NetworkConnectionSection>
+ <vcloud:GuestCustomizationSection ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <vcloud:Enabled>true</vcloud:Enabled>
+ <vcloud:ChangeSid>false</vcloud:ChangeSid>
+ <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+ <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+ <vcloud:AdminPasswordEnabled>false</vcloud:AdminPasswordEnabled>
+ <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+ <vcloud:ResetPasswordRequired>false</vcloud:ResetPasswordRequired>
+ <vcloud:ComputerName>centos-db</vcloud:ComputerName>
+ </vcloud:GuestCustomizationSection>
+ </ovf:VirtualSystem>
+ <ovf:VirtualSystem ovf:id="centos-web">
+ <ovf:Info>A virtual machine: </ovf:Info>
+ <ovf:Name>centos-web</ovf:Name>
+ <ovf:OperatingSystemSection xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="100" vmw:osType="other26xLinux64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Other 2.6x Linux (64-bit)</ovf:Description>
+ </ovf:OperatingSystemSection>
+ <ovf:VirtualHardwareSection>
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>centos-web</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:06:82</rasd:Address> <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="192.168.2.101" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">vapp net</rasd:Connection>
+
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="8192" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3000</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>2048 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ </ovf:VirtualHardwareSection>
+ <vcloud:NetworkConnectionSection ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
+ <vcloud:NetworkConnection network="vapp net">
+ <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
+ <vcloud:IpAddress>192.168.2.101</vcloud:IpAddress>
+ <vcloud:IsConnected>true</vcloud:IsConnected>
+ <vcloud:MACAddress>00:50:56:01:06:82</vcloud:MACAddress>
+ <vcloud:IpAddressAllocationMode>POOL</vcloud:IpAddressAllocationMode>
+ </vcloud:NetworkConnection>
+ </vcloud:NetworkConnectionSection>
+ <vcloud:GuestCustomizationSection ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <vcloud:Enabled>true</vcloud:Enabled>
+ <vcloud:ChangeSid>false</vcloud:ChangeSid>
+ <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+ <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+ <vcloud:AdminPasswordEnabled>false</vcloud:AdminPasswordEnabled>
+ <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+ <vcloud:ResetPasswordRequired>false</vcloud:ResetPasswordRequired>
+ <vcloud:ComputerName>centos-web</vcloud:ComputerName>
+ </vcloud:GuestCustomizationSection>
+ </ovf:VirtualSystem>
+ </ovf:VirtualSystemCollection>
+</ovf:Envelope>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/ovf-ubuntu64.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/ovf-ubuntu64.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/ovf-ubuntu64.xml
new file mode 100755
index 0000000..7679573
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/ovf-ubuntu64.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ovf:Envelope xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <ovf:References/>
+ <ovf:NetworkSection>
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="none">
+ <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <vcloud:NetworkConfigSection ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <vcloud:NetworkConfig networkName="none">
+ <vcloud:Description>This is a special place-holder used for disconnected network interfaces.</vcloud:Description>
+ <vcloud:Configuration>
+ <vcloud:IpScope>
+ <vcloud:IsInherited>false</vcloud:IsInherited>
+ <vcloud:Gateway>196.254.254.254</vcloud:Gateway>
+ <vcloud:Netmask>255.255.0.0</vcloud:Netmask>
+ <vcloud:Dns1>196.254.254.254</vcloud:Dns1>
+ </vcloud:IpScope>
+ <vcloud:FenceMode>isolated</vcloud:FenceMode>
+ </vcloud:Configuration>
+ <vcloud:IsDeployed>false</vcloud:IsDeployed>
+ </vcloud:NetworkConfig>
+ </vcloud:NetworkConfigSection>
+ <vcloud:LeaseSettingsSection ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <vcloud:DeploymentLeaseInSeconds>0</vcloud:DeploymentLeaseInSeconds>
+ <vcloud:StorageLeaseInSeconds>5184000</vcloud:StorageLeaseInSeconds>
+ <vcloud:StorageLeaseExpiration>2012-03-12T17:40:44.491-06:00</vcloud:StorageLeaseExpiration>
+ </vcloud:LeaseSettingsSection>
+ <vcloud:CustomizationSection ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <vcloud:CustomizeOnInstantiate>true</vcloud:CustomizeOnInstantiate>
+ </vcloud:CustomizationSection>
+ <ovf:VirtualSystem ovf:id="UbuntuServer-x64-2GB">
+ <ovf:Info>A virtual machine: </ovf:Info>
+ <ovf:Name>UbuntuServer-x64-2GB</ovf:Name>
+ <ovf:OperatingSystemSection xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="94" vmw:osType="ubuntu64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Ubuntu Linux (64-bit)</ovf:Description>
+ </ovf:OperatingSystemSection>
+ <ovf:VirtualHardwareSection>
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>UbuntuServer-x64-2GB</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:02:9f</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="NONE">none</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="2048" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3000</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>256 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>256</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ </ovf:VirtualHardwareSection>
+ <vcloud:NetworkConnectionSection ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
+ <vcloud:NetworkConnection network="none">
+ <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
+ <vcloud:IsConnected>false</vcloud:IsConnected>
+ <vcloud:MACAddress>00:50:56:01:02:9f</vcloud:MACAddress>
+ <vcloud:IpAddressAllocationMode>NONE</vcloud:IpAddressAllocationMode>
+ </vcloud:NetworkConnection>
+ </vcloud:NetworkConnectionSection>
+ <vcloud:GuestCustomizationSection ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <vcloud:Enabled>true</vcloud:Enabled>
+ <vcloud:ChangeSid>false</vcloud:ChangeSid>
+ <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+ <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+ <vcloud:AdminPasswordEnabled>true</vcloud:AdminPasswordEnabled>
+ <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+ <vcloud:ResetPasswordRequired>false</vcloud:ResetPasswordRequired>
+ <vcloud:ComputerName>UbuntuServer</vcloud:ComputerName>
+ </vcloud:GuestCustomizationSection>
+ </ovf:VirtualSystem>
+</ovf:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-1.0.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-1.0.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-1.0.xml
new file mode 100755
index 0000000..20fde3f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-1.0.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Task status="running" startTime="2010-08-23T02:09:52.443-04:00"
+ operation="Creating Virtual Application vApp_acole_2(607806320)"
+ expiryTime="2010-11-21T02:09:52.443-05:00" endTime="9999-12-31T23:59:59.999-05:00"
+ type="application/vnd.vmware.vcloud.task+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/task/3cc08ir8oczbze3n1a3">
+ <Owner type="application/vnd.vmware.vcloud.vApp+xml" name="vApp_acole_2"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+</Task>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-error.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-error.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-error.xml
new file mode 100755
index 0000000..77147f8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-error.xml
@@ -0,0 +1,9 @@
+<Task href="http://10.150.4.49/api/v0.8/task/23" type="application/vnd.vmware.vcloud.task+xml"
+ status="error" startTime="2009-12-07T19:05:02" endTime="2009-12-10T14:40:32">
+ <Owner href="http://10.150.4.49/api/v0.8/org/1" type="application/vnd.vmware.vcloud.org+xml"
+ name="APIOrg" />
+ <Result href="http://10.150.4.49/api/v0.8/vapp/1" type="application/vnd.vmware.vcloud.vApp+xml"
+ name="testapp1" />
+ <Error message="Error processing job" majorErrorCode="500"
+ minorErrorCode=" Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00" />
+</Task>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-hosting.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-hosting.xml
new file mode 100755
index 0000000..f4af4a2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-hosting.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Task href="https://vcloud.safesecureweb.com/api/v0.8/task/97806" xmlns="http://www.vmware.com/vcloud/v0.8"
+ xmlns:common="http://www.vmware.com/vcloud/common"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/task
+ https://vcloud.safesecureweb.com/ns/vcloud/task-1.0.xsd
+ http://www.vmware.com/vcloud/common
+ https://vcloud.safesecureweb.com/ns/vcloud/common-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ status="success" startTime="2010-01-14T20:04:51Z" endTime="2010-01-14T20:05:02Z" expiryTime="2010-01-15T20:05:02Z">
+
+ <Owner href="https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96" type="application/vnd.vmware.vcloud.vApp+xml" name="188849-96" />
+</Task>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-self.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-self.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-self.xml
new file mode 100755
index 0000000..4a17424
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-self.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Task xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:common="http://www/vmware.com/vcloud/common"
+ xsi:schemaLocation="http://www/vmware.com/vcloud/task
+ https://vcloud.safesecureweb.com/ns/vcloud/task-1.0.xsd
+ http://www.vmware.com/vcloud/common
+ https://vcloud.safesecureweb.com/ns/vcloud/common-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" status="queued">
+ <Link rel="self"
+ href="https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"
+ type="application/vnd.vmware.vcloud.task+xml" />
+</Task>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-vcd15.xml
new file mode 100755
index 0000000..452287d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task-vcd15.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vcloud:Task xmlns:vcloud="http://www.vmware.com/vcloud/v1" status="running" startTime="2012-03-15T22:47:02.058-06:00" operation="Updating Virtual Machine UbuntuServer-x64-2GB(c9004a47-5e21-4cf1-860c-670d8965b24a)" expiryTime="2012-06-13T22:47:02.058-06:00" type="application/vnd.vmware.vcloud.task+xml" href="https://mycloud.greenhousedata.com/api/v1.0/task/77a33fd4-3401-423c-8167-6711fc51ee9a" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://mycloud.greenhousedata.com/api/v1.0/schema/master.xsd">
+ <vcloud:Link rel="task:cancel" href="https://mycloud.greenhousedata.com/api/v1.0/task/77a33fd4-3401-423c-8167-6711fc51ee9a/action/cancel"/>
+ <vcloud:Owner type="application/vnd.vmware.vcloud.vm+xml" name="UbuntuServer-x64-2GB" href="https://mycloud.greenhousedata.com/api/v1.0/vApp/vm-c9004a47-5e21-4cf1-860c-670d8965b24a"/>
+</vcloud:Task>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task.xml
new file mode 100755
index 0000000..bd0514e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/task.xml
@@ -0,0 +1,8 @@
+<Task href="https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"
+ status="success" startTime="2009-08-24T21:29:32.983Z" endTime="2009-08-24T21:29:44.65Z">
+ <Owner href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1"
+ type="application/vnd.vmware.vcloud.vdc+xml" name="VDC Name" />
+ <Result
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="Server1" />
+</Task>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/taskslist-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/taskslist-hosting.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/taskslist-hosting.xml
new file mode 100755
index 0000000..1511d13
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/taskslist-hosting.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tasks xmlns="http://www.vmware.com/vcloud/tasks" xmlns:common="http://www.vmware.com/vcloud/v0.8"
+ xmlns:task="http://www.vmware.com/vcloud/task"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/tasks
+ https://vcloud.safesecureweb.com/ns/vcloud/tasks-1.0.xsd
+ http://www.vmware.com/vcloud/v0.8
+ https://vcloud.safesecureweb.com/ns/vcloud/common-1.0.xsd
+ http://www.vmware.com/vcloud/task
+ https://vcloud.safesecureweb.com/ns/vcloud/task-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Link rel="self"
+ href="https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"
+ type="application/vnd.vmware.vcloud.tasksList+xml" />
+</tasks>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/taskslist.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/taskslist.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/taskslist.xml
new file mode 100755
index 0000000..fe0d8c1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/taskslist.xml
@@ -0,0 +1,27 @@
+<TasksList
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/1"
+ xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Task
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"
+ type="application/vnd.vmware.vcloud.task+xml" status="success"
+ startTime="2009-08-24T21:30:19.587Z" endTime="2009-08-24T21:30:32.63Z">
+ <Owner
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1"
+ type="application/vnd.vmware.vcloud.vdc+xml" name="VDC Name" />
+ <Result
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="Server1" />
+ </Task>
+ <Task
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"
+ type="application/vnd.vmware.vcloud.task+xml" status="success"
+ startTime="2009-08-24T21:29:32.983Z" endTime="2009-08-24T21:29:44.65Z">
+ <Owner
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1"
+ type="application/vnd.vmware.vcloud.vdc+xml" name="VDC Name" />
+ <Result
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="Server1" />
+ </Task>
+</TasksList>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/template1.0-vcd15-multi-vm.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/template1.0-vcd15-multi-vm.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/template1.0-vcd15-multi-vm.xml
new file mode 100755
index 0000000..46b3c83
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/template1.0-vcd15-multi-vm.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" ovfDescriptorUploaded="true" status="8" name="Windows Server 2008 R2" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/cf6a0068-b7c4-425c-9e80-46ffef58782a"/>
+ <Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalogItem/9c45dbbd-910d-45c8-a811-d1e0b01e9e82"/>
+ <Link rel="remove" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Link rel="enable" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/action/enableDownload"/>
+ <Link rel="disable" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/action/disableDownload"/>
+ <Link rel="ovf" type="text/xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/ovf"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/owner"/>
+ <Description/>
+ <Children>
+ <Vm name="Windows Server 2008 R2" type="application/vnd.vmware.vcloud.vm+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-24fc1b05-10f7-423e-a644-fd3368f9d0cd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Description/>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-24fc1b05-10f7-423e-a644-fd3368f9d0cd/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="none">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IsConnected>false</IsConnected>
+ <MACAddress>00:50:56:b5:09:dc</MACAddress>
+ <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
+ </NetworkConnection>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-24fc1b05-10f7-423e-a644-fd3368f9d0cd/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>true</ResetPasswordRequired> <ComputerName>WindowsServ-001</ComputerName>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>Windows Server 2008 R2</VAppScopedLocalId>
+ </Vm>
+ </Children>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml"> <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="none">
+ <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
+ </ovf:Network> </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <NetworkConfig networkName="none">
+ <Description>This is a special place-holder used for disconnected network interfaces.</Description>
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>196.254.254.254</Gateway>
+ <Netmask>255.255.0.0</Netmask>
+ <Dns1>196.254.254.254</Dns1>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info> <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/leaseSettingsSection/"/>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <CustomizationSection type="application/vnd.vmware.vcloud.customizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/customizationSection/" ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.customizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/customizationSection/"/>
+ </CustomizationSection>
+</VAppTemplate>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/template1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/template1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/template1.0-vcd15.xml
new file mode 100755
index 0000000..35393ee
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/template1.0-vcd15.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" ovfDescriptorUploaded="true" status="8" name="UbuntuServer-x64-2GB" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"/>
+ <Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c"/>
+ <Link rel="remove" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Link rel="enable" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/action/enableDownload"/>
+ <Link rel="disable" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/action/disableDownload"/>
+ <Link rel="ovf" type="text/xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/ovf"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/owner"/>
+ <Description/>
+ <Children>
+ <Vm name="UbuntuServer-x64-2GB" type="application/vnd.vmware.vcloud.vm+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-3aee3d0d-106a-4c63-8529-1edde335b212">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Description/>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-3aee3d0d-106a-4c63-8529-1edde335b212/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="none">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IsConnected>false</IsConnected>
+ <MACAddress>00:50:56:01:02:9f</MACAddress>
+ <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
+ </NetworkConnection>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-3aee3d0d-106a-4c63-8529-1edde335b212/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <ComputerName>UbuntuServer</ComputerName>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>f114ade7-a63f-4f8b-b30b-44e9ff77e068</VAppScopedLocalId>
+ </Vm>
+ </Children>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="none">
+ <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <NetworkConfig networkName="none">
+ <Description>This is a special place-holder used for disconnected network interfaces.</Description>
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>196.254.254.254</Gateway>
+ <Netmask>255.255.0.0</Netmask>
+ <Dns1>196.254.254.254</Dns1>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/leaseSettingsSection/"/>
+ <StorageLeaseInSeconds>5184000</StorageLeaseInSeconds>
+ <StorageLeaseExpiration>2012-03-12T17:40:44.491-06:00</StorageLeaseExpiration>
+ </LeaseSettingsSection>
+ <CustomizationSection type="application/vnd.vmware.vcloud.customizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/customizationSection/" ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
+ </CustomizationSection>
+</VAppTemplate>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate-copying.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate-copying.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate-copying.xml
new file mode 100755
index 0000000..8ffa7d7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate-copying.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ ovfDescriptorUploaded="true" status="0" name="Ubuntu10.04_v2"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vdc/105186609" />
+ <Description />
+ <Tasks>
+ <Task status="running" startTime="2010-09-17T23:20:46.039-04:00"
+ operation="Copying Virtual Application Template Ubuntu10.04_v2(699683881)"
+ expiryTime="2010-12-16T23:20:46.039-05:00" endTime="9999-12-31T23:59:59.999-05:00"
+ type="application/vnd.vmware.vcloud.task+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/task/q62gxhi32xgd9yrqvr">
+ <Owner type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ name="Ubuntu10.04_v2"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881" />
+ </Task>
+ </Tasks>
+ <Children />
+ <LeaseSettingsSection
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881/leaseSettingsSection/"
+ ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881/leaseSettingsSection/" />
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <CustomizationSection
+ type="application/vnd.vmware.vcloud.customizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881/customizationSection/"
+ ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
+ </CustomizationSection>
+</VAppTemplate>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate.xml
new file mode 100755
index 0000000..bb5fcaf
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ ovfDescriptorUploaded="true" status="8" name="Ubuntu Template"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
+ <Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2090447518" />
+ <Link rel="remove"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
+ <Link rel="enable"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/action/enableDownload" />
+ <Link rel="disable"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/action/disableDownload" />
+ <Link rel="ovf" type="text/xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/ovf" />
+ <Description />
+ <Children>
+ <Vm name="Ubuntu1004" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
+ <Description />
+ <NetworkConnectionSection
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194/networkConnectionSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="vAppNet-vApp Internal">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>192.168.2.100</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:8c:00:13</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194/guestCustomizationSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>172837194</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <AdminPassword>%3eD%gmF</AdminPassword>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>#!/bin/bash if [ "$1" = "postcustomization" ]; then echo "post customization" touch /root/.postcustomization sleep 30 #regenerate keys /bin/rm /etc/ssh/ssh_host_* /usr/sbin/dpkg-reconfigure openssh-server echo "completed" fi</CustomizationScript>
+ <ComputerName>Ubuntu1004</ComputerName>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>02_ubuntu_template</VAppScopedLocalId>
+ </Vm>
+ </Children>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/networkSection/"
+ vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="vAppNet-vApp Internal">
+ <ovf:Description />
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection
+ type="application/vnd.vmware.vcloud.networkConfigSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/networkConfigSection/"
+ ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <NetworkConfig networkName="vAppNet-vApp Internal">
+ <Description />
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>192.168.2.1</Gateway>
+ <Netmask>255.255.255.0</Netmask>
+ <Dns1>8.8.8.8</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>192.168.2.100</StartAddress>
+ <EndAddress>192.168.2.199</EndAddress>
+ </IpRange>
+ </IpRanges>
+ <AllocatedIpAddresses>
+ <IpAddress>192.168.2.100</IpAddress>
+ </AllocatedIpAddresses>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>7200</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange />
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ <NatRule>
+ <OneToOneVmRule>
+ <MappingMode>automatic</MappingMode>
+ <VAppScopedVmId>02_ubuntu_template</VAppScopedVmId>
+ <VmNicId>0</VmNicId>
+ </OneToOneVmRule>
+ </NatRule>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <LeaseSettingsSection
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/leaseSettingsSection/"
+ ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/leaseSettingsSection/" />
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <CustomizationSection
+ type="application/vnd.vmware.vcloud.customizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/customizationSection/"
+ ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.customizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/customizationSection/" />
+ </CustomizationSection>
+</VAppTemplate>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate1.0-vcd15_withNewlines.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate1.0-vcd15_withNewlines.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate1.0-vcd15_withNewlines.xml
new file mode 100755
index 0000000..9f41d81
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vAppTemplate1.0-vcd15_withNewlines.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vcloud:VAppTemplate xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" ovfDescriptorUploaded="true" status="8" name="Windows 2008 R2 Standard (base) with SP1" type="application/vnd.vmware.vcloud.vAppTempla
+te+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf
+/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://109.233.49.135/api/v1.0/schema/master.xsd">
+ <vcloud:Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcd.stratogen.net/api/v1.0/catalogItem/16bdea08-f176-48ce-9fe8-fc2265fc1068"/>
+ <vcloud:Link rel="enable" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/action/enableDownload"/>
+ <vcloud:Link rel="disable" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/action/disableDownload"/>
+ <vcloud:Link rel="ovf" type="text/xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/ovf"/>
+ <vcloud:Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/owner"/>
+ <vcloud:Description>Windows 2008 R2 Standard Edition
+Service Pack 1
+Internet Explorer 9</vcloud:Description>
+ <vcloud:Children>
+ <vcloud:Vm name="Windows 2008 R2 Standard (Base) with SP1" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vm-2ac49c8b-5cd9-428d-86da-24cfe9144b94">
+ <vcloud:Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80"/>
+ <vcloud:Description>Windows 2008 R2 Standard Edition
+Service Pack 1
+Internet Explorer 9</vcloud:Description>
+ <vcloud:NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vm-2ac49c8b-5cd9-428d-86da-24cfe9144b94/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
+ <vcloud:NetworkConnection network="StratoGen Ext Net">
+ <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
+ <vcloud:IpAddress>212.54.128.56</vcloud:IpAddress>
+ <vcloud:IsConnected>true</vcloud:IsConnected>
+ <vcloud:MACAddress>00:50:56:01:0d:3c</vcloud:MACAddress>
+ <vcloud:IpAddressAllocationMode>POOL</vcloud:IpAddressAllocationMode>
+ </vcloud:NetworkConnection>
+ </vcloud:NetworkConnectionSection>
+ <vcloud:GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vm-2ac49c8b-5cd9-428d-86da-24cfe9144b94/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <vcloud:Enabled>true</vcloud:Enabled>
+ <vcloud:ChangeSid>true</vcloud:ChangeSid>
+ <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+ <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+ <vcloud:AdminPasswordEnabled>true</vcloud:AdminPasswordEnabled>
+ <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+ <vcloud:AdminPassword>$6fEPL93</vcloud:AdminPassword>
+ <vcloud:ResetPasswordRequired>false</vcloud:ResetPasswordRequired>
+ <vcloud:ComputerName>Win2008r2Stand</vcloud:ComputerName>
+ </vcloud:GuestCustomizationSection>
+ <vcloud:VAppScopedLocalId>ac2ce03d-0491-46f7-afc6-37ffe5b30f74</vcloud:VAppScopedLocalId>
+ </vcloud:Vm>
+ </vcloud:Children>
+ <ovf:NetworkSection vcloud:href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="StratoGen Ext Net">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <vcloud:NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <vcloud:NetworkConfig networkName="StratoGen Ext Net">
+ <vcloud:Description/>
+ <vcloud:Configuration>
+ <vcloud:IpScope>
+ <vcloud:IsInherited>true</vcloud:IsInherited>
+ <vcloud:Gateway>212.54.128.1</vcloud:Gateway>
+ <vcloud:Netmask>255.255.255.0</vcloud:Netmask>
+ <vcloud:Dns1>109.233.48.141</vcloud:Dns1>
+ <vcloud:Dns2>109.233.48.142</vcloud:Dns2>
+ <vcloud:IpRanges>
+ <vcloud:IpRange>
+ <vcloud:StartAddress>212.54.128.4</vcloud:StartAddress>
+ <vcloud:EndAddress>212.54.128.220</vcloud:EndAddress>
+ </vcloud:IpRange>
+ </vcloud:IpRanges>
+ </vcloud:IpScope>
+ <vcloud:FenceMode>bridged</vcloud:FenceMode>
+ <vcloud:Features>
+ <vcloud:DhcpService>
+ <vcloud:IsEnabled>false</vcloud:IsEnabled>
+ <vcloud:DefaultLeaseTime>3600</vcloud:DefaultLeaseTime>
+ <vcloud:MaxLeaseTime>7200</vcloud:MaxLeaseTime>
+ <vcloud:IpRange>
+ <vcloud:StartAddress>212.54.128.201</vcloud:StartAddress>
+ <vcloud:EndAddress>212.54.128.254</vcloud:EndAddress>
+ </vcloud:IpRange>
+ </vcloud:DhcpService>
+ <vcloud:FirewallService>
+ <vcloud:IsEnabled>true</vcloud:IsEnabled>
+ </vcloud:FirewallService>
+ <vcloud:NatService>
+ <vcloud:IsEnabled>true</vcloud:IsEnabled>
+ <vcloud:NatType>ipTranslation</vcloud:NatType>
+ <vcloud:Policy>allowTraffic</vcloud:Policy>
+ <vcloud:NatRule>
+ <vcloud:OneToOneVmRule>
+ <vcloud:MappingMode>automatic</vcloud:MappingMode>
+ <vcloud:VAppScopedVmId>ac2ce03d-0491-46f7-afc6-37ffe5b30f74</vcloud:VAppScopedVmId>
+ <vcloud:VmNicId>0</vcloud:VmNicId>
+ </vcloud:OneToOneVmRule>
+ </vcloud:NatRule>
+ </vcloud:NatService>
+ </vcloud:Features>
+ </vcloud:Configuration>
+ <vcloud:IsDeployed>false</vcloud:IsDeployed>
+ </vcloud:NetworkConfig>
+ </vcloud:NetworkConfigSection>
+ <vcloud:LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <vcloud:Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/leaseSettingsSection/"/>
+ <vcloud:StorageLeaseInSeconds>0</vcloud:StorageLeaseInSeconds>
+ </vcloud:LeaseSettingsSection>
+ <vcloud:CustomizationSection type="application/vnd.vmware.vcloud.customizationSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/customizationSection/" ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <vcloud:CustomizeOnInstantiate>true</vcloud:CustomizeOnInstantiate>
+ </vcloud:CustomizationSection>
+</vcloud:VAppTemplate>
\ No newline at end of file
[20/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
new file mode 100755
index 0000000..06f592e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
@@ -0,0 +1,238 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.ovf.xml.EnvelopeHandler;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.options.CaptureVAppOptions;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.jclouds.vcloud.xml.VAppTemplateHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VAppTemplateApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VAppTemplateApiTest")
+public class VAppTemplateApiTest extends BaseVCloudApiTest<VAppTemplateApi> {
+
+ public void testCreateVAppInVDCByInstantiatingTemplate() throws SecurityException, NoSuchMethodException,
+ IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class,
+ URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("my-vapp", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"),
+ addNetworkConfig(new NetworkConfig("aloha", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED))));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+ "/instantiationparams-network.xml")), "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
+ false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testCreateVAppInVDCByInstantiatingTemplateOptionsIllegalName() throws SecurityException,
+ NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class,
+ URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
+ processor.createRequest(method, ImmutableList.<Object> of("CentOS 01", URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), addNetworkConfig(new NetworkConfig(null,
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), null))));
+ }
+
+ public void testcopyVAppTemplateToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
+ String.class, CloneVAppTemplateOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapptemplate"));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+ "/copyVAppTemplate-default.xml")), "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testcopyVAppTemplateToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
+ String.class, CloneVAppTemplateOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
+ new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testmoveVAppTemplateToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class,
+ String.class, CloneVAppTemplateOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
+ new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVAppTemplate.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testcaptureVAppAsTemplateInVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
+ URI.class, CaptureVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-template", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+ assertPayloadEquals(request, Strings2
+ .toStringAndClose(getClass().getResourceAsStream("/captureVApp-default.xml")),
+ "application/vnd.vmware.vcloud.captureVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testcaptureVAppAsTemplateInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
+ URI.class, CaptureVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "my-template", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), new CaptureVAppOptions()
+ .withDescription("The description of the new vApp Template")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/captureVApp.xml")),
+ "application/vnd.vmware.vcloud.captureVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "findVAppTemplateInOrgCatalogNamed", String.class,
+ String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "template"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "getVAppTemplate", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "getOvfEnvelopeForVAppTemplate", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2/ovf HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: text/xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, EnvelopeHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
new file mode 100755
index 0000000..5c3632a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.vcloud.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VDCApiLiveTest")
+public class VDCApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
new file mode 100755
index 0000000..549b47c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.NoSuchElementException;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.VDCHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VDCApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VDCApiTest")
+public class VDCApiTest extends BaseVCloudApiTest<VDCApi> {
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+ processor.createRequest(method, ImmutableList.<Object> of("org", "vdc1"));
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+ processor.createRequest(method, ImmutableList.<Object> of("org1", "vdc"));
+ }
+
+ public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "vdc"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VDCHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VDCHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "getVDC", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VDCHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
new file mode 100755
index 0000000..095a12b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
@@ -0,0 +1,163 @@
+/*
+ * 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.vcloud.features;
+
+import static com.google.common.base.Charsets.UTF_8;
+import static com.google.common.collect.Iterables.get;
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static com.google.common.io.BaseEncoding.base64;
+import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.compute.domain.ExecResponse;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.common.net.HostAndPort;
+
+/**
+ * This tests that we can use guest customization as an alternative to bootstrapping with ssh. There
+ * are a few advantages to this, including the fact that it can work inside google appengine where
+ * network sockets (ssh:22) are prohibited.
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VmApiLiveTest")
+public class VmApiLiveTest extends BaseVCloudApiLiveTest {
+
+ @Test
+ public void testGetThumbnailOfVm() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
+ for (ReferenceType item : response.getResourceEntities().values()) {
+ if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+ try {
+ VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
+ assertNotNull(app);
+ for (Vm vm : app.getChildren()) {
+ assert getVCloudApi().getVmApi().getScreenThumbnailForVm(vm.getHref()) != null;
+ }
+ } catch (RuntimeException e) {
+
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testGetVm() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
+ for (ReferenceType item : response.getResourceEntities().values()) {
+ if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+ try {
+ VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
+ assertNotNull(app);
+ for (Vm vm : app.getChildren()) {
+ assertEquals(getVCloudApi().getVmApi().getVm(vm.getHref()).getHref(), vm.getHref());
+ }
+ } catch (RuntimeException e) {
+
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testExtendedOptionsWithCustomizationScript() throws Exception {
+ String PARSE_VMTOOLSD = "vmtoolsd --cmd=\"info-get guestinfo.ovfenv\" |grep vCloud_CustomizationInfo|sed 's/.*value=\"\\(.*\\)\".*/\\1/g'";
+
+ String group = prefix + "cus";
+
+ NodeMetadata node = null;
+ try {
+
+ TemplateOptions options = client.templateOptions();
+ options.blockOnPort(22, 180);
+ options.as(VCloudTemplateOptions.class).customizationScript(script);
+ options.as(VCloudTemplateOptions.class).description(group);
+ node = getOnlyElement(client.createNodesInGroup(group, 1, options));
+
+ VApp vapp = client.getContext().unwrapApi(VCloudApi.class).getVAppApi().getVApp(
+ node.getUri());
+ assertEquals(vapp.getDescription(), group);
+
+ Vm vm = Iterables.get(vapp.getChildren(), 0);
+ String apiOutput = vm.getGuestCustomizationSection().getCustomizationScript();
+ checkApiOutput(apiOutput);
+
+ ExecResponse vmTools = client.runScriptOnNode(node.getId(), PARSE_VMTOOLSD,
+ wrapInInitScript(false).runAsRoot(false));
+ checkApiOutput(new String(base64().decode(vmTools.getOutput().trim()), UTF_8));
+
+ ExecResponse foo = client.runScriptOnNode(node.getId(), "cat /root/foo.txt", wrapInInitScript(false)
+ .runAsRoot(false));
+ checkCustomizationOccurred(foo);
+
+ } finally {
+ if (node != null)
+ client.destroyNode(node.getId());
+ }
+ }
+
+ protected void checkCustomizationOccurred(ExecResponse exec) {
+ // note that vmwaretools throws in \r characters when executing scripts
+ assert exec.getOutput().equals(iLoveAscii + "\r\n") : exec;
+ }
+
+ protected void checkApiOutput(String apiOutput) {
+ checkApiOutput1_0_1(apiOutput);
+ }
+
+ // make sure the script has a lot of screwy characters, knowing our parser
+ // throws-out \r
+ protected String iLoveAscii = "I '\"love\"' {asc|!}*&";
+
+ String script = "cat > /root/foo.txt<<EOF\n" + iLoveAscii + "\nEOF\n";
+
+ protected void checkApiOutput1_0_1(String apiOutput) {
+ // in 1.0.1, vcloud director seems to pass through characters via api
+ // flawlessly
+ assertEquals(apiOutput, script);
+ }
+
+ protected void checkApiOutput1_0_0(String apiOutput) {
+ // in 1.0.0, vcloud director seems to remove all newlines
+ assertEquals(apiOutput, script.replace("\n", ""));
+ }
+
+ protected HostAndPort getSocket(NodeMetadata node) {
+ return HostAndPort.fromParts(get(node.getPublicAddresses(), 0), 22);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
new file mode 100755
index 0000000..d7f0b0f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
@@ -0,0 +1,320 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnInputStream;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.utils.TestUtils;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VmHandler;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VmApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VmApiTest")
+public class VmApiTest extends BaseVCloudApiTest<VmApi> {
+
+ public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "getScreenThumbnailForVm", URI.class);
+ GeneratedHttpRequest request = processor
+ .createRequest(method, ImmutableList.<Object> of(URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+ assertRequestLineEquals(request, "GET http://vcloud.example.com/api/v1.0/vApp/vm-12/screen HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: image/png\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnInputStream.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ @Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=402")
+ public void testUpdateGuestConfiguration() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "updateGuestCustomizationOfVm", GuestCustomizationSection.class,
+ URI.class);
+ GuestCustomizationSection guest = new GuestCustomizationSection(URI
+ .create("http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection"));
+ guest.setCustomizationScript("cat > /tmp/foo.txt<<EOF\nI love candy\nEOF");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(guest, URI
+ .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+ assertRequestLineEquals(request,
+ "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+ "/guestCustomizationSection.xml")), "application/vnd.vmware.vcloud.guestCustomizationSection+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUpdateCPUCountOfVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "updateCPUCountOfVm", int.class, URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, URI
+ .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+ assertRequestLineEquals(request,
+ "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/virtualHardwareSection/cpu HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/cpuItem.xml")),
+ "application/vnd.vmware.vcloud.rasdItem+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUpdateMemoryMBOfVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "updateMemoryMBOfVm", int.class, URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(512, URI
+ .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+ assertRequestLineEquals(request,
+ "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/virtualHardwareSection/memory HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/memoryItem.xml")),
+ "application/vnd.vmware.vcloud.rasdItem+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "deployVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployAndPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "deployAndPowerOnVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGetVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "getVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vm/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vm/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vm+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VmHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testRebootVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "rebootVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "undeployVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployAndSaveStateOfVmSaveState() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "undeployAndSaveStateOfVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request,
+ "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "powerOnVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOffVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "powerOffVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testResetVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "resetVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testSuspendVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "suspendVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testShutdownVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "shutdownVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @DataProvider
+ public Object[][] ignoreOnWindows() {
+ return TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS
+ : TestUtils.SINGLE_NO_ARG_INVOCATION;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
new file mode 100755
index 0000000..d4a0c06
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.vcloud.filters;
+
+import static org.testng.Assert.assertEquals;
+
+import javax.ws.rs.core.HttpHeaders;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(testName = "AddVCloudAuthorizationAndCookieToRequestTest")
+public class AddVCloudAuthorizationAndCookieToRequestTest {
+
+ private AddVCloudAuthorizationAndCookieToRequest filter;
+
+ @BeforeTest
+ void setUp() {
+ filter = new AddVCloudAuthorizationAndCookieToRequest(new Supplier<String>() {
+ public String get() {
+ return "token";
+ }
+ }, "1.0");
+ }
+
+ @Test
+ public void testApply() {
+ HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://localhost").build();
+ request = filter.filter(request);
+ assertEquals(request.getHeaders().size(), 3);
+ assertEquals(request.getFirstHeaderOrNull(HttpHeaders.COOKIE), "vcloud-token=token");
+ assertEquals(request.getFirstHeaderOrNull("x-vcloud-authorization"), "token");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
new file mode 100755
index 0000000..77d1069
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.vcloud.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests behavior of {@code ParseLoginResponseFromHeaders}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "ParseLoginResponseFromHeadersTest")
+public class ParseLoginResponseFromHeadersTest extends BaseHandlerTest {
+
+ private ParseLoginResponseFromHeaders parser;
+
+ @BeforeTest
+ void setUp() {
+ parser = injector.getInstance(ParseLoginResponseFromHeaders.class);
+ }
+
+ @Test
+ public void testApply() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("x-vcloud-authorization", "vcloud-token=9er4d061-4bff-48fa-84b1-5da7166764d2; path=/").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "9er4d061-4bff-48fa-84b1-5da7166764d2");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+
+ @Test
+ public void testApplyBlueLock() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("x-vcloud-authorization", "MUKOJ2HoAfoMmLnHRp4esNb2MtWscCLLhVysnsIsCG0=").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "MUKOJ2HoAfoMmLnHRp4esNb2MtWscCLLhVysnsIsCG0=");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+
+ @Test
+ public void testApplyTerremark() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("Set-Cookie", "vcloud-token=37ce2715-9aba-4f48-8e45-2db8a8da702d; path=/").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "37ce2715-9aba-4f48-8e45-2db8a8da702d");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+
+ @Test
+ public void testApplyTerremarkMultipleCookies() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("Set-Cookie", "NSC_ESUO_21654_72.46.239.132_443=fooo;expires=Thu, 02-Jun-2011 17:19:26 GMT;path=/;secure;httponly")
+ .addHeader("Set-Cookie", "vcloud-token=37ce2715-9aba-4f48-8e45-2db8a8da702d; path=/").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "37ce2715-9aba-4f48-8e45-2db8a8da702d");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+
+ @Test(expectedExceptions = HttpResponseException.class)
+ public void testUnmatchedCookieThrowsHttpResponseException() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("Set-Cookie", "NSC_ESUO_21654_72.46.239.132_443=fooo;expires=Thu, 02-Jun-2011 17:19:26 GMT;path=/;secure;httponly").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ parser.apply(response);
+ }
+
+ @Test(expectedExceptions = HttpResponseException.class)
+ public void testNoThrowsHttpResponseException() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml")).build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ parser.apply(response);
+ }
+
+ @Test
+ public void testApplyVirtacore() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("x-vcloud-authorization", "vcloud-token=IPy0w7UGD4lwtdWAK/ZVzfuLK+dztxGRqsOhWqV0i48=").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "IPy0w7UGD4lwtdWAK/ZVzfuLK+dztxGRqsOhWqV0i48=");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
new file mode 100755
index 0000000..e824715
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.vcloud.handlers;
+
+import java.net.URI;
+
+import org.jclouds.http.BaseHttpErrorHandlerTest;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = { "unit" })
+public class ParseVCloudErrorFromHttpResponseTest extends BaseHttpErrorHandlerTest {
+
+ @Test
+ public void testGet404SetsResourceNotFoundException() {
+ assertCodeMakes("GET", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"), 404,
+ "", "", ResourceNotFoundException.class);
+ }
+
+ @Test
+ public void testGet403NoAcessToEntitySetsResourceNotFoundException() {
+ assertCodeMakes(
+ "GET",
+ URI.create("https://zone01.bluelock.com/api/v1.0/vApp/vapp-1535788985"),
+ 403,
+ "HTTP/1.1 403",
+ VCloudMediaType.ERROR_XML,
+ "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"ACCESS_TO_RESOURCE_IS_FORBIDDEN\" message=\"No access to entity "(com.vmware.vcloud.entity.vapp:1535788985)".\" majorErrorCode=\"403\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd\"></Error>\n",
+ ResourceNotFoundException.class);
+ }
+
+ @Test
+ public void testGet403NoAcessToEntitySetsResourceNotFoundExceptionOnAPI1_0AgainstVCD1_5() {
+ assertCodeMakes(
+ "GET",
+ URI.create("https://mycloud.greenhousedata.com/api/v1.0/vApp/vapp-d3a1f2cd-d07b-4ddc-bf7b-fb7468b4d95a"),
+ 403,
+ "HTTP/1.1 403",
+ // NOTE VCD 1.5 appends the api version to the media type
+ VCloudMediaType.ERROR_XML + ";1.0",
+ "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"ACCESS_TO_RESOURCE_IS_FORBIDDEN\" message=\"No access to entity "(com.vmware.vcloud.entity.vapp:d3a1f2cd-d07b-4ddc-bf7b-fb7468b4d95a)".\" majorErrorCode=\"403\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://mycloud.greenhousedata.com/api/v1.0/schema/master.xsd\"></Error>",
+ ResourceNotFoundException.class);
+ }
+
+ @Test
+ public void testDelete404SetsHttpResponseException() {
+ assertCodeMakes("DELETE", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"),
+ 404, "", "", HttpResponseException.class);
+ }
+
+ @Test
+ public void testPOSTNotRunningSetsIllegalStateException() {
+ assertCodeMakes(
+ "POST",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-138351019/action/undeploy"),
+ 400,
+ "HTTP/1.1 400 Bad Request",
+ VCloudMediaType.ERROR_XML,
+ "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"BAD_REQUEST\" message=\"The requested operation could not be executed since vApp "adriancolecap-78c" is not running"\" majorErrorCode=\"400\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd\"></Error>\n",
+ IllegalStateException.class);
+ }
+
+ @Test
+ public void test401SetsAuthorizationException() {
+ assertCodeMakes("GET", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"), 401,
+ "", "", AuthorizationException.class);
+ }
+
+ @Override
+ protected Class<? extends HttpErrorHandler> getHandlerClass() {
+ return ParseVCloudErrorFromHttpResponse.class;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
new file mode 100755
index 0000000..4ffe512
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.vcloud.internal;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.reflect.Invocation;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.nnsoft.guice.rocoto.Rocoto;
+import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class BasePayloadTest {
+
+ protected Injector injector = Guice.createInjector(Rocoto.expandVariables(new ConfigurationModule() {
+ protected void bindConfigurations() {
+ bindProperties(new VCloudApiMetadata().getDefaultProperties());
+ }
+ }));
+
+ protected GeneratedHttpRequest requestForArgs(List<Object> args) {
+ try {
+ Invocation invocation = Invocation.create(method(String.class, "toString"), args);
+ return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
+ .invocation(invocation).build();
+ } catch (SecurityException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
new file mode 100755
index 0000000..73880ee
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.vcloud.internal;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.jclouds.vcloud.VCloudApi;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.inject.Module;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true)
+public abstract class BaseVCloudApiLiveTest extends BaseComputeServiceContextLiveTest {
+
+ // username is too long for name constraints
+ protected String prefix = "vcd";
+
+ protected ComputeService client;
+
+ public BaseVCloudApiLiveTest() {
+ provider = "vcloud";
+ }
+
+ protected VCloudApi getVCloudApi() {
+ return view.unwrapApi(VCloudApi.class);
+ }
+
+ @Override
+ @BeforeClass(groups = { "integration", "live" })
+ public void setupContext() {
+ super.setupContext();
+ client = view.getComputeService();
+ }
+
+ @Override
+ protected Module getSshModule() {
+ return new SshjSshClientModule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
new file mode 100755
index 0000000..2ac9667
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
@@ -0,0 +1,272 @@
+/*
+ * 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.vcloud.internal;
+
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.ovf.xml.EnvelopeHandlerTest;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.VCloudVersionsApi;
+import org.jclouds.vcloud.config.VCloudHttpApiModule;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.VDCImpl;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.VAppTemplateHandlerTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Functions;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheLoader;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.AbstractModule;
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Tests behavior of {@code VCloudApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "BaseVCloudApiTest")
+public abstract class BaseVCloudApiTest<T> extends BaseAsyncClientTest<T> {
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), AddVCloudAuthorizationAndCookieToRequest.class);
+ }
+
+ @Override
+ protected Module createModule() {
+ return new VCloudHttpApiModuleExtension();
+ }
+
+ @Override
+ protected ProviderMetadata createProviderMetadata() {
+ return AnonymousProviderMetadata.forApiWithEndpoint(new VCloudApiMetadata(), "https://vcenterprise.bluelock.com/api/v1.0");
+ }
+
+ protected static final ReferenceTypeImpl ORG_REF = new ReferenceTypeImpl("org", VCloudMediaType.ORG_XML,
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"));
+
+ protected static final ReferenceTypeImpl CATALOG_REF = new ReferenceTypeImpl("catalog", VCloudMediaType.CATALOG_XML,
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"));
+
+ protected static final ReferenceTypeImpl TASKSLIST_REF = new ReferenceTypeImpl("tasksList",
+ VCloudMediaType.TASKSLIST_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"));
+
+ protected static final ReferenceTypeImpl VDC_REF = new ReferenceTypeImpl("vdc", VCloudMediaType.VDC_XML,
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"));
+
+ protected static final ReferenceTypeImpl NETWORK_REF = new ReferenceTypeImpl("network", VCloudMediaType.NETWORK_XML,
+ URI.create("https://vcloud.safesecureweb.com/network/1990"));
+
+ protected static final Org ORG = new OrgImpl(ORG_REF.getName(), ORG_REF.getType(), ORG_REF.getHref(), "org", null,
+ ImmutableMap.<String, ReferenceType> of(CATALOG_REF.getName(), CATALOG_REF),
+ ImmutableMap.<String, ReferenceType> of(VDC_REF.getName(), VDC_REF), ImmutableMap.<String, ReferenceType> of(
+ NETWORK_REF.getName(), NETWORK_REF), TASKSLIST_REF, ImmutableList.<Task> of());
+
+ protected static final VDC VDC = new VDCImpl(VDC_REF.getName(), VDC_REF.getType(), VDC_REF.getHref(),
+ VDCStatus.READY, null, "description", ImmutableSet.<Task> of(), AllocationModel.ALLOCATION_POOL, null, null,
+ null, ImmutableMap.<String, ReferenceType> of(
+ "vapp",
+ new ReferenceTypeImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")),
+ "network",
+ new ReferenceTypeImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))),
+ ImmutableMap.<String, ReferenceType> of(NETWORK_REF.getName(), NETWORK_REF), 0, 0, 0, false);
+
+ @ConfiguresHttpApi
+ public static class VCloudHttpApiModuleExtension extends VCloudHttpApiModule {
+
+ @Override
+ protected Supplier<URI> provideAuthenticationURI(VCloudVersionsApi versionService, String version) {
+ return Suppliers.ofInstance(URI.create("https://vcenterprise.bluelock.com/api/v1.0/login"));
+ }
+
+ @Override
+ protected Supplier<Org> provideOrg(Supplier<Map<String, Org>> orgSupplier,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.ofInstance(ORG);
+ }
+
+ @Override
+ protected void installDefaultVCloudEndpointsModule() {
+ install(new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ TypeLiteral<Supplier<ReferenceType>> refTypeSupplier = new TypeLiteral<Supplier<ReferenceType>>() {
+ };
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Org.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(ORG_REF));
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Catalog.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(CATALOG_REF));
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.TasksList.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(TASKSLIST_REF));
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.VDC.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(VDC_REF));
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Network.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(NETWORK_REF));
+ }
+
+ });
+ }
+
+ @Override
+ protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ AtomicReference<AuthorizationException> authException, final VCloudLoginApi login) {
+ return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
+
+ @Override
+ public Map<String, ReferenceType> getOrgs() {
+ return ImmutableMap.<String, ReferenceType> of(ORG_REF.getName(), ORG_REF);
+ }
+
+ @Override
+ public String getVCloudToken() {
+ return "token";
+ }
+
+ });
+
+ }
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(OrgMapSupplier.class).to(TestOrgMapSupplier.class);
+ bind(OrgCatalogSupplier.class).to(TestOrgCatalogSupplier.class);
+ bind(OrgCatalogItemSupplier.class).to(TestOrgCatalogItemSupplier.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void bindCacheLoaders() {
+ bind(new TypeLiteral<CacheLoader<URI, VAppTemplate>>() {
+ }).toInstance(CacheLoader.class.cast(CacheLoader.from(Functions.constant(VAppTemplateHandlerTest.parseTemplate()))));
+
+ bind(new TypeLiteral<CacheLoader<URI, Envelope>>() {
+ }).toInstance(CacheLoader.class.cast(CacheLoader.from(Functions.constant(EnvelopeHandlerTest.parseEnvelope()))));
+ }
+
+ @Override
+ protected Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ OrgVDCSupplier supplier) {
+ return Suppliers.<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
+ .<String, Map<String, org.jclouds.vcloud.domain.VDC>> of(ORG_REF.getName(),
+ ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of(VDC.getName(), VDC)));
+ }
+
+ @Singleton
+ public static class TestOrgMapSupplier extends OrgMapSupplier {
+
+ @Inject
+ protected TestOrgMapSupplier() {
+ super(null, null);
+ }
+
+ @Override
+ public Map<String, Org> get() {
+ return ImmutableMap.<String, Org> of(ORG.getName(), ORG);
+ }
+ }
+
+ @Singleton
+ public static class TestOrgCatalogSupplier extends OrgCatalogSupplier {
+ @Inject
+ protected TestOrgCatalogSupplier() {
+ super(null, null);
+ }
+
+ @Override
+ public Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>> get() {
+ return ImmutableMap.<String, Map<String, org.jclouds.vcloud.domain.Catalog>> of(
+ ORG_REF.getName(), ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of(
+ CATALOG_REF.getName(),
+ new CatalogImpl(CATALOG_REF.getName(), CATALOG_REF.getType(), CATALOG_REF.getHref(), null,
+ "description", ImmutableMap.<String, ReferenceType> of(
+ "item",
+ new ReferenceTypeImpl("item", "application/vnd.vmware.vcloud.catalogItem+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")),
+ "template",
+ new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))),
+ ImmutableList.<Task> of(), true, false)));
+ }
+ }
+
+ @Singleton
+ public static class TestOrgCatalogItemSupplier extends OrgCatalogItemSupplier {
+ protected TestOrgCatalogItemSupplier() {
+ super(null, null);
+ }
+
+ @Override
+ public Map<String, Map<String, Map<String, CatalogItem>>> get() {
+ return ImmutableMap.<String, Map<String, Map<String, CatalogItem>>> of(
+ ORG_REF.getName(), ImmutableMap
+ .<String, Map<String, CatalogItem>> of(CATALOG_REF
+ .getName(), ImmutableMap.<String, CatalogItem> of(
+ "template",
+ new CatalogItemImpl("template", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), "description",
+ new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
+ ImmutableMap.<String, String> of()))));
+
+ }
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
new file mode 100755
index 0000000..4652e5e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.vcloud.internal;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import javax.ws.rs.core.HttpHeaders;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.location.Provider;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.endpoints.VCloudLogin;
+import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
+import org.jclouds.vcloud.http.filters.VCloudBasicAuthentication;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+import com.google.inject.Binder;
+import com.google.inject.Module;
+import com.google.inject.Provides;
+/**
+ * Tests behavior of {@code VCloudLoginApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudLoginApiTest")
+public class VCloudLoginApiTest extends BaseAsyncClientTest<VCloudLoginApi> {
+
+ public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VCloudLoginApi.class, "login");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": application/vnd.vmware.vcloud.orgList+xml\n" + HttpHeaders.ACCEPT + ": application/vnd.vmware.vcloud.session+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseLoginResponseFromHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), VCloudBasicAuthentication.class);
+ }
+
+ @Override
+ protected Module createModule() {
+ return new Module() {
+
+ @Override
+ public void configure(Binder binder) {
+ }
+
+ @Provides
+ @VCloudLogin
+ Supplier<URI> provideURI(@Provider Supplier<URI> uri) {
+ return uri;
+ }
+
+ };
+ }
+
+ @Override
+ protected ProviderMetadata createProviderMetadata() {
+ return AnonymousProviderMetadata.forApiOnEndpoint(VCloudLoginApi.class,
+ "http://localhost:8080/login");
+ }
+
+}
[41/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationWithTenantNameExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationWithTenantNameExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationWithTenantNameExpectTest.java
new file mode 100644
index 0000000..06b6f85
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationWithTenantNameExpectTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ *
+ * @see KeystoneProperties#CREDENTIAL_TYPE
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "PasswordAuthenticationWithTenantNameExpectTest")
+public class PasswordAuthenticationWithTenantNameExpectTest extends BaseNovaApiExpectTest {
+
+ /**
+ * this reflects the properties that a user would pass to createContext
+ */
+ @Override
+ protected Properties setupProperties() {
+ Properties contextProperties = super.setupProperties();
+ contextProperties.setProperty("jclouds.keystone.credential-type", "passwordCredentials");
+ return contextProperties;
+ }
+
+ public void testListServersWhenResponseIs2xx() throws Exception {
+ HttpRequest listServers = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_list.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listServers, listServersResponse);
+
+ assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+ new ParseServerListTest().expected().toString());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapterExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapterExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapterExpectTest.java
new file mode 100644
index 0000000..edf5a56
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapterExpectTest.java
@@ -0,0 +1,321 @@
+/*
+ * 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.openstack.nova.v2_0.compute;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.domain.Network;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceContextExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Tests the compute service abstraction of the nova api.
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "NovaComputeServiceAdapterExpectTest")
+public class NovaComputeServiceAdapterExpectTest extends BaseNovaComputeServiceContextExpectTest<Injector> {
+ HttpRequest serverDetail = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/71752")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse serverDetailResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_details.json")).build();
+
+ public void testCreateNodeWithGroupEncodedIntoNameWithNetworks() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"networks\": [{\"uuid\": \"4ebd35cf-bfe7-4d93-b0d8-eb468ce2245a\"}]}}","application/json"))
+ .build();
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server_networks_response.json","application/json; charset=UTF-8")).build();
+
+ Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
+ .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
+ .put(listDetail, listDetailResponse)
+ .put(listFlavorsDetail, listFlavorsDetailResponse)
+ .put(createServer, createServerResponse)
+ .put(serverDetail, serverDetailResponse).build();
+
+ Injector forNetworks = requestsSendResponses(requestResponseMap);
+
+ Template template = forNetworks.getInstance(TemplateBuilder.class).build();
+ template.getOptions().as(NovaTemplateOptions.class).networks("4ebd35cf-bfe7-4d93-b0d8-eb468ce2245a");
+
+ NovaComputeServiceAdapter adapter = forNetworks.getInstance(NovaComputeServiceAdapter.class);
+
+ NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92", template);
+ assertNotNull(server);
+ // Response irrelevant in this expect test - just verifying the request.
+ }
+
+ public void testCreateNodeWithGroupEncodedIntoNameWithDiskConfig() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"OS-DCF:diskConfig\":\"AUTO\"}}","application/json"))
+ .build();
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server_disk_config_auto.json","application/json; charset=UTF-8")).build();
+
+ Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
+ .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
+ .put(listDetail, listDetailResponse)
+ .put(listFlavorsDetail, listFlavorsDetailResponse)
+ .put(createServer, createServerResponse)
+ .put(serverDetail, serverDetailResponse).build();
+
+ Injector forDiskConfig = requestsSendResponses(requestResponseMap);
+
+ Template template = forDiskConfig.getInstance(TemplateBuilder.class).build();
+ template.getOptions().as(NovaTemplateOptions.class).diskConfig(Server.DISK_CONFIG_AUTO);
+
+ NovaComputeServiceAdapter adapter = forDiskConfig.getInstance(NovaComputeServiceAdapter.class);
+
+ NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92", template);
+ assertNotNull(server);
+ assertEquals(server.getNode().getServer().getDiskConfig().orNull(), Server.DISK_CONFIG_AUTO);
+ }
+
+ public void testCreateNodeWithGroupEncodedIntoNameWithNovaNetworks() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"networks\":[{\"uuid\":\"12345\", \"port\":\"67890\", \"fixed_ip\":\"192.168.0.1\"},{\"uuid\":\"54321\", \"port\":\"09876\", \"fixed_ip\":\"192.168.0.2\"},{\"uuid\":\"non-nova-uuid\"}]}}","application/json"))
+ .build();
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server_nova_networks.json","application/json; charset=UTF-8")).build();
+
+ Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
+ .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
+ .put(listDetail, listDetailResponse)
+ .put(listFlavorsDetail, listFlavorsDetailResponse)
+ .put(createServer, createServerResponse)
+ .put(serverDetail, serverDetailResponse).build();
+
+ Injector forNovaNetworks = requestsSendResponses(requestResponseMap);
+
+ Template template = forNovaNetworks.getInstance(TemplateBuilder.class).build();
+ template.getOptions().as(NovaTemplateOptions.class)
+ .networks("non-nova-uuid")
+ .novaNetworks(
+ ImmutableSet.of(
+ Network.builder()
+ .networkUuid("12345")
+ .portUuid("67890")
+ .fixedIp("192.168.0.1")
+ .build(),
+ Network.builder()
+ .networkUuid("54321")
+ .portUuid("09876")
+ .fixedIp("192.168.0.2")
+ .build()));
+
+ NovaComputeServiceAdapter adapter = forNovaNetworks.getInstance(NovaComputeServiceAdapter.class);
+
+ NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92", template);
+ assertNotNull(server);
+ }
+
+ public void testCreateNodeWithGroupEncodedIntoNameWhenSecurityGroupsArePresent() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"security_groups\":[{\"name\":\"group1\"}, {\"name\":\"group2\"}]}}","application/json"))
+ .build();
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server.json","application/json; charset=UTF-8")).build();
+
+ Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
+ .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
+ .put(listDetail, listDetailResponse)
+ .put(listFlavorsDetail, listFlavorsDetailResponse)
+ .put(createServer, createServerResponse)
+ .put(serverDetail, serverDetailResponse).build();
+
+ Injector forSecurityGroups = requestsSendResponses(requestResponseMap);
+
+ Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
+ template.getOptions().as(NovaTemplateOptions.class).securityGroupNames("group1", "group2");
+
+ NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);
+
+ NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
+ template);
+ assertNotNull(server);
+ assertEquals(server.getCredentials(), LoginCredentials.builder().password("ZWuHcmTMQ7eXoHeM").build());
+ }
+
+ /**
+ * We need to choose the correct credential for attempts to start the server. cloud-init or the
+ * like will set the ssh key as the login credential, and not necessarily will password
+ * authentication even be available.
+ */
+ public void testWhenKeyPairPresentWeUsePrivateKeyAsCredentialNotPassword() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\",\"key_name\":\"foo\"}}","application/json"))
+ .build();
+
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server_no_adminpass.json","application/json; charset=UTF-8")).build();
+
+ Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
+ .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
+ .put(listDetail, listDetailResponse)
+ .put(listFlavorsDetail, listFlavorsDetailResponse)
+ .put(createServer, createServerResponse)
+ .put(serverDetail, serverDetailResponse).build();
+
+ Injector forSecurityGroups = requestsSendResponses(requestResponseMap);
+
+ Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
+ template.getOptions().as(NovaTemplateOptions.class).keyPairName("foo");
+
+ NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);
+
+ // we expect to have already an entry in the cache for the key
+ LoadingCache<ZoneAndName, KeyPair> keyPairCache = forSecurityGroups.getInstance(Key
+ .get(new TypeLiteral<LoadingCache<ZoneAndName, KeyPair>>() {
+ }));
+ keyPairCache.put(ZoneAndName.fromZoneAndName("az-1.region-a.geo-1", "foo"), KeyPair.builder().name("foo")
+ .privateKey("privateKey").build());
+
+ NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
+ template);
+ assertNotNull(server);
+ assertEquals(server.getCredentials(), LoginCredentials.builder().privateKey("privateKey").build());
+ }
+
+
+ /**
+ * When enable_instance_password is false, then no admin pass is generated.
+ * However in this case if you don't specify the name of the SSH keypair to
+ * inject, then you simply cannot log in to the server.
+ */
+ public void testNoKeyPairOrAdminPass() throws Exception {
+
+ HttpRequest createServer = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-e92\",\"imageRef\":\"1241\",\"flavorRef\":\"100\"}}","application/json"))
+ .build();
+
+ HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server_no_adminpass.json","application/json; charset=UTF-8")).build();
+
+ Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
+ .put(extensionsOfNovaRequest, extensionsOfNovaResponse)
+ .put(listDetail, listDetailResponse)
+ .put(listFlavorsDetail, listFlavorsDetailResponse)
+ .put(createServer, createServerResponse)
+ .put(serverDetail, serverDetailResponse).build();
+
+ Injector forSecurityGroups = requestsSendResponses(requestResponseMap);
+
+ Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
+
+ NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);
+
+ NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
+ template);
+ assertNotNull(server);
+ assertNull(server.getCredentials());
+ }
+
+ @Override
+ public Injector apply(ComputeServiceContext input) {
+ return input.utils().injector();
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties overrides = super.setupProperties();
+ // only specify one zone so that we don't have to configure requests for multiple zones
+ overrides.setProperty("jclouds.zones", "az-1.region-a.geo-1");
+ return overrides;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceExpectTest.java
new file mode 100644
index 0000000..1888963
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceExpectTest.java
@@ -0,0 +1,382 @@
+/*
+ * 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.openstack.nova.v2_0.compute;
+
+import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.blockUntilRunning;
+import static org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions.Builder.keyPairName;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.domain.Location;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.Iterables;
+import com.google.inject.AbstractModule;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Tests the compute service abstraction of the nova api.
+ *
+ * @author Matt Stephenson
+ */
+@Test(groups = "unit", testName = "NovaComputeServiceExpectTest")
+public class NovaComputeServiceExpectTest extends BaseNovaComputeServiceExpectTest {
+
+ @Override
+ protected Properties setupProperties() {
+ Properties overrides = super.setupProperties();
+ // only specify limited zones so that we don't have to configure requests for multiple zones.
+ // since we are doing tests with keystone responses from hpcloud and also openstack, we have
+ // to whitelist one zone from each
+ overrides.setProperty("jclouds.zones", "az-1.region-a.geo-1,RegionOne");
+ return overrides;
+ }
+
+ public void testListLocationsWhenResponseIs2xx() throws Exception {
+
+ Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
+ .put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(listDetail, listDetailResponse)
+ .put(listServers, listServersResponse).put(listFlavorsDetail, listFlavorsDetailResponse).build();
+
+ ComputeService apiWhenServersExist = requestsSendResponses(requestResponseMap);
+
+ Set<? extends Location> locations = apiWhenServersExist.listAssignableLocations();
+ assertNotNull(locations);
+ assertEquals(locations.size(), 1);
+ assertEquals(locations.iterator().next().getId(), "az-1.region-a.geo-1");
+
+ assertNotNull(apiWhenServersExist.listNodes());
+ assertEquals(apiWhenServersExist.listNodes().size(), 1);
+ assertEquals(apiWhenServersExist.listNodes().iterator().next().getId(),
+ "az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f000004d2");
+ assertEquals(apiWhenServersExist.listNodes().iterator().next().getName(), "sample-server");
+ }
+
+ Map<HttpRequest, HttpResponse> defaultTemplateOpenStack = ImmutableMap
+ .<HttpRequest, HttpResponse> builder()
+ .put(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ HttpResponse
+ .builder()
+ .statusCode(200)
+ .message("HTTP/1.1 200")
+ .payload(
+ payloadFromResourceWithContentType("/keystoneAuthResponse_openstack.json", "application/json"))
+ .build())
+ .put(extensionsOfNovaRequest.toBuilder()
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/extensions").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/extension_list_openstack.json"))
+ .build())
+ .put(listDetail.toBuilder()
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/images/detail").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/image_list_detail_openstack.json"))
+ .build())
+ .put(listServers.toBuilder()
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers/detail").build(),
+ listServersResponse)
+ .put(listFlavorsDetail.toBuilder()
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/flavors/detail").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResource("/flavor_list_detail_openstack.json"))
+ .build()).build();
+
+ public void testDefaultTemplateOpenStack() throws Exception {
+
+ ComputeService apiForOpenStack = requestsSendResponses(defaultTemplateOpenStack);
+
+ Template defaultTemplate = apiForOpenStack.templateBuilder().imageId("RegionOne/15").build();
+ checkTemplate(defaultTemplate);
+ checkTemplate(apiForOpenStack.templateBuilder().fromTemplate(defaultTemplate).build());
+
+ }
+
+ private void checkTemplate(Template defaultTemplate) {
+ assertEquals(defaultTemplate.getImage().getId(), "RegionOne/15");
+ assertEquals(defaultTemplate.getImage().getProviderId(), "15");
+ assertEquals(defaultTemplate.getHardware().getId(), "RegionOne/1");
+ assertEquals(defaultTemplate.getHardware().getProviderId(), "1");
+ assertEquals(defaultTemplate.getLocation().getId(), "RegionOne");
+ assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
+ }
+
+ public void testListServersWhenReponseIs404IsEmpty() throws Exception {
+ HttpRequest listServers = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/detail")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listServersResponse = HttpResponse.builder().statusCode(404).build();
+
+ ComputeService apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, listServers, listServersResponse);
+
+ assertTrue(apiWhenNoServersExist.listNodes().isEmpty());
+ }
+
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-security-groups")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse notFound = HttpResponse.builder().statusCode(404).build();
+
+ HttpRequest createWithPrefixOnGroup = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-security-groups")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group\":{\"name\":\"jclouds-test\",\"description\":\"jclouds-test\"}}",
+ "application/json")).build();
+
+ HttpResponse securityGroupCreated = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/securitygroup_created.json")).build();
+
+ HttpRequest createRuleForDefaultPort22 = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-security-group-rules")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group_rule\":{\"parent_group_id\":\"160\",\"cidr\":\"0.0.0.0/0\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
+ "application/json")).build();
+
+ HttpResponse securityGroupRuleCreated = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/securitygrouprule_created.json")).build();
+
+ HttpRequest getSecurityGroup = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-security-groups/160")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse securityGroupWithPort22 = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/securitygroup_details_port22.json")).build();
+
+ HttpRequest create = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/os-keypairs")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"keypair\":{\"name\":\"jclouds-test-0\"}}",
+ "application/json")).build();
+
+ HttpResponse keyPairWithPrivateKey = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/keypair_created_computeservice.json")).build();
+
+ HttpRequest serverDetail = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers/71752")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse serverDetailResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_details.json")).build();
+
+ @Test
+ public void testCreateNodeWithGeneratedKeyPair() throws Exception {
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .putAll(defaultTemplateOpenStack);
+ requestResponseMap.put(list, notFound);
+
+ requestResponseMap.put(createWithPrefixOnGroup, securityGroupCreated);
+
+ requestResponseMap.put(createRuleForDefaultPort22, securityGroupRuleCreated);
+
+ requestResponseMap.put(getSecurityGroup, securityGroupWithPort22);
+
+ requestResponseMap.put(create, keyPairWithPrivateKey);
+
+ requestResponseMap.put(serverDetail, serverDetailResponse);
+
+ HttpRequest createServerWithGeneratedKeyPair = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-1\",\"imageRef\":\"14\",\"flavorRef\":\"1\"," +
+ "\"metadata\":{\"jclouds-group\":\"test\"},\"key_name\":\"jclouds-test-0\",\"security_groups\":[{\"name\":\"jclouds-test\"}]}}",
+ "application/json")).build();
+
+ HttpResponse createdServer = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server.json", "application/json; charset=UTF-8")).build();
+
+ requestResponseMap.put(createServerWithGeneratedKeyPair, createdServer);
+
+ ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build(), new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ // predicatable node names
+ final AtomicInteger suffix = new AtomicInteger();
+ bind(new TypeLiteral<Supplier<String>>() {
+ }).toInstance(new Supplier<String>() {
+
+ @Override
+ public String get() {
+ return suffix.getAndIncrement() + "";
+ }
+
+ });
+ }
+
+ });
+
+ NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
+ blockUntilRunning(false).generateKeyPair(true)));
+ assertNotNull(node.getCredentials().getPrivateKey());
+ }
+
+ @Test
+ public void testCreateNodeWhileUserSpecifiesKeyPair() throws Exception {
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .putAll(defaultTemplateOpenStack);
+ requestResponseMap.put(list, notFound);
+
+ requestResponseMap.put(createWithPrefixOnGroup, securityGroupCreated);
+
+ requestResponseMap.put(createRuleForDefaultPort22, securityGroupRuleCreated);
+
+ requestResponseMap.put(getSecurityGroup, securityGroupWithPort22);
+
+ requestResponseMap.put(serverDetail, serverDetailResponse);
+
+ HttpRequest createServerWithSuppliedKeyPair = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-0\",\"imageRef\":\"14\",\"flavorRef\":\"1\"," +
+ "\"metadata\":{\"jclouds-group\":\"test\"},\"key_name\":\"fooPair\",\"security_groups\":[{\"name\":\"jclouds-test\"}]}}",
+ "application/json")).build();
+
+ HttpResponse createdServer = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server.json", "application/json; charset=UTF-8")).build();
+
+ requestResponseMap.put(createServerWithSuppliedKeyPair, createdServer);
+
+ ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build(), new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ // predicatable node names
+ final AtomicInteger suffix = new AtomicInteger();
+ bind(new TypeLiteral<Supplier<String>>() {
+ }).toInstance(new Supplier<String>() {
+
+ @Override
+ public String get() {
+ return suffix.getAndIncrement() + "";
+ }
+
+ });
+ }
+
+ });
+
+ NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
+ keyPairName("fooPair").blockUntilRunning(false)));
+ // we don't have access to this private key
+ assertEquals(node.getCredentials().getPrivateKey(), null);
+ }
+
+
+ @Test
+ public void testCreateNodeWhileUserSpecifiesKeyPairAndUserSpecifiedGroups() throws Exception {
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .putAll(defaultTemplateOpenStack);
+ requestResponseMap.put(list, notFound);
+
+ requestResponseMap.put(serverDetail, serverDetailResponse);
+
+ HttpRequest createServerWithSuppliedKeyPairAndGroup = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://nova-api.openstack.org:9774/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"server\":{\"name\":\"test-0\",\"imageRef\":\"14\",\"flavorRef\":\"1\"," +
+ "\"metadata\":{\"jclouds-group\":\"test\"},\"key_name\":\"fooPair\",\"security_groups\":[{\"name\":\"mygroup\"}]}}",
+ "application/json")).build();
+
+ HttpResponse createdServer = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
+ .payload(payloadFromResourceWithContentType("/new_server.json", "application/json; charset=UTF-8")).build();
+
+ requestResponseMap.put(createServerWithSuppliedKeyPairAndGroup, createdServer);
+
+ ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build(), new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ // predicatable node names
+ final AtomicInteger suffix = new AtomicInteger();
+ bind(new TypeLiteral<Supplier<String>>() {
+ }).toInstance(new Supplier<String>() {
+
+ @Override
+ public String get() {
+ return suffix.getAndIncrement() + "";
+ }
+
+ });
+ }
+
+ });
+
+ NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
+ keyPairName("fooPair").securityGroupNames("mygroup").blockUntilRunning(false)));
+ // we don't have access to this private key
+ assertEquals(node.getCredentials().getPrivateKey(), null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java
new file mode 100644
index 0000000..d20126c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.openstack.nova.v2_0.compute;
+
+import static java.util.logging.Logger.getAnonymousLogger;
+
+import java.util.Properties;
+
+import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
+import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
+import org.jclouds.openstack.nova.v2_0.config.NovaProperties;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.testng.annotations.Test;
+
+import com.google.inject.Module;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaComputeServiceLiveTest")
+public class NovaComputeServiceLiveTest extends BaseComputeServiceLiveTest {
+
+ public NovaComputeServiceLiveTest() {
+ provider = "openstack-nova";
+ }
+
+ @Override
+ protected Module getSshModule() {
+ return new SshjSshClientModule();
+ }
+
+ @Override
+ public void testOptionToNotBlock() {
+ // start call is blocking anyway.
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testReboot")
+ public void testSuspendResume() throws Exception {
+ try {
+ // may fail because of lack of AdminActions extension or non-admin user, so log and continue
+ super.testSuspendResume();
+ } catch (AuthorizationException e) {
+ getAnonymousLogger().info("testSuspendResume() threw, probably due to lack of privileges: " + e.getMessage());
+ } catch (UnsupportedOperationException e) {
+ getAnonymousLogger().info("testSuspendResume() threw, probably due to unavailable AdminActions extension: " + e.getMessage());
+ }
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testSuspendResume")
+ @Override
+ public void testGetNodesWithDetails() throws Exception {
+ super.testGetNodesWithDetails();
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testSuspendResume")
+ @Override
+ public void testListNodes() throws Exception {
+ super.testListNodes();
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testSuspendResume")
+ @Override
+ public void testListNodesByIds() throws Exception {
+ super.testListNodesByIds();
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testListNodes", "testGetNodesWithDetails", "testListNodesByIds" })
+ @Override
+ public void testDestroyNodes() {
+ super.testDestroyNodes();
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties props = super.setupProperties();
+ setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
+ setIfTestSystemPropertyPresent(props, NovaProperties.AUTO_ALLOCATE_FLOATING_IPS);
+ return props;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionExpectTest.java
new file mode 100644
index 0000000..afd289f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionExpectTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.openstack.nova.v2_0.compute.extensions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageTemplate;
+import org.jclouds.compute.extensions.ImageExtension;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.util.concurrent.Futures;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "NovaImageExtensionExpectTest")
+public class NovaImageExtensionExpectTest extends BaseNovaComputeServiceExpectTest {
+
+ @Override
+ protected Properties setupProperties() {
+ Properties overrides = super.setupProperties();
+ overrides.setProperty("jclouds.zones", "az-1.region-a.geo-1");
+ return overrides;
+ }
+
+ HttpRequest serverDetail = HttpRequest.builder().method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/71752")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse serverDetailResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_details.json")).build();
+
+ HttpRequest createImage = HttpRequest.builder().method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/71752/action")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"createImage\":{\"name\":\"test\", \"metadata\": {}}}",
+ "application/json")).build();
+
+ HttpResponse createImageResponse = HttpResponse.builder().statusCode(202)
+ .addHeader("Location", "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/52415800-8b69-11e0-9b19-734f5736d2a2")
+ .build();
+
+ HttpRequest getImage = HttpRequest.builder().method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/52415800-8b69-11e0-9b19-734f5736d2a2")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse getImageResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/image_active.json")).build();
+
+ public void testCreateImage() {
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
+ requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ requestResponseMap.put(serverDetail, serverDetailResponse).build();
+ requestResponseMap.put(createImage, createImageResponse).build();
+ requestResponseMap.put(getImage, getImageResponse).build();
+
+ ImageExtension apiThatCreatesImage = requestsSendResponses(requestResponseMap.build()).getImageExtension().get();
+
+ ImageTemplate newImageTemplate = apiThatCreatesImage.buildImageTemplateFromNode("test", "az-1.region-a.geo-1/71752");
+
+ Image image = Futures.getUnchecked(apiThatCreatesImage.createImage(newImageTemplate));
+ assertEquals(image.getId(), "az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f5736d2a2");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionLiveTest.java
new file mode 100644
index 0000000..463ff55
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtensionLiveTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.openstack.nova.v2_0.compute.extensions;
+
+import org.jclouds.compute.extensions.internal.BaseImageExtensionLiveTest;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.testng.annotations.Test;
+
+import com.google.inject.Module;
+
+/**
+ * Live test for openstack-nova {@link ImageExtension} implementation.
+ *
+ * @author David Alves
+ *
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaImageExtensionLiveTest")
+public class NovaImageExtensionLiveTest extends BaseImageExtensionLiveTest {
+
+ public NovaImageExtensionLiveTest() {
+ provider = "openstack-nova";
+ }
+
+ @Override
+ protected Module getSshModule() {
+ return new SshjSshClientModule();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionExpectTest.java
new file mode 100644
index 0000000..809b4da
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionExpectTest.java
@@ -0,0 +1,433 @@
+/*
+ * 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.openstack.nova.v2_0.compute.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Properties;
+import java.util.Set;
+
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.compute.extensions.SecurityGroupExtension;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.net.domain.IpPermission;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.LinkedHashMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Sets;
+
+/**
+ *
+ * @author Andrew Bayer
+ */
+@Test(groups = "unit", testName = "NovaSecurityGroupExtensionExpectTest")
+public class NovaSecurityGroupExtensionExpectTest extends BaseNovaComputeServiceExpectTest {
+
+ protected String zone = "az-1.region-a.geo-1";
+ protected HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ protected HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_list_extension.json")).build();
+
+ @Override
+ protected Properties setupProperties() {
+ Properties overrides = super.setupProperties();
+ overrides.setProperty("jclouds.zones", zone);
+ return overrides;
+ }
+
+ public void testListSecurityGroups() {
+
+
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
+ requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
+ requestResponseMap.put(list, listResponse).build();
+
+ SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
+
+ Set<SecurityGroup> groups = extension.listSecurityGroups();
+ assertEquals(groups.size(), 1);
+ }
+
+ public void testListSecurityGroupsInLocation() {
+ HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_list.json")).build();
+
+
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
+ requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
+ requestResponseMap.put(list, listResponse).build();
+
+ SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
+
+ Set<SecurityGroup> groups = extension.listSecurityGroupsInLocation(new LocationBuilder()
+ .scope(LocationScope.ZONE)
+ .id(zone)
+ .description("zone")
+ .build());
+ assertEquals(groups.size(), 1);
+ }
+
+ public void testListSecurityGroupsForNode() {
+ HttpRequest serverReq = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"))
+ .headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse serverResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/server_with_security_groups_extension.json")).build();
+
+ HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_list.json")).build();
+
+
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
+ requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
+ requestResponseMap.put(serverReq, serverResponse);
+ requestResponseMap.put(list, listResponse).build();
+
+ SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
+
+ Set<SecurityGroup> groups = extension.listSecurityGroupsForNode(zone + "/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
+ assertEquals(groups.size(), 1);
+ }
+
+ public void testGetSecurityGroupById() {
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension.json")).build();
+
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
+ requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
+ requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse);
+ requestResponseMap.put(list, listResponse).build();
+
+ SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
+
+ SecurityGroup group = extension.getSecurityGroupById(zone + "/160");
+ assertEquals(group.getId(), zone + "/160");
+ }
+
+ public void testCreateSecurityGroup() {
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension.json")).build();
+
+ HttpRequest create = HttpRequest.builder().method("POST").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build())
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group\":{\"name\":\"jclouds-test\",\"description\":\"jclouds-test\"}}",
+ "application/json")).build();
+
+ HttpResponse createResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_created.json")).build();
+
+ HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
+ ImmutableMultimap.<String, String>builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_list_extension.json")).build();
+
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
+ requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
+ requestResponseMap.put(create, createResponse);
+ requestResponseMap.put(list, listResponse);
+ requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse).build();
+
+ SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
+
+ SecurityGroup group = extension.createSecurityGroup("test", new LocationBuilder()
+ .scope(LocationScope.ZONE)
+ .id(zone)
+ .description("zone")
+ .build());
+ assertEquals(group.getId(), zone + "/160");
+ }
+
+ public void testRemoveSecurityGroup() {
+ HttpRequest delete = HttpRequest.builder().method("DELETE").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160"))
+ .headers(
+ ImmutableMultimap.<String, String>builder().put("Accept", "application/json")
+ .put("X-Auth-Token", authToken).build()).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(202).build();
+
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension.json")).build();
+
+ Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
+ requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
+ requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
+ requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse);
+ requestResponseMap.put(delete, deleteResponse).build();
+
+ SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
+
+ assertTrue(extension.removeSecurityGroup(zone + "/160"), "Expected removal of securitygroup to be successful");
+ }
+
+ public void testAddIpPermissionCidrFromIpPermission() {
+ HttpRequest createRule = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group_rule\":{\"parent_group_id\":\"160\",\"cidr\":\"10.2.6.0/24\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
+ "application/json")).build();
+
+ HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygrouprule_created_cidr.json")).build();
+
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupNoRulesResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension_norules.json")).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension.json")).build();
+
+
+ SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
+ ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
+ createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();
+
+ IpPermission.Builder builder = IpPermission.builder();
+
+ builder.ipProtocol(IpProtocol.TCP);
+ builder.fromPort(22);
+ builder.toPort(22);
+ builder.cidrBlock("10.2.6.0/24");
+
+ IpPermission perm = builder.build();
+
+ SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");
+
+ assertNotNull(origGroup);
+ SecurityGroup newGroup = extension.addIpPermission(perm, origGroup);
+
+ assertNotNull(newGroup);
+ }
+
+ public void testAddIpPermissionCidrFromParams() {
+ HttpRequest createRule = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group_rule\":{\"parent_group_id\":\"160\",\"cidr\":\"10.2.6.0/24\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
+ "application/json")).build();
+
+ HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygrouprule_created_cidr.json")).build();
+
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupNoRulesResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension_norules.json")).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension.json")).build();
+
+
+ SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
+ ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
+ createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();
+
+ SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");
+
+ assertNotNull(origGroup);
+ SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
+ 22,
+ 22,
+ emptyMultimap(),
+ ImmutableSet.of("10.2.6.0/24"),
+ emptyStringSet(),
+ origGroup);
+
+ assertNotNull(newGroup);
+ }
+
+ public void testAddIpPermissionGroupFromIpPermission() {
+ HttpRequest createRule = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group_rule\":{\"group_id\":\"11111\",\"parent_group_id\":\"160\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
+ "application/json")).build();
+
+ HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygrouprule_created_group.json")).build();
+
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupNoRulesResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension_norules.json")).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension.json")).build();
+
+
+ SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
+ ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
+ createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();
+
+ IpPermission.Builder builder = IpPermission.builder();
+
+ builder.ipProtocol(IpProtocol.TCP);
+ builder.fromPort(22);
+ builder.toPort(22);
+ builder.groupId("admin/11111");
+
+ IpPermission perm = builder.build();
+
+ SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");
+
+ assertNotNull(origGroup);
+ SecurityGroup newGroup = extension.addIpPermission(perm, origGroup);
+
+ assertNotNull(newGroup);
+ }
+
+ public void testAddIpPermissionGroupFromParams() {
+ HttpRequest createRule = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-group-rules")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"security_group_rule\":{\"group_id\":\"11111\",\"parent_group_id\":\"160\",\"ip_protocol\":\"tcp\",\"from_port\":\"22\",\"to_port\":\"22\"}}",
+ "application/json")).build();
+
+ HttpResponse createRuleResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygrouprule_created_group.json")).build();
+
+ HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups/160")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse getSecurityGroupNoRulesResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension_norules.json")).build();
+
+ HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/securitygroup_details_extension.json")).build();
+
+
+ SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
+ ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
+ createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();
+
+ SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");
+
+ assertNotNull(origGroup);
+ SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
+ 22,
+ 22,
+ emptyMultimap(),
+ emptyStringSet(),
+ ImmutableSet.of("admin/11111"),
+ origGroup);
+
+ assertNotNull(newGroup);
+ }
+
+ private Multimap<String, String> emptyMultimap() {
+ return LinkedHashMultimap.create();
+ }
+
+ private Set<String> emptyStringSet() {
+ return Sets.newLinkedHashSet();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionLiveTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionLiveTest.java
new file mode 100644
index 0000000..4a7dbed
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtensionLiveTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.openstack.nova.v2_0.compute.extensions;
+
+import org.jclouds.compute.extensions.internal.BaseSecurityGroupExtensionLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * Live test for openstack-nova {@link org.jclouds.compute.extensions.SecurityGroupExtension} implementation.
+ *
+ * @author Andrew Bayer
+ *
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaSecurityGroupExtensionLiveTest")
+public class NovaSecurityGroupExtensionLiveTest extends BaseSecurityGroupExtensionLiveTest {
+
+ public NovaSecurityGroupExtensionLiveTest() {
+ provider = "openstack-nova";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java
new file mode 100644
index 0000000..a5631ca
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java
@@ -0,0 +1,133 @@
+/*
+ * 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.openstack.nova.v2_0.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URI;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.NodeMetadata.Status;
+import org.jclouds.compute.domain.NodeMetadataBuilder;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaComputeServiceExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.Atomics;
+
+/**
+ * Tests the compute service abstraction of the nova api.
+ *
+ * @author Matt Stephenson
+ */
+@Test(groups = "unit", testName = "AllocateAndAddFloatingIpToNodeTest")
+public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeServiceExpectTest {
+ final Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("openstack-nova").description(
+ "openstack-nova").build();
+ final Location zone = new LocationBuilder().id("az-1.region-a.geo-1").description("az-1.region-a.geo-1").scope(
+ LocationScope.ZONE).parent(provider).build();
+ final Location host = new LocationBuilder().scope(LocationScope.HOST).id("hostId").description("hostId")
+ .parent(zone).build();
+ final NodeMetadata node = new NodeMetadataBuilder().id("az-1.region-a.geo-1/71592").providerId("71592").location(
+ host).name("Server 71592").status(Status.RUNNING).privateAddresses(ImmutableSet.of("10.4.27.237"))
+ .credentials(LoginCredentials.builder().password("foo").build()).build();
+
+ HttpRequest createFloatingIP = HttpRequest.builder().method("POST").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).payload(payloadFromStringWithContentType("{}", "application/json")).build();
+
+ HttpResponse addFloatingIPResponse = HttpResponse.builder().statusCode(200).build();
+
+ public void testAllocateWhenAllocationReturnsIpIsAddedToServerAndUpdatesNodeMetadataButSavesCredentials() throws Exception {
+ HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/floatingip_details.json")).build();
+
+ HttpRequest addFloatingIPRequest = addFloatingIPForAddress("10.0.0.3");
+
+ AllocateAndAddFloatingIpToNode fn = requestsSendResponses(
+ ImmutableMap.<HttpRequest, HttpResponse> builder().put(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess).put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(
+ createFloatingIP, createFloatingIPResponse)
+ .put(addFloatingIPRequest, addFloatingIPResponse).build()).getContext().utils().injector()
+ .getInstance(AllocateAndAddFloatingIpToNode.class);
+
+ AtomicReference<NodeMetadata> nodeRef = Atomics.newReference(node);
+ fn.apply(nodeRef);
+ NodeMetadata node1 = nodeRef.get();
+ assertNotNull(node1);
+ assertEquals(node1.getPublicAddresses(), ImmutableSet.of("10.0.0.3"));
+ assertEquals(node1.getCredentials(), node.getCredentials());
+
+ }
+
+ private HttpRequest addFloatingIPForAddress(String address) {
+ HttpRequest addFloatingIPRequest = HttpRequest.builder().method("POST").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/71592/action"))
+ .headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "*/*")
+ .put("X-Auth-Token", authToken).build()).payload(
+ payloadFromStringWithContentType("{\"addFloatingIp\":{\"address\":\"" + address + "\"}}",
+ "application/json")).build();
+ return addFloatingIPRequest;
+ }
+
+ public void testAllocateWhenAllocationFailsLookupUnusedIpAddToServerAndUpdatesNodeMetadata() throws Exception {
+ HttpResponse createFloatingIPResponse = HttpResponse
+ .builder()
+ .statusCode(400)
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"badRequest\": {\"message\": \"AddressLimitExceeded: Address quota exceeded. You cannot create any more addresses\", \"code\": 400}}",
+ "application/json")).build();
+
+ HttpRequest list = HttpRequest.builder().method("GET").endpoint(
+ URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")).headers(
+ ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
+ authToken).build()).build();
+
+ HttpResponse listResponseForUnassigned = HttpResponse.builder().statusCode(200).payload(
+ payloadFromResource("/floatingip_list.json")).build();
+
+ HttpRequest addFloatingIPRequest = addFloatingIPForAddress("10.0.0.5");
+
+ AllocateAndAddFloatingIpToNode fn = requestsSendResponses(
+ ImmutableMap.<HttpRequest, HttpResponse> builder().put(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess).put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(
+ createFloatingIP, createFloatingIPResponse)
+ .put(addFloatingIPRequest, addFloatingIPResponse).put(list,
+ listResponseForUnassigned).build()).getContext().utils().injector()
+ .getInstance(AllocateAndAddFloatingIpToNode.class);
+
+ AtomicReference<NodeMetadata> nodeRef = Atomics.newReference(node);
+ fn.apply(nodeRef);
+ NodeMetadata node1 = nodeRef.get();
+ assertNotNull(node1);
+ assertEquals(node1.getPublicAddresses(), ImmutableSet.of("10.0.0.5"));
+
+ }
+}
[42/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
new file mode 100644
index 0000000..b135e19
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
@@ -0,0 +1,557 @@
+/*
+ * 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.openstack.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Strings.emptyToNull;
+import static com.google.common.io.BaseEncoding.base64;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Network;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.collect.ForwardingObject;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * @author Adrian Cole
+ * @author Inbar Stolberg
+ * @author Zack Shoylev
+ */
+public class CreateServerOptions implements MapBinder {
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ static class File {
+ private final String path;
+ private final String contents;
+
+ public File(String path, byte[] contents) {
+ this.path = checkNotNull(path, "path");
+ this.contents = base64().encode(checkNotNull(contents, "contents"));
+ checkArgument(
+ path.getBytes().length < 255,
+ String.format("maximum length of path is 255 bytes. Path specified %s is %d bytes", path,
+ path.getBytes().length));
+ checkArgument(contents.length < 10 * 1024,
+ String.format("maximum size of the file is 10KB. Contents specified is %d bytes", contents.length));
+ }
+
+ public String getContents() {
+ return contents;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof File) {
+ final File other = File.class.cast(object);
+ return equal(path, other.path);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(path);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper("file").add("path", path).toString();
+ }
+
+ }
+
+ private String keyName;
+ private String adminPass;
+ private Set<String> securityGroupNames = ImmutableSet.of();
+ private Map<String, String> metadata = ImmutableMap.of();
+ private List<File> personality = Lists.newArrayList();
+ private byte[] userData;
+ private String diskConfig;
+ private Set<String> networks = ImmutableSet.of();
+ private Set<Network> novaNetworks = ImmutableSet.of();
+ private String availabilityZone;
+ private boolean configDrive;
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof CreateServerOptions) {
+ final CreateServerOptions other = CreateServerOptions.class.cast(object);
+ return equal(keyName, other.keyName) && equal(securityGroupNames, other.securityGroupNames)
+ && equal(metadata, other.metadata) && equal(personality, other.personality)
+ && equal(adminPass, other.adminPass) && equal(diskConfig, other.diskConfig)
+ && equal(adminPass, other.adminPass) && equal(networks, other.networks)
+ && equal(availabilityZone, other.availabilityZone);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(keyName, securityGroupNames, metadata, personality, adminPass, networks, availabilityZone);
+ }
+
+ protected ToStringHelper string() {
+ ToStringHelper toString = Objects.toStringHelper("").omitNullValues();
+ toString.add("keyName", keyName);
+ if (securityGroupNames.size() > 0)
+ toString.add("securityGroupNames", securityGroupNames);
+ if (metadata.size() > 0)
+ toString.add("metadata", metadata);
+ if (personality.size() > 0)
+ toString.add("personality", personality);
+ if (adminPass != null)
+ toString.add("adminPassPresent", true);
+ if (diskConfig != null)
+ toString.add("diskConfig", diskConfig);
+ toString.add("userData", userData == null ? null : new String(userData));
+ if (!networks.isEmpty())
+ toString.add("networks", networks);
+ toString.add("availability_zone", availabilityZone == null ? null : availabilityZone);
+ return toString;
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ static class ServerRequest {
+ final String name;
+ final String imageRef;
+ final String flavorRef;
+ @Named("availability_zone")
+ String availabilityZone;
+ String adminPass;
+ Map<String, String> metadata;
+ List<File> personality;
+ String key_name;
+ @Named("security_groups")
+ Set<NamedThingy> securityGroupNames;
+ String user_data;
+ @Named("OS-DCF:diskConfig")
+ String diskConfig;
+ Set<Map<String, String>> networks;
+
+ private ServerRequest(String name, String imageRef, String flavorRef) {
+ this.name = name;
+ this.imageRef = imageRef;
+ this.flavorRef = flavorRef;
+ }
+
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ ServerRequest server = new ServerRequest(checkNotNull(postParams.get("name"), "name parameter not present").toString(),
+ checkNotNull(postParams.get("imageRef"), "imageRef parameter not present").toString(),
+ checkNotNull(postParams.get("flavorRef"), "flavorRef parameter not present").toString());
+ if (metadata.size() > 0)
+ server.metadata = metadata;
+ if (personality.size() > 0)
+ server.personality = personality;
+ if (keyName != null)
+ server.key_name = keyName;
+ if (availabilityZone != null)
+ server.availabilityZone = availabilityZone;
+ if (userData != null)
+ server.user_data = base64().encode(userData);
+ if (securityGroupNames.size() > 0) {
+ server.securityGroupNames = Sets.newLinkedHashSet();
+ for (String groupName : securityGroupNames) {
+ server.securityGroupNames.add(new NamedThingy(groupName));
+ }
+ }
+ if (adminPass != null) {
+ server.adminPass = adminPass;
+ }
+
+ if (diskConfig != null) {
+ server.diskConfig = diskConfig;
+ }
+
+ if (!networks.isEmpty() || !novaNetworks.isEmpty()) {
+ server.networks = Sets.newLinkedHashSet(); // ensures ordering is preserved - helps testing and more intuitive for users.
+ for (Network network : novaNetworks) {
+ // Avoid serializing null values, which are common here.
+ ImmutableMap.Builder<String, String> networkMap = new ImmutableMap.Builder<String, String>();
+ if(network.getNetworkUuid() != null) {
+ networkMap.put("uuid", network.getNetworkUuid());
+ }
+ if(network.getPortUuid() != null) {
+ networkMap.put("port", network.getPortUuid());
+ }
+ if(network.getFixedIp() != null) {
+ networkMap.put("fixed_ip", network.getFixedIp());
+ }
+ server.networks.add(networkMap.build());
+ }
+ for (String network : networks) {
+ server.networks.add(ImmutableMap.of("uuid", network));
+ }
+ }
+
+ return bindToRequest(request, ImmutableMap.of("server", server));
+ }
+
+ private static class NamedThingy extends ForwardingObject {
+ private String name;
+
+ private NamedThingy(String name) {
+ this.name = name;
+ }
+
+ @Override
+ protected Object delegate() {
+ return name;
+ }
+ }
+
+ /**
+ * You may further customize a cloud server by injecting data into the file
+ * system of the cloud server itself. This is useful, for example, for
+ * inserting ssh keys, setting configuration files, or storing data that you
+ * want to retrieve from within the instance itself. It is intended to
+ * provide a minimal amount of launch-time personalization. If significant
+ * customization is required, a custom image should be created. The max size
+ * of the file path data is 255 bytes while the max size of the file contents
+ * is 10KB. Note that the file contents should be encoded as a Base64 string
+ * and the 10KB limit refers to the number of bytes in the decoded data not
+ * the number of characters in the encoded data. The maximum number of file
+ * path/content pairs that can be supplied is 5. Any existing files that
+ * match the specified file will be renamed to include the extension bak
+ * followed by a time stamp. For example, the file /etc/passwd will be backed
+ * up as /etc/passwd.bak.1246036261.5785. All files will have root and the
+ * root group as owner and group owner, respectively and will allow user and
+ * group read access only (-r--r-----).
+ */
+ public CreateServerOptions writeFileToPath(byte[] contents, String path) {
+ checkState(personality.size() < 5, "maximum number of files allowed is 5");
+ personality.add(new File(path, contents));
+ return this;
+ }
+
+ public CreateServerOptions adminPass(String adminPass) {
+ checkNotNull(adminPass, "adminPass");
+ this.adminPass = adminPass;
+ return this;
+ }
+
+ /**
+ * Custom cloud server metadata can also be supplied at launch time. This
+ * metadata is stored in the API system where it is retrievable by querying
+ * the API for server status. The maximum size of the metadata key and value
+ * is each 255 bytes and the maximum number of key-value pairs that can be
+ * supplied per server is 5.
+ */
+ public CreateServerOptions metadata(Map<String, String> metadata) {
+ checkNotNull(metadata, "metadata");
+ checkArgument(metadata.size() <= 5,
+ "you cannot have more then 5 metadata values. You specified: " + metadata.size());
+ for (Entry<String, String> entry : metadata.entrySet()) {
+ checkArgument(
+ entry.getKey().getBytes().length < 255,
+ String.format("maximum length of metadata key is 255 bytes. Key specified %s is %d bytes",
+ entry.getKey(), entry.getKey().getBytes().length));
+ checkArgument(entry.getKey().getBytes().length < 255, String.format(
+ "maximum length of metadata value is 255 bytes. Value specified for %s (%s) is %d bytes",
+ entry.getKey(), entry.getValue(), entry.getValue().getBytes().length));
+ }
+ this.metadata = ImmutableMap.copyOf(metadata);
+ return this;
+ }
+
+ /**
+ * Custom user-data can be also be supplied at launch time.
+ * It is retrievable by the instance and is often used for launch-time configuration
+ * by instance scripts.
+ */
+ public CreateServerOptions userData(byte[] userData) {
+ this.userData = userData;
+ return this;
+ }
+
+ /**
+ * Set to true to use a config drive for metadata.
+ * This is a separate configuration drive that can be used separately from the metadata service.
+ * This needs to be set to "true" when trying to use user data for cloud-init.
+ * @see http://docs.openstack.org/grizzly/openstack-compute/admin/content/config-drive.html
+ */
+ public CreateServerOptions configDrive(boolean configDrive) {
+ this.configDrive = configDrive;
+ return this;
+ }
+
+ /**
+ * A keypair name can be defined when creating a server. This key will be
+ * linked to the server and used to SSH connect to the machine
+ */
+ public String getKeyPairName() {
+ return keyName;
+ }
+
+ public String getAvailabilityZone() {
+ return availabilityZone;
+ }
+
+ /**
+ * @see #getKeyPairName()
+ */
+ public CreateServerOptions keyPairName(String keyName) {
+ this.keyName = keyName;
+ return this;
+ }
+
+ /**
+ * @see #getAvailabilityZone()
+ */
+ public CreateServerOptions availabilityZone(String availabilityZone) {
+ this.availabilityZone = availabilityZone;
+ return this;
+ }
+
+ /**
+ * Security groups the user specified to run servers with.
+ * <p/>
+ * <h3>Note</h3>
+ * <p/>
+ * This requires that {@link NovaApi#getSecurityGroupExtensionForZone(String)} to return
+ * {@link Optional#isPresent present}
+ */
+ public Set<String> getSecurityGroupNames() {
+ return securityGroupNames;
+ }
+
+ /**
+ * Get custom networks specified for the server.
+ *
+ * @return A set of uuids defined by Neutron (previously Quantum)
+ * @see <a href="https://wiki.openstack.org/wiki/Neutron/APIv2-specification#Network">Neutron Networks<a/>
+ */
+ public Set<String> getNetworks() {
+ return networks;
+ }
+
+ /**
+ * Get custom networks specified for the server.
+ *
+ * @return A set of uuids defined by Neutron (previously Quantum)
+ * @see <a href="https://wiki.openstack.org/wiki/Neutron/APIv2-specification#Network">Neutron Networks<a/>
+ */
+ public Set<Network> getNovaNetworks() {
+ return novaNetworks;
+ }
+
+ /**
+ * @see #getSecurityGroupNames
+ */
+ public CreateServerOptions securityGroupNames(String... securityGroupNames) {
+ return securityGroupNames(ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames")));
+ }
+
+ /**
+ * @see #getSecurityGroupNames
+ */
+ public CreateServerOptions securityGroupNames(Iterable<String> securityGroupNames) {
+ for (String groupName : checkNotNull(securityGroupNames, "securityGroupNames"))
+ checkNotNull(emptyToNull(groupName), "all security groups must be non-empty");
+ this.securityGroupNames = ImmutableSet.copyOf(securityGroupNames);
+ return this;
+ }
+
+ /**
+ * When you create a server from an image with the diskConfig value set to
+ * {@link Server#DISK_CONFIG_AUTO}, the server is built with a single partition that is expanded to
+ * the disk size of the flavor selected. When you set the diskConfig attribute to
+ * {@link Server#DISK_CONFIG_MANUAL}, the server is built by using the partition scheme and file
+ * system that is in the source image.
+ * <p/>
+ * If the target flavor disk is larger, remaining disk space is left unpartitioned. A server inherits the diskConfig
+ * attribute from the image from which it is created. However, you can override the diskConfig value when you create
+ * a server. This field is only present if the Disk Config extension is installed in your OpenStack deployment.
+ */
+ public String getDiskConfig() {
+ return diskConfig;
+ }
+
+ /**
+ * @see #getDiskConfig
+ */
+ public CreateServerOptions diskConfig(String diskConfig) {
+ this.diskConfig = diskConfig;
+ return this;
+ }
+
+ /**
+ * Determines if a configuration drive will be attached to the server or not.
+ * This can be used for cloud-init or other configuration purposes.
+ */
+ public boolean getConfigDrive() {
+ return configDrive;
+ }
+
+ /**
+ * @see #getNetworks
+ */
+ public CreateServerOptions networks(Iterable<String> networks) {
+ this.networks = ImmutableSet.copyOf(networks);
+ return this;
+ }
+
+ /**
+ * @see #getNetworks
+ * Overwrites networks supplied by {@link #networks(Iterable)}
+ */
+ public CreateServerOptions novaNetworks(Iterable<Network> networks) {
+ this.novaNetworks = ImmutableSet.copyOf(networks);
+ return this;
+ }
+
+ /**
+ * @see #getNetworks
+ */
+ public CreateServerOptions networks(String... networks) {
+ return networks(ImmutableSet.copyOf(networks));
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CreateServerOptions#writeFileToPath
+ */
+ public static CreateServerOptions writeFileToPath(byte[] contents, String path) {
+ CreateServerOptions options = new CreateServerOptions();
+ return options.writeFileToPath(contents, path);
+ }
+
+ public static CreateServerOptions adminPass(String adminPass) {
+ CreateServerOptions options = new CreateServerOptions();
+ return options.adminPass(adminPass);
+ }
+
+ /**
+ * @see CreateServerOptions#metadata(Map<String, String>)
+ */
+ public static CreateServerOptions metadata(Map<String, String> metadata) {
+ CreateServerOptions options = new CreateServerOptions();
+ return options.metadata(metadata);
+ }
+
+ /**
+ * @see #getKeyPairName()
+ */
+ public static CreateServerOptions keyPairName(String keyName) {
+ CreateServerOptions options = new CreateServerOptions();
+ return options.keyPairName(keyName);
+ }
+
+ /**
+ * @see CreateServerOptions#getSecurityGroupNames
+ */
+ public static CreateServerOptions securityGroupNames(String... groupNames) {
+ CreateServerOptions options = new CreateServerOptions();
+ return CreateServerOptions.class.cast(options.securityGroupNames(groupNames));
+ }
+
+ /**
+ * @see CreateServerOptions#getSecurityGroupNames
+ */
+ public static CreateServerOptions securityGroupNames(Iterable<String> groupNames) {
+ CreateServerOptions options = new CreateServerOptions();
+ return CreateServerOptions.class.cast(options.securityGroupNames(groupNames));
+ }
+
+ /**
+ * @see CreateServerOptions#getDiskConfig
+ */
+ public static CreateServerOptions diskConfig(String diskConfig) {
+ CreateServerOptions options = new CreateServerOptions();
+ return CreateServerOptions.class.cast(options.diskConfig(diskConfig));
+ }
+
+ /**
+ * @see CreateServerOptions#getNetworks
+ */
+ public static CreateServerOptions networks(String... networks) {
+ CreateServerOptions options = new CreateServerOptions();
+ return CreateServerOptions.class.cast(options.networks(networks));
+ }
+
+ /**
+ * @see CreateServerOptions#getNetworks
+ */
+ public static CreateServerOptions networks(Iterable<String> networks) {
+ CreateServerOptions options = new CreateServerOptions();
+ return CreateServerOptions.class.cast(options.networks(networks));
+ }
+
+ /**
+ * @see CreateServerOptions#getNetworks
+ */
+ public static CreateServerOptions novaNetworks(Iterable<Network> networks) {
+ CreateServerOptions options = new CreateServerOptions();
+ return CreateServerOptions.class.cast(options.novaNetworks(networks));
+ }
+
+ /**
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getAvailabilityZone()
+ */
+ public static CreateServerOptions availabilityZone(String availabilityZone) {
+ CreateServerOptions options = new CreateServerOptions();
+ return options.availabilityZone(availabilityZone);
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
new file mode 100644
index 0000000..921a4c8
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
@@ -0,0 +1,220 @@
+/*
+ * 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.openstack.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adam Lowe
+ */
+public class CreateVolumeOptions implements MapBinder {
+ public static final CreateVolumeOptions NONE = new CreateVolumeOptions();
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ protected String name;
+ protected String description;
+ protected String volumeType;
+ protected String availabilityZone;
+ protected String snapshotId;
+ protected Map<String, String> metadata = ImmutableMap.of();
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Map<String, Object> image = Maps.newHashMap();
+ image.putAll(postParams);
+ if (name != null)
+ image.put("display_name", name);
+ if (description != null)
+ image.put("display_description", description);
+ if (volumeType != null)
+ image.put("volume_type", volumeType);
+ if (availabilityZone != null)
+ image.put("availability_zone", availabilityZone);
+ if (snapshotId != null)
+ image.put("snapshot_id", snapshotId);
+ if (!metadata.isEmpty())
+ image.put("metadata", metadata);
+ return jsonBinder.bindToRequest(request, ImmutableMap.of("volume", image));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+ throw new IllegalStateException("CreateVolume is a POST operation");
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (!(object instanceof CreateVolumeOptions)) return false;
+ final CreateVolumeOptions other = CreateVolumeOptions.class.cast(object);
+ return equal(volumeType, other.volumeType) && equal(availabilityZone, other.availabilityZone) && equal(snapshotId, other.snapshotId)
+ && equal(name, other.name) && equal(description, other.description) && equal(metadata, other.metadata);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(volumeType, availabilityZone, snapshotId, name, description, metadata);
+ }
+
+ protected ToStringHelper string() {
+ return toStringHelper("").add("volumeType", volumeType).add("availabilityZone", availabilityZone)
+ .add("snapshotId", snapshotId).add("name", name).add("description", description).add("metadata", metadata);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ /**
+ * Custom cloud server metadata can also be supplied at launch time. This
+ * metadata is stored in the API system where it is retrievable by querying
+ * the API for server status. The maximum size of the metadata key and value
+ * is each 255 bytes and the maximum number of key-value pairs that can be
+ * supplied per volume is 5.
+ */
+ public CreateVolumeOptions metadata(Map<String, String> metadata) {
+ checkNotNull(metadata, "metadata");
+ checkArgument(metadata.size() <= 5,
+ "you cannot have more then 5 metadata values. You specified: " + metadata.size());
+ for (Entry<String, String> entry : metadata.entrySet()) {
+ checkArgument(
+ entry.getKey().getBytes().length < 255,
+ String.format("maximum length of metadata key is 255 bytes. Key specified %s is %d bytes",
+ entry.getKey(), entry.getKey().getBytes().length));
+ checkArgument(entry.getKey().getBytes().length < 255, String.format(
+ "maximum length of metadata value is 255 bytes. Value specified for %s (%s) is %d bytes",
+ entry.getKey(), entry.getValue(), entry.getValue().getBytes().length));
+ }
+ this.metadata = ImmutableMap.copyOf(metadata);
+ return this;
+ }
+
+ public CreateVolumeOptions name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public CreateVolumeOptions description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public CreateVolumeOptions volumeType(String volumeType) {
+ this.volumeType = volumeType;
+ return this;
+ }
+
+ public CreateVolumeOptions availabilityZone(String availabilityZone) {
+ this.availabilityZone = availabilityZone;
+ return this;
+ }
+
+ public CreateVolumeOptions snapshotId(String snapshotId) {
+ this.snapshotId = snapshotId;
+ return this;
+ }
+
+ public String getVolumeType() {
+ return volumeType;
+ }
+
+ public String getAvailabilityZone() {
+ return availabilityZone;
+ }
+
+ public String getSnapshotId() {
+ return snapshotId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Map<String, String> getMetadata() {
+ return metadata;
+ }
+
+ public static class Builder {
+ /**
+ * @see CreateVolumeOptions#getName()
+ */
+ public static CreateVolumeOptions name(String name) {
+ return new CreateVolumeOptions().name(name);
+ }
+ /**
+ * @see CreateVolumeOptions#getDescription()
+ */
+ public static CreateVolumeOptions description(String description) {
+ return new CreateVolumeOptions().description(description);
+ }
+
+ /**
+ * @see CreateVolumeOptions#getVolumeType()
+ */
+ public static CreateVolumeOptions volumeType(String volumeType) {
+ return new CreateVolumeOptions().volumeType(volumeType);
+ }
+
+ /**
+ * @see CreateVolumeOptions#getAvailabilityZone()
+ */
+ public static CreateVolumeOptions availabilityZone(String availabilityZone) {
+ return new CreateVolumeOptions().availabilityZone(availabilityZone);
+ }
+
+ /**
+ * @see CreateVolumeOptions#getSnapshotId()
+ */
+ public static CreateVolumeOptions snapshotId(String snapshotId) {
+ return new CreateVolumeOptions().snapshotId(snapshotId);
+ }
+
+ /**
+ * @see CreateVolumeOptions#getMetadata()
+ */
+ public static CreateVolumeOptions metadata(Map<String, String> metadata) {
+ return new CreateVolumeOptions().metadata(metadata);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
new file mode 100644
index 0000000..b159367
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
@@ -0,0 +1,138 @@
+/*
+ * 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.openstack.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adam Lowe
+ */
+public class CreateVolumeSnapshotOptions implements MapBinder {
+ public static final CreateVolumeSnapshotOptions NONE = new CreateVolumeSnapshotOptions();
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ private String name;
+ private String description;
+ private boolean force = false;
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Map<String, Object> data = Maps.newHashMap(postParams);
+ if (name != null)
+ data.put("display_name", name);
+ if (description != null)
+ data.put("display_description", description);
+ if (force)
+ data.put("force", "true");
+ return jsonBinder.bindToRequest(request, ImmutableMap.of("snapshot", data));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+ throw new IllegalStateException("CreateSnapshot is a POST operation");
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (!(object instanceof CreateVolumeSnapshotOptions)) return false;
+ final CreateVolumeSnapshotOptions other = CreateVolumeSnapshotOptions.class.cast(object);
+ return equal(name, other.name) && equal(description, other.description);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, description);
+ }
+
+ protected ToStringHelper string() {
+ return toStringHelper("").add("name", name).add("description", description);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ public CreateVolumeSnapshotOptions name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public CreateVolumeSnapshotOptions description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public CreateVolumeSnapshotOptions force() {
+ this.force = true;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public boolean isForce() {
+ return force;
+ }
+
+ public static class Builder {
+ /**
+ * @see CreateVolumeSnapshotOptions#getName()
+ */
+ public static CreateVolumeSnapshotOptions name(String name) {
+ return new CreateVolumeSnapshotOptions().name(name);
+ }
+ /**
+ * @see CreateVolumeSnapshotOptions#getDescription()
+ */
+ public static CreateVolumeSnapshotOptions description(String description) {
+ return new CreateVolumeSnapshotOptions().description(description);
+ }
+
+ /**
+ * @see CreateVolumeSnapshotOptions#isForce()
+ */
+ public static CreateVolumeSnapshotOptions force() {
+ return new CreateVolumeSnapshotOptions().force();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
new file mode 100644
index 0000000..7ab6460
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
@@ -0,0 +1,101 @@
+/*
+ * 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.openstack.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adam Lowe
+ */
+public class CreateVolumeTypeOptions implements MapBinder {
+ public static final CreateVolumeTypeOptions NONE = new CreateVolumeTypeOptions();
+
+ @Inject
+ protected BindToJsonPayload jsonBinder;
+
+ protected Map<String, String> specs = ImmutableMap.of();
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Map<String, Object> data = Maps.newHashMap();
+ data.putAll(postParams);
+ data.put("extra_specs", specs);
+ return jsonBinder.bindToRequest(request, ImmutableMap.of("volume_type", data));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+ throw new IllegalStateException("CreateWithExtraSpecs are POST operations");
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (!(object instanceof CreateVolumeTypeOptions)) return false;
+ final CreateVolumeTypeOptions other = CreateVolumeTypeOptions.class.cast(object);
+ return equal(specs, other.specs);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(specs);
+ }
+
+ protected ToStringHelper string() {
+ return toStringHelper("").add("specs", specs);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ public CreateVolumeTypeOptions specs(Map<String, String> specs) {
+ this.specs = specs;
+ return this;
+ }
+
+ public Map<String, String> getSpecs() {
+ return specs;
+ }
+
+ public static class Builder {
+ /**
+ * @see CreateVolumeTypeOptions#getSpecs()
+ */
+ public static CreateVolumeTypeOptions specs(Map<String, String> specs) {
+ return new CreateVolumeTypeOptions().specs(specs);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
new file mode 100644
index 0000000..23eb5f3
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
@@ -0,0 +1,107 @@
+/*
+ * 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.openstack.nova.v2_0.options;
+
+import java.util.Date;
+
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * Options used to control the amount of detail in the request.
+ *
+ * @see PaginationOptions
+ * @see <a href="http://wiki.openstack.org/OpenStackAPI_1-1" />
+ * @author Adrian Cole
+ */
+public class ListOptions extends PaginationOptions {
+
+ public static final ListOptions NONE = new ListOptions();
+
+ /**
+ * unless used, only the name and id will be returned per row.
+ *
+ * @return
+ */
+ public ListOptions withDetails() {
+ this.pathSuffix = "/detail";
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ListOptions changesSince(Date ifModifiedSince) {
+ super.changesSince(ifModifiedSince);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ListOptions limit(int limit) {
+ super.limit(limit);
+ return this;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ListOptions marker(String marker) {
+ super.marker(marker);
+ return this;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see ListOptions#withDetails()
+ */
+ public static ListOptions withDetails() {
+ ListOptions options = new ListOptions();
+ return options.withDetails();
+ }
+
+ /**
+ * @see PaginationOptions#marker(String)
+ */
+ public static ListOptions marker(String marker) {
+ ListOptions options = new ListOptions();
+ return options.marker(marker);
+ }
+
+ /**
+ * @see PaginationOptions#limit(long)
+ */
+ public static ListOptions maxResults(int maxKeys) {
+ ListOptions options = new ListOptions();
+ return options.limit(maxKeys);
+ }
+
+ /**
+ * @see PaginationOptions#changesSince(Date)
+ */
+ public static ListOptions changesSince(Date since) {
+ ListOptions options = new ListOptions();
+ return options.changesSince(since);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
new file mode 100644
index 0000000..e1f0d08
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
@@ -0,0 +1,142 @@
+/*
+ * 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.openstack.nova.v2_0.options;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ * @author Inbar Stolberg
+ */
+public class RebuildServerOptions implements MapBinder {
+ @Inject
+ private BindToJsonPayload jsonBinder;
+ String imageRef;
+ String name;
+ String adminPass;
+ String accessIPv4;
+ String accessIPv6;
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Map<String, String> image = Maps.newHashMap();
+ if (imageRef != null)
+ image.put("imageRef", imageRef);
+ if (name != null)
+ image.put("name", name);
+ if (adminPass != null)
+ image.put("adminPass", adminPass);
+ if (accessIPv4 != null)
+ image.put("accessIPv4", accessIPv4);
+ if (accessIPv6 != null)
+ image.put("accessIPv6", accessIPv6);
+
+
+ return jsonBinder.bindToRequest(request, ImmutableMap.of("rebuild", image));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+ throw new IllegalStateException("RebuildServer is a POST operation");
+ }
+
+ /**
+ * @param ref
+ * - reference of the image to rebuild the server with.
+ */
+ public RebuildServerOptions withImage(String ref) {
+ checkNotNull(ref, "image reference should not be null");
+ checkArgument(!ref.isEmpty(), "image reference should not be empty");
+ this.imageRef = ref;
+ return this;
+ }
+
+ public RebuildServerOptions name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public RebuildServerOptions adminPass(String adminPass) {
+ this.adminPass = adminPass;
+ return this;
+ }
+
+ public RebuildServerOptions ipv4Address(String ipv4Address) {
+ this.accessIPv4 = ipv4Address;
+ return this;
+ }
+
+ public RebuildServerOptions ipv6Address(String iPv6Address) {
+ this.accessIPv6 = iPv6Address;
+ return this;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see RebuildServerOptions#withImage(String)
+ */
+ public static RebuildServerOptions withImage(String ref) {
+ RebuildServerOptions options = new RebuildServerOptions();
+ return options.withImage(ref);
+ }
+
+ /**
+ * @see RebuildServerOptions#name(String)
+ */
+ public static RebuildServerOptions name(String name) {
+ RebuildServerOptions options = new RebuildServerOptions();
+ return options.name(name);
+ }
+
+ /**
+ * @see RebuildServerOptions#adminPass(String)
+ */
+ public static RebuildServerOptions adminPass(String adminPass) {
+ RebuildServerOptions options = new RebuildServerOptions();
+ return options.adminPass(adminPass);
+ }
+
+ /**
+ * @see RebuildServerOptions#ipv4Address(String)
+ */
+ public static RebuildServerOptions ipv4Address(String ipv4Address) {
+ RebuildServerOptions options = new RebuildServerOptions();
+ return options.ipv4Address(ipv4Address);
+ }
+
+ /**
+ * @see RebuildServerOptions#ipv6Address(String)
+ */
+ public static RebuildServerOptions ipv6Address(String ipv6Address) {
+ RebuildServerOptions options = new RebuildServerOptions();
+ return options.ipv6Address(ipv6Address);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
new file mode 100644
index 0000000..a44b502
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
@@ -0,0 +1,84 @@
+/*
+ * 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.openstack.nova.v2_0.predicates;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.NoSuchElementException;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.annotation.Resource;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
+import org.jclouds.rest.ResourceNotFoundException;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
+
+/**
+ * AtomicReference is so that we can return the securityGroup that matched.
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class FindSecurityGroupWithNameAndReturnTrue implements Predicate<AtomicReference<ZoneAndName>> {
+
+ private final NovaApi novaApi;
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Inject
+ public FindSecurityGroupWithNameAndReturnTrue(NovaApi novaApi) {
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ }
+
+ public boolean apply(AtomicReference<ZoneAndName> securityGroupInZoneRef) {
+ checkNotNull(securityGroupInZoneRef, "securityGroupRef");
+ final ZoneAndName securityGroupInZone = checkNotNull(securityGroupInZoneRef.get(), "securityGroupInZone");
+
+ Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone());
+ checkArgument(api.isPresent(), "Security groups are required, but the extension is not available!");
+
+ logger.trace("looking for security group %s", securityGroupInZone.slashEncode());
+ try {
+ SecurityGroup returnVal = Iterables.find(api.get().list(), new Predicate<SecurityGroup>() {
+
+ @Override
+ public boolean apply(SecurityGroup input) {
+ return input.getName().equals(securityGroupInZone.getName());
+ }
+
+ });
+ securityGroupInZoneRef.set(new SecurityGroupInZone(returnVal, securityGroupInZone.getZone()));
+ return true;
+ } catch (ResourceNotFoundException e) {
+ return false;
+ } catch (NoSuchElementException e) {
+ return false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
new file mode 100644
index 0000000..aa8cad7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
@@ -0,0 +1,55 @@
+/*
+ * 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.openstack.nova.v2_0.predicates;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.domain.Image.Status;
+
+import com.google.common.base.Predicate;
+
+/**
+ * Predicates handy when working with Images
+ *
+ * @author Adrian Cole
+ */
+
+public class ImagePredicates {
+
+ /**
+ * matches status of the given image
+ *
+ * @param status
+ * @return predicate that matches status
+ */
+ public static Predicate<Image> statusEquals(final Status status) {
+ checkNotNull(status, "status must be defined");
+
+ return new Predicate<Image>() {
+ @Override
+ public boolean apply(Image image) {
+ return status.equals(image.getStatus());
+ }
+
+ @Override
+ public String toString() {
+ return "statusEquals(" + status + ")";
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
new file mode 100644
index 0000000..ec511bb
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
@@ -0,0 +1,77 @@
+/*
+ * 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.openstack.nova.v2_0.predicates;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+
+import com.google.common.base.Predicate;
+
+/**
+ * Predicates handy when working with KeyPairs
+ *
+ * @author Adam Lowe
+ */
+
+public class KeyPairPredicates {
+
+
+ /**
+ * matches name of the given key pair
+ *
+ * @param name
+ * @return predicate that matches name
+ */
+ public static Predicate<KeyPair> nameMatches(final Predicate<String> name) {
+ checkNotNull(name, "name must be defined");
+
+ return new Predicate<KeyPair>() {
+ @Override
+ public boolean apply(KeyPair ext) {
+ return name.apply(ext.getName());
+ }
+
+ @Override
+ public String toString() {
+ return "nameMatches(" + name + ")";
+ }
+ };
+ }
+
+ /**
+ * matches name of the given keypair starts with the specified prefix
+ *
+ * @param name the prefix you are looking for
+ * @return the predicate
+ */
+ public static Predicate<KeyPair> nameEquals(final String name) {
+ checkNotNull(name, "name must be defined");
+
+ return new Predicate<KeyPair>() {
+ @Override
+ public boolean apply(KeyPair ext) {
+ return ext.getName() != null && ext.getName().equals(name);
+ }
+
+ @Override
+ public String toString() {
+ return "nameEquals(" + name + ")";
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
new file mode 100644
index 0000000..412e37f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
@@ -0,0 +1,213 @@
+/*
+ * 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.openstack.nova.v2_0.predicates;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Set;
+
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+/**
+ * Predicates handy when working with SecurityGroups
+ *
+ * @author Adrian Cole
+ */
+
+public class SecurityGroupPredicates {
+
+ /**
+ * matches name of the given security group
+ *
+ * @param name
+ * @return predicate that matches name
+ */
+ public static Predicate<SecurityGroup> nameEquals(final String name) {
+ checkNotNull(name, "name must be defined");
+
+ return new Predicate<SecurityGroup>() {
+ @Override
+ public boolean apply(SecurityGroup ext) {
+ return name.equals(ext.getName());
+ }
+
+ @Override
+ public String toString() {
+ return "nameEquals(" + name + ")";
+ }
+ };
+ }
+
+ /**
+ * matches name of the given security group against a list
+ *
+ * @param names
+ * @return predicate that matches one of the names
+ */
+ public static Predicate<SecurityGroup> nameIn(final Set<String> names) {
+ checkNotNull(names, "names must be defined");
+
+ return new Predicate<SecurityGroup>() {
+ @Override
+ public boolean apply(SecurityGroup ext) {
+ return Predicates.in(names).apply(ext.getName());
+ }
+
+ @Override
+ public String toString() {
+ return "nameIn(" + names + ")";
+ }
+ };
+ }
+
+ /**
+ * matches name of the given security group
+ *
+ * @param name
+ * @return predicate that matches name
+ */
+ public static Predicate<SecurityGroup> nameMatches(final Predicate<String> name) {
+ checkNotNull(name, "name must be defined");
+
+ return new Predicate<SecurityGroup>() {
+ @Override
+ public boolean apply(SecurityGroup ext) {
+ return name.apply(ext.getName());
+ }
+
+ @Override
+ public String toString() {
+ return "nameMatches(" + name + ")";
+ }
+ };
+ }
+
+ /**
+ * matches a security group rule by its cidr
+ *
+ * @param cidr
+ * @return predicate that matches cidr
+ */
+ public static Predicate<SecurityGroupRule> ruleCidr(final String cidr) {
+ checkNotNull(cidr, "cidr must be defined");
+
+ return new Predicate<SecurityGroupRule>() {
+ @Override
+ public boolean apply(SecurityGroupRule ext) {
+ return cidr.equals(ext.getIpRange());
+ }
+
+ @Override
+ public String toString() {
+ return "cidr(" + cidr + ")";
+ }
+ };
+ }
+
+ /**
+ * matches a security group rule by the security group it allows
+ *
+ * @param groupName
+ * @return predicate that matches group
+ */
+ public static Predicate<SecurityGroupRule> ruleGroup(final String groupName) {
+ checkNotNull(groupName, "groupName must be defined");
+
+ return new Predicate<SecurityGroupRule>() {
+ @Override
+ public boolean apply(SecurityGroupRule ext) {
+ return ext.getGroup() != null && groupName.equals(ext.getGroup().getName());
+ }
+
+ @Override
+ public String toString() {
+ return "ruleGroup(" + groupName + ")";
+ }
+ };
+ }
+
+ /**
+ * matches a security group rule by the protocol
+ *
+ * @param protocol
+ * @return predicate that matches protocol
+ */
+ public static Predicate<SecurityGroupRule> ruleProtocol(final IpProtocol protocol) {
+ checkNotNull(protocol, "protocol must be defined");
+
+ return new Predicate<SecurityGroupRule>() {
+ @Override
+ public boolean apply(SecurityGroupRule ext) {
+ return protocol.equals(ext.getIpProtocol());
+ }
+
+ @Override
+ public String toString() {
+ return "ruleProtocol(" + protocol + ")";
+ }
+ };
+ }
+
+ /**
+ * matches a security group rule by the start port
+ *
+ * @param startPort
+ * @return predicate that matches startPort
+ */
+ public static Predicate<SecurityGroupRule> ruleStartPort(final int startPort) {
+ checkNotNull(startPort, "startPort must be defined");
+
+ return new Predicate<SecurityGroupRule>() {
+ @Override
+ public boolean apply(SecurityGroupRule ext) {
+ return startPort == ext.getFromPort();
+ }
+
+ @Override
+ public String toString() {
+ return "ruleStartPort(" + startPort + ")";
+ }
+ };
+ }
+
+ /**
+ * matches a security group rule by the end port
+ *
+ * @param endPort
+ * @return predicate that matches endPort
+ */
+ public static Predicate<SecurityGroupRule> ruleEndPort(final int endPort) {
+ checkNotNull(endPort, "endPort must be defined");
+
+ return new Predicate<SecurityGroupRule>() {
+ @Override
+ public boolean apply(SecurityGroupRule ext) {
+ return endPort == ext.getToPort();
+ }
+
+ @Override
+ public String toString() {
+ return "ruleEndPort(" + endPort + ")";
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
new file mode 100644
index 0000000..67c3d34
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
@@ -0,0 +1 @@
+org.jclouds.openstack.nova.v2_0.NovaApiMetadata
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
new file mode 100644
index 0000000..9e6c46b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ *
+ * @see KeystoneProperties#CREDENTIAL_TYPE
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest")
+public class AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest extends BaseNovaApiExpectTest {
+ public AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest() {
+ identity = identityWithTenantId;
+ }
+
+ /**
+ * this reflects the properties that a user would pass to createContext
+ */
+ @Override
+ protected Properties setupProperties() {
+ Properties contextProperties = super.setupProperties();
+ contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
+ contextProperties.setProperty("jclouds.keystone.tenant-id", KeystoneFixture.INSTANCE.getTenantId());
+ return contextProperties;
+ }
+
+ public void testListServersWhenResponseIs2xx() throws Exception {
+ HttpRequest listServers = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_list.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantId,
+ responseWithKeystoneAccess, listServers, listServersResponse);
+
+ assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+ new ParseServerListTest().expected().toString());
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java
new file mode 100644
index 0000000..740c5e8
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ *
+ * @see KeystoneProperties#CREDENTIAL_TYPE
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest")
+public class AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest extends BaseNovaApiExpectTest {
+ public AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest() {
+ identity = "identity";
+ }
+
+ /**
+ * this reflects the properties that a user would pass to createContext
+ */
+ @Override
+ protected Properties setupProperties() {
+ Properties contextProperties = super.setupProperties();
+ contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
+ contextProperties.setProperty("jclouds.keystone.tenant-name", KeystoneFixture.INSTANCE.getTenantName());
+ return contextProperties;
+ }
+
+ public void testListServersWhenResponseIs2xx() throws Exception {
+ HttpRequest listServers = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_list.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
+ responseWithKeystoneAccess, listServers, listServersResponse);
+
+ assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+ new ParseServerListTest().expected().toString());
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAuthenticationExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAuthenticationExpectTest.java
new file mode 100644
index 0000000..0784a7b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAuthenticationExpectTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ *
+ * @see KeystoneProperties#CREDENTIAL_TYPE
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAuthenticationExpectTest")
+public class AccessKeyAndSecretKeyAuthenticationExpectTest extends BaseNovaApiExpectTest {
+
+ /**
+ * this reflects the properties that a user would pass to createContext
+ */
+ @Override
+ protected Properties setupProperties() {
+ Properties contextProperties = super.setupProperties();
+ contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
+ return contextProperties;
+ }
+
+ public void testListServersWhenResponseIs2xx() throws Exception {
+ HttpRequest listServers = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_list.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
+ responseWithKeystoneAccess, listServers, listServersResponse);
+
+ assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+ new ParseServerListTest().expected().toString());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/EndpointIdIsRandomExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/EndpointIdIsRandomExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/EndpointIdIsRandomExpectTest.java
new file mode 100644
index 0000000..a158875
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/EndpointIdIsRandomExpectTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import static org.jclouds.Constants.PROPERTY_ENDPOINT;
+import static org.testng.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests to ensure that we can pick the only endpoint of a service
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "EndpointIdIsRandomExpectTest")
+public class EndpointIdIsRandomExpectTest extends BaseNovaApiExpectTest {
+
+ public EndpointIdIsRandomExpectTest() {
+ this.identity = "demo:demo";
+ this.credential = "password";
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties overrides = super.setupProperties();
+ overrides.setProperty(PROPERTY_ENDPOINT, "http://10.10.10.10:5000/v2.0/");
+ return overrides;
+ }
+
+ public void testVersionMatchOnConfiguredZonesWhenResponseIs2xx() {
+
+ HttpRequest authenticate = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("http://10.10.10.10:5000/v2.0/tokens")
+ .addHeader("Accept", "application/json")
+ .payload(
+ payloadFromStringWithContentType(
+ "{\"auth\":{\"passwordCredentials\":{\"username\":\"demo\",\"password\":\"password\"},\"tenantName\":\"demo\"}}",
+ "application/json")).build();
+
+ HttpResponse authenticationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResourceWithContentType("/access_version_uids.json", "application/json")).build();
+
+ NovaApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
+
+ assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("RegionOne"));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadataTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadataTest.java
new file mode 100644
index 0000000..fbca404
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadataTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "NovaApiMetadataTest")
+public class NovaApiMetadataTest extends BaseComputeServiceApiMetadataTest {
+
+ public NovaApiMetadataTest() {
+ super(new NovaApiMetadata());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationExpectTest.java
new file mode 100644
index 0000000..ad7bf9a
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/PasswordAuthenticationExpectTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.openstack.nova.v2_0;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ *
+ * @see KeystoneProperties#CREDENTIAL_TYPE
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "PasswordAuthenticationExpectTest")
+public class PasswordAuthenticationExpectTest extends BaseNovaApiExpectTest {
+ public PasswordAuthenticationExpectTest() {
+ identity = "identity";
+ }
+
+ public void testListServersWhenResponseIs2xx() throws Exception {
+ HttpRequest listServers = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/server_list.json")).build();
+
+ NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
+ responseWithKeystoneAccess, listServers, listServersResponse);
+
+ assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+ new ParseServerListTest().expected().toString());
+ }
+
+}
[51/52] [partial] git commit: Moving jclouds dependencies to accurate
parent directories
Posted by la...@apache.org.
Moving jclouds dependencies to accurate parent directories
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/19c8cdaf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/19c8cdaf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/19c8cdaf
Branch: refs/heads/master
Commit: 19c8cdafe5780663c54bfbe8597449bfb29d1098
Parents: f6330b3
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Sun Mar 30 23:55:55 2014 -0700
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Sun Mar 30 23:55:55 2014 -0700
----------------------------------------------------------------------
.../openstack-nova/1.7.1-stratos/README.txt | 3 +
.../apis/openstack-nova/1.7.1-stratos/pom.xml | 143 +++
.../jclouds/openstack/nova/v2_0/NovaApi.java | 208 +++++
.../openstack/nova/v2_0/NovaApiMetadata.java | 125 +++
.../openstack/nova/v2_0/NovaAsyncApi.java | 214 +++++
.../v2_0/binders/BindKeyPairToJsonPayload.java | 47 +
.../v2_0/binders/BindMetadataToJsonPayload.java | 47 +
.../BindSecurityGroupRuleToJsonPayload.java | 71 ++
.../nova/v2_0/compute/NovaComputeService.java | 183 ++++
.../v2_0/compute/NovaComputeServiceAdapter.java | 288 ++++++
.../config/NovaComputeServiceContextModule.java | 286 ++++++
.../compute/extensions/NovaImageExtension.java | 140 +++
.../extensions/NovaSecurityGroupExtension.java | 373 ++++++++
.../AllocateAndAddFloatingIpToNode.java | 112 +++
.../functions/CreateSecurityGroupIfNeeded.java | 93 ++
.../functions/FlavorInZoneToHardware.java | 60 ++
.../compute/functions/ImageInZoneToImage.java | 70 ++
.../functions/ImageToOperatingSystem.java | 128 +++
.../NovaSecurityGroupInZoneToSecurityGroup.java | 75 ++
.../NovaSecurityGroupToSecurityGroup.java | 69 ++
.../functions/OrphanedGroupsByZoneId.java | 77 ++
.../RemoveFloatingIpFromNodeAndDeallocate.java | 74 ++
.../SecurityGroupRuleToIpPermission.java | 99 ++
.../functions/ServerInZoneToNodeMetadata.java | 199 ++++
.../compute/loaders/CreateUniqueKeyPair.java | 79 ++
.../loaders/FindSecurityGroupOrCreate.java | 86 ++
.../loaders/LoadFloatingIpsForInstance.java | 63 ++
.../compute/options/NovaTemplateOptions.java | 649 +++++++++++++
.../predicates/AllNodesInGroupTerminated.java | 56 ++
...desWithGroupEncodedIntoNameThenAddToSet.java | 165 ++++
.../nova/v2_0/config/NovaParserModule.java | 159 ++++
.../nova/v2_0/config/NovaProperties.java | 43 +
.../nova/v2_0/config/NovaRestClientModule.java | 191 ++++
.../openstack/nova/v2_0/domain/Address.java | 138 +++
.../openstack/nova/v2_0/domain/BackupType.java | 41 +
.../openstack/nova/v2_0/domain/Flavor.java | 211 +++++
.../openstack/nova/v2_0/domain/FloatingIP.java | 173 ++++
.../openstack/nova/v2_0/domain/Host.java | 127 +++
.../nova/v2_0/domain/HostAggregate.java | 250 +++++
.../nova/v2_0/domain/HostResourceUsage.java | 180 ++++
.../openstack/nova/v2_0/domain/Image.java | 303 +++++++
.../openstack/nova/v2_0/domain/Ingress.java | 160 ++++
.../openstack/nova/v2_0/domain/KeyPair.java | 189 ++++
.../openstack/nova/v2_0/domain/Network.java | 173 ++++
.../openstack/nova/v2_0/domain/Quota.java | 356 ++++++++
.../openstack/nova/v2_0/domain/QuotaClass.java | 62 ++
.../openstack/nova/v2_0/domain/RebootType.java | 35 +
.../nova/v2_0/domain/SecurityGroup.java | 188 ++++
.../nova/v2_0/domain/SecurityGroupRule.java | 174 ++++
.../openstack/nova/v2_0/domain/Server.java | 476 ++++++++++
.../nova/v2_0/domain/ServerCreated.java | 127 +++
.../v2_0/domain/ServerExtendedAttributes.java | 156 ++++
.../nova/v2_0/domain/ServerExtendedStatus.java | 155 ++++
.../v2_0/domain/ServerWithSecurityGroups.java | 128 +++
.../nova/v2_0/domain/SimpleServerUsage.java | 312 +++++++
.../nova/v2_0/domain/SimpleTenantUsage.java | 245 +++++
.../nova/v2_0/domain/TenantIdAndName.java | 127 +++
.../nova/v2_0/domain/VirtualInterface.java | 128 +++
.../openstack/nova/v2_0/domain/Volume.java | 346 +++++++
.../nova/v2_0/domain/VolumeAttachment.java | 172 ++++
.../nova/v2_0/domain/VolumeSnapshot.java | 239 +++++
.../openstack/nova/v2_0/domain/VolumeType.java | 192 ++++
.../domain/zonescoped/AvailabilityZone.java | 73 ++
.../v2_0/domain/zonescoped/FlavorInZone.java | 46 +
.../v2_0/domain/zonescoped/ImageInZone.java | 46 +
.../domain/zonescoped/SecurityGroupInZone.java | 46 +
.../v2_0/domain/zonescoped/ServerInZone.java | 46 +
.../nova/v2_0/domain/zonescoped/ZoneAndId.java | 86 ++
.../v2_0/domain/zonescoped/ZoneAndName.java | 111 +++
.../ZoneSecurityGroupNameAndPorts.java | 62 ++
.../nova/v2_0/domain/zonescoped/ZoneState.java | 61 ++
.../v2_0/extensions/AvailabilityZoneAPI.java | 40 +
.../extensions/AvailabilityZoneAsyncApi.java | 58 ++
.../v2_0/extensions/ExtensionNamespaces.java | 110 +++
.../v2_0/extensions/FlavorExtraSpecsApi.java | 77 ++
.../extensions/FlavorExtraSpecsAsyncApi.java | 118 +++
.../nova/v2_0/extensions/FloatingIPApi.java | 98 ++
.../v2_0/extensions/FloatingIPAsyncApi.java | 145 +++
.../v2_0/extensions/HostAdministrationApi.java | 103 +++
.../extensions/HostAdministrationAsyncApi.java | 157 ++++
.../nova/v2_0/extensions/HostAggregateApi.java | 87 ++
.../v2_0/extensions/HostAggregateAsyncApi.java | 161 ++++
.../nova/v2_0/extensions/KeyPairApi.java | 65 ++
.../nova/v2_0/extensions/KeyPairAsyncApi.java | 101 +++
.../nova/v2_0/extensions/QuotaApi.java | 57 ++
.../nova/v2_0/extensions/QuotaAsyncApi.java | 89 ++
.../nova/v2_0/extensions/QuotaClassApi.java | 51 ++
.../v2_0/extensions/QuotaClassAsyncApi.java | 78 ++
.../nova/v2_0/extensions/SecurityGroupApi.java | 89 ++
.../v2_0/extensions/SecurityGroupAsyncApi.java | 152 ++++
.../nova/v2_0/extensions/ServerAdminApi.java | 120 +++
.../v2_0/extensions/ServerAdminAsyncApi.java | 175 ++++
.../extensions/ServerWithSecurityGroupsApi.java | 49 +
.../ServerWithSecurityGroupsAsyncApi.java | 62 ++
.../v2_0/extensions/SimpleTenantUsageApi.java | 50 +
.../extensions/SimpleTenantUsageAsyncApi.java | 77 ++
.../v2_0/extensions/VirtualInterfaceApi.java | 43 +
.../extensions/VirtualInterfaceAsyncApi.java | 59 ++
.../nova/v2_0/extensions/VolumeApi.java | 147 +++
.../nova/v2_0/extensions/VolumeAsyncApi.java | 254 ++++++
.../v2_0/extensions/VolumeAttachmentApi.java | 87 ++
.../extensions/VolumeAttachmentAsyncApi.java | 107 +++
.../nova/v2_0/extensions/VolumeTypeApi.java | 101 +++
.../v2_0/extensions/VolumeTypeAsyncApi.java | 161 ++++
.../openstack/nova/v2_0/features/FlavorApi.java | 78 ++
.../nova/v2_0/features/FlavorAsyncApi.java | 144 +++
.../openstack/nova/v2_0/features/ImageApi.java | 142 +++
.../nova/v2_0/features/ImageAsyncApi.java | 206 +++++
.../openstack/nova/v2_0/features/ServerApi.java | 276 ++++++
.../nova/v2_0/features/ServerAsyncApi.java | 356 ++++++++
.../functions/FieldValueResponseParsers.java | 105 +++
.../nova/v2_0/functions/OverLimitParser.java | 92 ++
.../ParseImageIdFromLocationHeader.java | 39 +
.../internal/OnlyMetadataValueOrNull.java | 63 ++
.../functions/internal/ParseDiagnostics.java | 47 +
.../functions/internal/ParseFlavorDetails.java | 94 ++
.../v2_0/functions/internal/ParseFlavors.java | 96 ++
.../functions/internal/ParseImageDetails.java | 95 ++
.../v2_0/functions/internal/ParseImages.java | 96 ++
.../v2_0/functions/internal/ParseKeyPairs.java | 64 ++
.../functions/internal/ParseServerDetails.java | 94 ++
.../v2_0/functions/internal/ParseServers.java | 96 ++
.../nova/v2_0/handlers/NovaErrorHandler.java | 129 +++
.../options/CreateBackupOfServerOptions.java | 105 +++
.../nova/v2_0/options/CreateServerOptions.java | 557 ++++++++++++
.../nova/v2_0/options/CreateVolumeOptions.java | 220 +++++
.../options/CreateVolumeSnapshotOptions.java | 138 +++
.../v2_0/options/CreateVolumeTypeOptions.java | 101 +++
.../nova/v2_0/options/ListOptions.java | 107 +++
.../nova/v2_0/options/RebuildServerOptions.java | 142 +++
.../FindSecurityGroupWithNameAndReturnTrue.java | 84 ++
.../nova/v2_0/predicates/ImagePredicates.java | 55 ++
.../nova/v2_0/predicates/KeyPairPredicates.java | 77 ++
.../predicates/SecurityGroupPredicates.java | 213 +++++
.../services/org.jclouds.apis.ApiMetadata | 1 +
...tKeyAndTenantIdAuthenticationExpectTest.java | 75 ++
...antNamePropertyAuthenticationExpectTest.java | 75 ++
...KeyAndSecretKeyAuthenticationExpectTest.java | 69 ++
.../nova/v2_0/EndpointIdIsRandomExpectTest.java | 72 ++
.../nova/v2_0/NovaApiMetadataTest.java | 32 +
.../v2_0/PasswordAuthenticationExpectTest.java | 60 ++
...dAuthenticationWithTenantNameExpectTest.java | 69 ++
.../NovaComputeServiceAdapterExpectTest.java | 321 +++++++
.../compute/NovaComputeServiceExpectTest.java | 382 ++++++++
.../compute/NovaComputeServiceLiveTest.java | 96 ++
.../NovaImageExtensionExpectTest.java | 92 ++
.../extensions/NovaImageExtensionLiveTest.java | 43 +
.../NovaSecurityGroupExtensionExpectTest.java | 433 +++++++++
.../NovaSecurityGroupExtensionLiveTest.java | 35 +
...llocateAndAddFloatingIpToNodeExpectTest.java | 133 +++
.../functions/FlavorInZoneToHardwareTest.java | 90 ++
.../functions/ImageInZoneToImageTest.java | 95 ++
.../functions/ImageToOperatingSystemTest.java | 192 ++++
...aSecurityGroupInZoneToSecurityGroupTest.java | 94 ++
.../NovaSecurityGroupToSecurityGroupTest.java | 155 ++++
.../functions/OrphanedGroupsByZoneIdTest.java | 96 ++
.../SecurityGroupRuleToIpPermissionTest.java | 81 ++
.../ServerInZoneToNodeMetadataTest.java | 311 +++++++
.../loaders/CreateUniqueKeyPairTest.java | 111 +++
.../loaders/FindSecurityGroupOrCreateTest.java | 144 +++
.../loaders/LoadFloatingIpsForInstanceTest.java | 108 +++
.../options/NovaTemplateOptionsTest.java | 263 ++++++
.../extensions/AdminActionsApiExpectTest.java | 350 +++++++
.../extensions/AdminActionsApiLiveTest.java | 195 ++++
.../AvailabilityZoneApiExpectTest.java | 64 ++
.../AvailabilityZonesApiLiveTest.java | 45 +
.../FlavorExtraSpecsApiExpectTest.java | 142 +++
.../extensions/FlavorExtraSpecsApiLiveTest.java | 123 +++
.../extensions/FloatingIPApiExpectTest.java | 191 ++++
.../v2_0/extensions/FloatingIPApiLiveTest.java | 171 ++++
.../HostAdministrationApiExpectTest.java | 241 +++++
.../HostAdministrationApiLiveTest.java | 116 +++
.../extensions/HostAggregateApiExpectTest.java | 179 ++++
.../extensions/HostAggregateApiLiveTest.java | 148 +++
.../v2_0/extensions/KeyPairApiExpectTest.java | 142 +++
.../v2_0/extensions/KeyPairApiLiveTest.java | 76 ++
.../v2_0/extensions/QuotaApiExpectTest.java | 125 +++
.../nova/v2_0/extensions/QuotaApiLiveTest.java | 100 ++
.../extensions/QuotaClassApiExpectTest.java | 105 +++
.../v2_0/extensions/QuotaClassApiLiveTest.java | 73 ++
.../extensions/SecurityGroupApiExpectTest.java | 235 +++++
.../extensions/SecurityGroupApiLiveTest.java | 100 ++
.../ServerWithSecurityGroupsApiExpectTest.java | 63 ++
.../ServerWithSecurityGroupsApiLiveTest.java | 80 ++
.../SimpleTenantUsageApiExpectTest.java | 99 ++
.../SimpleTenantUsageApiLiveTest.java | 51 ++
.../VirtualInterfaceApiExpectTest.java | 64 ++
.../extensions/VirtualInterfaceApiLiveTest.java | 68 ++
.../v2_0/extensions/VolumeApiExpectTest.java | 460 ++++++++++
.../nova/v2_0/extensions/VolumeApiLiveTest.java | 274 ++++++
.../VolumeAttachmentApiExpectTest.java | 168 ++++
.../extensions/VolumeAttachmentApiLiveTest.java | 156 ++++
.../extensions/VolumeTypeApiExpectTest.java | 259 ++++++
.../v2_0/extensions/VolumeTypeApiLiveTest.java | 126 +++
.../v2_0/features/ExtensionApiExpectTest.java | 115 +++
.../v2_0/features/ExtensionApiLiveTest.java | 84 ++
.../nova/v2_0/features/FlavorApiExpectTest.java | 164 ++++
.../nova/v2_0/features/FlavorApiLiveTest.java | 105 +++
.../nova/v2_0/features/ImageApiExpectTest.java | 377 ++++++++
.../nova/v2_0/features/ImageApiLiveTest.java | 101 +++
.../nova/v2_0/features/ServerApiExpectTest.java | 746 +++++++++++++++
.../nova/v2_0/features/ServerApiLiveTest.java | 206 +++++
.../CreateSecurityGroupIfNeededTest.java | 168 ++++
...ityGroupWithNameAndReturnTrueExpectTest.java | 102 +++
.../v2_0/functions/InternalURLLiveTest.java | 64 ++
.../v2_0/handlers/NovaErrorHandlerTest.java | 225 +++++
.../v2_0/internal/BaseNovaApiExpectTest.java | 28 +
.../nova/v2_0/internal/BaseNovaApiLiveTest.java | 120 +++
...BaseNovaComputeServiceContextExpectTest.java | 87 ++
.../BaseNovaComputeServiceExpectTest.java | 35 +
.../nova/v2_0/internal/BaseNovaExpectTest.java | 84 ++
...eComputeServiceTypicalSecurityGroupTest.java | 76 ++
.../nova/v2_0/parse/ParseCreateFlavorTest.java | 58 ++
.../nova/v2_0/parse/ParseCreatedServerTest.java | 80 ++
.../parse/ParseExtensionListNormalTest.java | 76 ++
.../nova/v2_0/parse/ParseExtensionListTest.java | 88 ++
.../nova/v2_0/parse/ParseExtensionTest.java | 71 ++
.../nova/v2_0/parse/ParseFlavorListTest.java | 85 ++
.../nova/v2_0/parse/ParseFlavorTest.java | 70 ++
.../v2_0/parse/ParseFloatingIPListTest.java | 59 ++
.../nova/v2_0/parse/ParseFloatingIPTest.java | 53 ++
.../nova/v2_0/parse/ParseImageListTest.java | 85 ++
.../nova/v2_0/parse/ParseImageTest.java | 98 ++
.../nova/v2_0/parse/ParseKeyPairListTest.java | 68 ++
.../nova/v2_0/parse/ParseKeyPairTest.java | 61 ++
.../nova/v2_0/parse/ParseMetadataItemTest.java | 58 ++
.../nova/v2_0/parse/ParseMetadataListTest.java | 63 ++
.../v2_0/parse/ParseMetadataUpdateTest.java | 64 ++
.../v2_0/parse/ParseSecurityGroupListTest.java | 72 ++
.../nova/v2_0/parse/ParseSecurityGroupTest.java | 69 ++
.../v2_0/parse/ParseServerDetailsEssexTest.java | 170 ++++
.../nova/v2_0/parse/ParseServerDiagnostics.java | 57 ++
.../nova/v2_0/parse/ParseServerListTest.java | 85 ++
.../nova/v2_0/parse/ParseServerTest.java | 117 +++
.../parse/ParseServerWithAllExtensionsTest.java | 104 +++
.../ParseServerWithInternetAddressesTest.java | 99 ++
...ublicIpsInPrivateAddressBlockExpectTest.java | 99 ++
.../v2_0/predicates/ImagePredicatesTest.java | 44 +
.../predicates/SecurityGroupPredicatesTest.java | 129 +++
.../src/test/resources/attachment_details.json | 1 +
.../src/test/resources/attachment_list.json | 1 +
.../src/test/resources/extension_details.json | 21 +
.../src/test/resources/extension_list.json | 42 +
.../src/test/resources/extension_list_full.json | 281 ++++++
.../test/resources/extension_list_normal.json | 31 +
.../resources/extension_list_openstack.json | 115 +++
.../src/test/resources/flavor_details.json | 19 +
.../src/test/resources/flavor_list.json | 32 +
.../src/test/resources/flavor_list_detail.json | 1 +
.../resources/flavor_list_detail_openstack.json | 83 ++
.../src/test/resources/flavor_new.json | 10 +
.../src/test/resources/floatingip_details.json | 9 +
.../src/test/resources/floatingip_list.json | 16 +
.../1.7.1-stratos/src/test/resources/host.json | 1 +
.../test/resources/host_aggregate_details.json | 1 +
.../src/test/resources/host_aggregate_list.json | 1 +
.../host_aggregate_with_host_details.json | 1 +
.../src/test/resources/hosts_list.json | 1 +
.../src/test/resources/image_active.json | 41 +
.../src/test/resources/image_details.json | 41 +
.../src/test/resources/image_list.json | 32 +
.../src/test/resources/image_list_detail.json | 1 +
.../image_list_detail_imageextension.json | 121 +++
.../resources/image_list_detail_openstack.json | 81 ++
.../src/test/resources/keypair_created.json | 9 +
.../keypair_created_computeservice.json | 9 +
.../src/test/resources/keypair_list.json | 18 +
.../test/resources/listAvailabilityZones.json | 11 +
.../src/test/resources/metadata_item.json | 5 +
.../src/test/resources/metadata_list.json | 6 +
.../src/test/resources/metadata_updated.json | 7 +
.../src/test/resources/new_server.json | 41 +
.../resources/new_server_disk_config_auto.json | 42 +
.../new_server_disk_config_manual.json | 42 +
.../src/test/resources/new_server_in_zone.json | 41 +
.../resources/new_server_networks_response.json | 42 +
.../test/resources/new_server_no_adminpass.json | 40 +
.../resources/new_server_nova_networks.json | 41 +
.../src/test/resources/quota_class.json | 15 +
.../src/test/resources/quotas.json | 15 +
.../test/resources/securitygroup_created.json | 9 +
.../test/resources/securitygroup_details.json | 34 +
...itygroup_details_computeservice_typical.json | 51 ++
.../securitygroup_details_extension.json | 34 +
...securitygroup_details_extension_norules.json | 10 +
.../resources/securitygroup_details_port22.json | 19 +
.../src/test/resources/securitygroup_list.json | 51 ++
...oup_list_details_computeservice_typical.json | 53 ++
.../resources/securitygroup_list_extension.json | 51 ++
.../resources/securitygrouprule_created.json | 12 +
.../securitygrouprule_created_cidr.json | 13 +
.../securitygrouprule_created_group.json | 14 +
.../src/test/resources/server_details.json | 86 ++
.../test/resources/server_details_devstack.json | 44 +
.../resources/server_details_openstack.json | 46 +
.../src/test/resources/server_diagnostics.json | 17 +
.../src/test/resources/server_list.json | 32 +
.../src/test/resources/server_list_details.json | 79 ++
.../resources/server_list_details_essex.json | 152 ++++
.../resources/server_public_ip_in_private.json | 51 ++
.../resources/server_with_security_groups.json | 1 +
.../server_with_security_groups_extension.json | 1 +
.../src/test/resources/simple_tenant_usage.json | 1 +
.../test/resources/simple_tenant_usages.json | 1 +
.../src/test/resources/snapshot_details.json | 1 +
.../src/test/resources/snapshot_list.json | 1 +
.../test/resources/snapshot_list_detail.json | 1 +
.../test/resources/virtual_interfaces_list.json | 1 +
.../src/test/resources/volume_details.json | 1 +
.../src/test/resources/volume_list.json | 1 +
.../src/test/resources/volume_list_detail.json | 1 +
.../src/test/resources/volume_type.json | 9 +
.../test/resources/volume_type_extra_specs.json | 1 +
.../src/test/resources/volume_type_list.json | 1 +
.../apis/vcloud/1.7.1-stratos/README.txt | 6 +
.../jclouds/apis/vcloud/1.7.1-stratos/pom.xml | 129 +++
.../vcloud/TaskInErrorStateException.java | 39 +
.../vcloud/TaskStillRunningException.java | 39 +
.../main/java/org/jclouds/vcloud/VCloudApi.java | 91 ++
.../org/jclouds/vcloud/VCloudApiMetadata.java | 103 +++
.../org/jclouds/vcloud/VCloudMediaType.java | 221 +++++
.../jclouds/vcloud/VCloudResponseException.java | 69 ++
.../java/org/jclouds/vcloud/VCloudToken.java | 37 +
.../org/jclouds/vcloud/VCloudVersionsApi.java | 38 +
.../binders/BindCPUCountToXmlPayload.java | 79 ++
.../BindCaptureVAppParamsToXmlPayload.java | 124 +++
.../binders/BindCatalogItemToXmlPayload.java | 126 +++
.../binders/BindCloneParamsToXmlPayload.java | 133 +++
.../BindCloneVAppParamsToXmlPayload.java | 65 ++
...BindCloneVAppTemplateParamsToXmlPayload.java | 60 ++
.../BindDeployVAppParamsToXmlPayload.java | 42 +
...ndGuestCustomizationSectionToXmlPayload.java | 112 +++
...stantiateVAppTemplateParamsToXmlPayload.java | 221 +++++
.../vcloud/binders/BindMemoryToXmlPayload.java | 80 ++
...indNetworkConnectionSectionToXmlPayload.java | 106 +++
.../vcloud/binders/BindParamsToXmlPayload.java | 81 ++
.../BindUndeployVAppParamsToXmlPayload.java | 42 +
.../OrgNameAndCatalogNameToEndpoint.java | 79 ++
.../binders/OrgNameAndVDCNameToEndpoint.java | 78 ++
.../OrgNameCatalogNameItemNameToEndpoint.java | 77 ++
...meCatalogNameVAppTemplateNameToEndpoint.java | 90 ++
.../OrgNameVDCNameNetworkNameToEndpoint.java | 54 ++
...NameVDCNameResourceEntityNameToEndpoint.java | 54 ++
.../OrgNameVDCNameResourceNameToEndpoint.java | 81 ++
.../VCloudComputeServiceContextModule.java | 39 +
.../VCloudComputeServiceDependenciesModule.java | 154 ++++
.../functions/FindLocationForResource.java | 69 ++
.../compute/functions/HardwareForVApp.java | 71 ++
.../functions/HardwareForVAppTemplate.java | 84 ++
.../compute/functions/ImageForVAppTemplate.java | 82 ++
.../compute/functions/VAppToNodeMetadata.java | 112 +++
...dHardwareBuilderFromResourceAllocations.java | 43 +
...EnvelopeOrThrowIllegalArgumentException.java | 77 ++
.../internal/VCloudTemplateBuilderImpl.java | 48 +
.../compute/options/VCloudTemplateOptions.java | 350 +++++++
...edIntoNameThenCustomizeDeployAndPowerOn.java | 302 +++++++
...etworkConfigurationForNetworkAndOptions.java | 80 ++
.../strategy/VCloudComputeServiceAdapter.java | 263 ++++++
.../vcloud/compute/util/VCloudComputeUtils.java | 116 +++
.../vcloud/config/DefaultCatalogForOrg.java | 63 ++
.../vcloud/config/DefaultNetworkForVDC.java | 65 ++
.../vcloud/config/DefaultOrgForUser.java | 58 ++
.../vcloud/config/DefaultTasksListForOrg.java | 53 ++
.../config/DefaultVCloudReferencesModule.java | 165 ++++
.../jclouds/vcloud/config/DefaultVDCForOrg.java | 63 ++
.../vcloud/config/VCloudHttpApiModule.java | 538 +++++++++++
.../jclouds/vcloud/domain/AllocationModel.java | 70 ++
.../org/jclouds/vcloud/domain/Capacity.java | 108 +++
.../java/org/jclouds/vcloud/domain/Catalog.java | 69 ++
.../org/jclouds/vcloud/domain/CatalogItem.java | 37 +
.../domain/GuestCustomizationSection.java | 440 +++++++++
.../domain/InstantiateVAppTemplateParams.java | 96 ++
.../vcloud/domain/NetworkConnection.java | 233 +++++
.../vcloud/domain/NetworkConnectionSection.java | 218 +++++
.../java/org/jclouds/vcloud/domain/Org.java | 86 ++
.../jclouds/vcloud/domain/ReferenceType.java | 55 ++
.../java/org/jclouds/vcloud/domain/Status.java | 246 +++++
.../java/org/jclouds/vcloud/domain/Task.java | 72 ++
.../org/jclouds/vcloud/domain/TaskStatus.java | 71 ++
.../org/jclouds/vcloud/domain/TasksList.java | 37 +
.../java/org/jclouds/vcloud/domain/VApp.java | 87 ++
.../org/jclouds/vcloud/domain/VAppTemplate.java | 97 ++
.../org/jclouds/vcloud/domain/VCloudError.java | 123 +++
.../jclouds/vcloud/domain/VCloudSession.java | 29 +
.../java/org/jclouds/vcloud/domain/VDC.java | 146 +++
.../org/jclouds/vcloud/domain/VDCStatus.java | 57 ++
.../main/java/org/jclouds/vcloud/domain/Vm.java | 108 +++
.../vcloud/domain/internal/CatalogImpl.java | 193 ++++
.../vcloud/domain/internal/CatalogItemImpl.java | 111 +++
.../vcloud/domain/internal/ErrorImpl.java | 119 +++
.../jclouds/vcloud/domain/internal/OrgImpl.java | 171 ++++
.../domain/internal/ReferenceTypeImpl.java | 103 +++
.../vcloud/domain/internal/TaskImpl.java | 165 ++++
.../vcloud/domain/internal/TasksListImpl.java | 81 ++
.../vcloud/domain/internal/VAppImpl.java | 166 ++++
.../domain/internal/VAppTemplateImpl.java | 205 +++++
.../jclouds/vcloud/domain/internal/VDCImpl.java | 292 ++++++
.../jclouds/vcloud/domain/internal/VmImpl.java | 217 +++++
.../vcloud/domain/network/DhcpService.java | 106 +++
.../jclouds/vcloud/domain/network/Features.java | 95 ++
.../vcloud/domain/network/FenceMode.java | 70 ++
.../vcloud/domain/network/FirewallService.java | 86 ++
.../domain/network/IpAddressAllocationMode.java | 52 ++
.../jclouds/vcloud/domain/network/IpRange.java | 76 ++
.../jclouds/vcloud/domain/network/IpScope.java | 170 ++++
.../vcloud/domain/network/NatService.java | 115 +++
.../vcloud/domain/network/NetworkConfig.java | 167 ++++
.../vcloud/domain/network/OrgNetwork.java | 121 +++
.../domain/network/firewall/FirewallPolicy.java | 54 ++
.../network/firewall/FirewallProtocols.java | 73 ++
.../domain/network/firewall/FirewallRule.java | 125 +++
.../domain/network/internal/OrgNetworkImpl.java | 202 +++++
.../vcloud/domain/network/nat/NatPolicy.java | 54 ++
.../vcloud/domain/network/nat/NatProtocol.java | 48 +
.../vcloud/domain/network/nat/NatRule.java | 35 +
.../vcloud/domain/network/nat/NatType.java | 61 ++
.../domain/network/nat/rules/MappingMode.java | 54 ++
.../network/nat/rules/OneToOneVmRule.java | 110 +++
.../network/nat/rules/PortForwardingRule.java | 111 +++
.../vcloud/domain/network/nat/rules/VmRule.java | 128 +++
.../EditableResourceAllocationSettingData.java | 302 +++++++
.../vcloud/domain/ovf/VCloudHardDisk.java | 330 +++++++
.../vcloud/domain/ovf/VCloudNetworkAdapter.java | 332 +++++++
.../vcloud/domain/ovf/VCloudNetworkSection.java | 80 ++
.../ovf/VCloudOperatingSystemSection.java | 118 +++
.../ovf/VCloudVirtualHardwareSection.java | 179 ++++
.../org/jclouds/vcloud/endpoints/Catalog.java | 37 +
.../org/jclouds/vcloud/endpoints/Network.java | 37 +
.../java/org/jclouds/vcloud/endpoints/Org.java | 37 +
.../org/jclouds/vcloud/endpoints/OrgList.java | 37 +
.../org/jclouds/vcloud/endpoints/TasksList.java | 37 +
.../jclouds/vcloud/endpoints/VCloudLogin.java | 38 +
.../java/org/jclouds/vcloud/endpoints/VDC.java | 37 +
.../org/jclouds/vcloud/features/CatalogApi.java | 144 +++
.../org/jclouds/vcloud/features/NetworkApi.java | 61 ++
.../org/jclouds/vcloud/features/OrgApi.java | 86 ++
.../org/jclouds/vcloud/features/TaskApi.java | 82 ++
.../org/jclouds/vcloud/features/VAppApi.java | 261 ++++++
.../vcloud/features/VAppTemplateApi.java | 180 ++++
.../org/jclouds/vcloud/features/VDCApi.java | 73 ++
.../java/org/jclouds/vcloud/features/VmApi.java | 295 ++++++
...ddVCloudAuthorizationAndCookieToRequest.java | 63 ++
.../vcloud/functions/CatalogItemsInCatalog.java | 64 ++
.../vcloud/functions/CatalogItemsInOrg.java | 57 ++
.../jclouds/vcloud/functions/CatalogsInOrg.java | 73 ++
.../functions/DefaultNetworkNameInTemplate.java | 47 +
.../jclouds/vcloud/functions/NetworksInOrg.java | 57 ++
.../vcloud/functions/OrgNameToEndpoint.java | 57 ++
.../functions/OrgNameToTasksListEndpoint.java | 62 ++
.../vcloud/functions/OrgsForLocations.java | 73 ++
.../jclouds/vcloud/functions/OrgsForNames.java | 56 ++
.../ParseLoginResponseFromHeaders.java | 105 +++
.../functions/VAppTemplatesForCatalogItems.java | 66 ++
.../vcloud/functions/VAppTemplatesInOrg.java | 65 ++
.../org/jclouds/vcloud/functions/VDCsInOrg.java | 57 ++
.../ParseVCloudErrorFromHttpResponse.java | 121 +++
.../http/filters/VCloudBasicAuthentication.java | 58 ++
.../http/filters/VCloudSupportedVersions.java | 35 +
.../jclouds/vcloud/internal/VCloudLoginApi.java | 44 +
.../org/jclouds/vcloud/loaders/OVFLoader.java | 47 +
.../vcloud/loaders/VAppTemplateLoader.java | 47 +
.../org/jclouds/vcloud/location/DefaultVDC.java | 74 ++
.../location/OrgAndVDCToLocationSupplier.java | 93 ++
.../vcloud/options/CaptureVAppOptions.java | 51 ++
.../vcloud/options/CatalogItemOptions.java | 77 ++
.../jclouds/vcloud/options/CloneOptions.java | 53 ++
.../vcloud/options/CloneVAppOptions.java | 88 ++
.../options/CloneVAppTemplateOptions.java | 42 +
.../options/InstantiateVAppTemplateOptions.java | 178 ++++
.../jclouds/vcloud/predicates/TaskSuccess.java | 65 ++
.../vcloud/reference/VCloudConstants.java | 51 ++
.../jclouds/vcloud/reference/package-info.java | 21 +
...thNameMatchingConfigurationKeyOrDefault.java | 99 ++
.../vcloud/suppliers/VAppTemplatesSupplier.java | 86 ++
.../java/org/jclouds/vcloud/util/Utils.java | 71 ++
.../org/jclouds/vcloud/util/VCloudUtils.java | 67 ++
.../org/jclouds/vcloud/xml/CatalogHandler.java | 104 +++
.../jclouds/vcloud/xml/CatalogItemHandler.java | 81 ++
.../org/jclouds/vcloud/xml/ErrorHandler.java | 45 +
.../xml/GuestCustomizationSectionHandler.java | 137 +++
.../vcloud/xml/NetworkConnectionHandler.java | 87 ++
.../xml/NetworkConnectionSectionHandler.java | 103 +++
.../java/org/jclouds/vcloud/xml/OrgHandler.java | 112 +++
.../org/jclouds/vcloud/xml/OrgListHandler.java | 54 ++
.../jclouds/vcloud/xml/OrgNetworkHandler.java | 325 +++++++
.../vcloud/xml/SupportedVersionsHandler.java | 60 ++
.../org/jclouds/vcloud/xml/TaskHandler.java | 128 +++
.../jclouds/vcloud/xml/TasksListHandler.java | 74 ++
.../org/jclouds/vcloud/xml/VAppHandler.java | 151 ++++
.../jclouds/vcloud/xml/VAppTemplateHandler.java | 152 ++++
.../xml/VCloudVirtualHardwareHandler.java | 72 ++
.../java/org/jclouds/vcloud/xml/VDCHandler.java | 167 ++++
.../java/org/jclouds/vcloud/xml/VmHandler.java | 178 ++++
.../xml/ovf/VCloudNetworkSectionHandler.java | 69 ++
.../xml/ovf/VCloudOperatingSystemHandler.java | 81 ++
...oudResourceAllocationSettingDataHandler.java | 89 ++
.../services/org.jclouds.apis.ApiMetadata | 1 +
.../jclouds/vcloud/VCloudApiMetadataTest.java | 32 +
.../java/org/jclouds/vcloud/VCloudApiTest.java | 64 ++
.../vcloud/VCloudSessionRefreshLiveTest.java | 41 +
.../jclouds/vcloud/VCloudVersionsApiTest.java | 69 ++
.../BindCatalogItemToXmlPayloadTest.java | 53 ++
.../BindCloneVAppParamsToXmlPayloadTest.java | 81 ++
...CloneVAppTemplateParamsToXmlPayloadTest.java | 89 ++
.../BindDeployVAppParamsToXmlPayloadTest.java | 61 ++
...tiateVAppTemplateParamsToXmlPayloadTest.java | 179 ++++
...etworkConnectionSectionToXmlPayloadTest.java | 68 ++
.../BindUndeployVAppParamsToXmlPayloadTest.java | 61 ++
.../BaseVCloudComputeServiceExpectTest.java | 160 ++++
.../compute/VCloudComputeServiceLiveTest.java | 54 ++
.../functions/FindLocationForResourceTest.java | 64 ++
.../functions/ListImagesInVCloudExpectTest.java | 89 ++
.../functions/VAppToNodeMetadataTest.java | 228 +++++
.../options/VCloudTemplateOptionsTest.java | 197 ++++
...ThenCustomizeDeployAndPowerOnExpectTest.java | 171 ++++
.../VCloudComputeServiceAdapterTest.java | 89 ++
.../vcloud/features/CatalogApiLiveTest.java | 53 ++
.../jclouds/vcloud/features/CatalogApiTest.java | 131 +++
.../vcloud/features/NetworkApiLiveTest.java | 29 +
.../jclouds/vcloud/features/NetworkApiTest.java | 75 ++
.../jclouds/vcloud/features/OrgApiLiveTest.java | 42 +
.../org/jclouds/vcloud/features/OrgApiTest.java | 91 ++
.../vcloud/features/TaskApiLiveTest.java | 29 +
.../jclouds/vcloud/features/TaskApiTest.java | 108 +++
.../vcloud/features/VAppApiLiveTest.java | 53 ++
.../jclouds/vcloud/features/VAppApiTest.java | 315 +++++++
.../features/VAppTemplateApiLiveTest.java | 168 ++++
.../vcloud/features/VAppTemplateApiTest.java | 238 +++++
.../jclouds/vcloud/features/VDCApiLiveTest.java | 29 +
.../org/jclouds/vcloud/features/VDCApiTest.java | 102 +++
.../jclouds/vcloud/features/VmApiLiveTest.java | 163 ++++
.../org/jclouds/vcloud/features/VmApiTest.java | 320 +++++++
...loudAuthorizationAndCookieToRequestTest.java | 55 ++
.../ParseLoginResponseFromHeadersTest.java | 147 +++
.../ParseVCloudErrorFromHttpResponseTest.java | 96 ++
.../vcloud/internal/BasePayloadTest.java | 51 ++
.../vcloud/internal/BaseVCloudApiLiveTest.java | 59 ++
.../vcloud/internal/BaseVCloudApiTest.java | 272 ++++++
.../vcloud/internal/VCloudLoginApiTest.java | 97 ++
.../InstantiateVAppTemplateOptionsTest.java | 74 ++
...meMatchingConfigurationKeyOrDefaultTest.java | 115 +++
.../org/jclouds/vcloud/utils/TestUtils.java | 32 +
.../jclouds/vcloud/xml/CatalogHandlerTest.java | 135 +++
.../vcloud/xml/CatalogItemHandlerTest.java | 86 ++
.../GuestCustomizationSectionHandlerTest.java | 75 ++
.../xml/NetworkConnectionHandlerTest.java | 57 ++
.../NetworkConnectionSectionHandlerTest.java | 63 ++
.../org/jclouds/vcloud/xml/OrgHandlerTest.java | 124 +++
.../jclouds/vcloud/xml/OrgListHandlerTest.java | 57 ++
.../vcloud/xml/OrgNetworkHandlerTest.java | 104 +++
.../xml/SupportedVersionsHandlerTest.java | 53 ++
.../org/jclouds/vcloud/xml/TaskHandlerTest.java | 135 +++
.../vcloud/xml/TasksListHandlerTest.java | 82 ++
.../org/jclouds/vcloud/xml/VAppHandlerTest.java | 77 ++
.../vcloud/xml/VAppTemplateHandlerTest.java | 164 ++++
.../org/jclouds/vcloud/xml/VDCHandlerTest.java | 136 +++
.../org/jclouds/vcloud/xml/VmHandlerTest.java | 79 ++
...VCloudOperatingSystemSectionHandlerTest.java | 61 ++
...VCloudVirtualHardwareSectionHandlerTest.java | 153 ++++
.../src/test/resources/captureVApp-default.xml | 1 +
.../src/test/resources/captureVApp.xml | 1 +
.../src/test/resources/catalog-blank.xml | 7 +
.../src/test/resources/catalog-hosting.xml | 25 +
.../src/test/resources/catalog.xml | 27 +
.../src/test/resources/catalog1.0-vcd15.xml | 9 +
...alogItem-carrenza-with-default-namespace.xml | 8 +
...talogItem-carrenza-with-vcloud-namespace.xml | 8 +
.../src/test/resources/catalogItem-hosting.xml | 14 +
.../test/resources/catalogItem-terremark.xml | 16 +
.../src/test/resources/catalogItem1.0-vcd15.xml | 8 +
.../src/test/resources/copyVApp-default.xml | 1 +
.../src/test/resources/copyVApp.xml | 1 +
.../test/resources/copyVAppTemplate-default.xml | 1 +
.../src/test/resources/copyVAppTemplate.xml | 1 +
.../src/test/resources/cpuItem.xml | 1 +
.../src/test/resources/guestCustomization.xml | 23 +
.../resources/guestCustomizationSection.xml | 3 +
.../src/test/resources/instantiatedvapp.xml | 13 +
.../instantiationparams-description.xml | 1 +
.../resources/instantiationparams-network.xml | 1 +
.../src/test/resources/instantiationparams.xml | 1 +
.../1.7.1-stratos/src/test/resources/log4j.xml | 151 ++++
.../src/test/resources/memoryItem.xml | 1 +
.../src/test/resources/moveVApp.xml | 1 +
.../src/test/resources/moveVAppTemplate.xml | 1 +
.../src/test/resources/networkconnection.xml | 7 +
.../test/resources/networkconnectionsection.xml | 18 +
.../src/test/resources/org-1.0.xml | 24 +
.../src/test/resources/org-hosting.xml | 12 +
.../src/test/resources/org-savvis.xml | 13 +
.../1.7.1-stratos/src/test/resources/org.xml | 5 +
.../src/test/resources/org1.0-vcd15.xml | 11 +
.../src/test/resources/orgList1.0-vcd15.xml | 4 +
.../src/test/resources/orglist-savvis.xml | 3 +
.../src/test/resources/orglist.xml | 3 +
.../src/test/resources/orgnetwork-bridged.xml | 20 +
.../src/test/resources/orgnetwork-isolated.xml | 31 +
.../1.7.1-stratos/src/test/resources/os.xml | 11 +
.../src/test/resources/ovf-multi-vm.xml | 285 ++++++
.../src/test/resources/ovf-ubuntu64.xml | 148 +++
.../src/test/resources/task-1.0.xml | 9 +
.../src/test/resources/task-error.xml | 9 +
.../src/test/resources/task-hosting.xml | 12 +
.../src/test/resources/task-self.xml | 11 +
.../src/test/resources/task-vcd15.xml | 5 +
.../1.7.1-stratos/src/test/resources/task.xml | 8 +
.../src/test/resources/taskslist-hosting.xml | 14 +
.../src/test/resources/taskslist.xml | 27 +
.../resources/template1.0-vcd15-multi-vm.xml | 68 ++
.../src/test/resources/template1.0-vcd15.xml | 72 ++
.../src/test/resources/vAppTemplate-copying.xml | 41 +
.../src/test/resources/vAppTemplate.xml | 143 +++
.../vAppTemplate1.0-vcd15_withNewlines.xml | 109 +++
.../src/test/resources/vapp-hosting.xml | 235 +++++
.../src/test/resources/vapp-none.xml | 237 +++++
.../src/test/resources/vapp-pool.xml | 227 +++++
.../src/test/resources/vapp-rhel-off-static.xml | 325 +++++++
.../src/test/resources/vapp-ubuntu-off-dhcp.xml | 213 +++++
.../src/test/resources/vapp-unresolved.xml | 21 +
.../src/test/resources/vapp-win-off-static.xml | 219 +++++
.../src/test/resources/vdc-1.0.xml | 49 +
.../src/test/resources/vdc-hosting.xml | 60 ++
.../src/test/resources/vdc-nonet.xml | 22 +
.../1.7.1-stratos/src/test/resources/vdc.xml | 36 +
.../src/test/resources/vdc1.0-vcd15.xml | 47 +
.../src/test/resources/versions-vcd15.xml | 906 +++++++++++++++++++
.../src/test/resources/versions.xml | 7 +
.../test/resources/virtualhardwaresection.xml | 118 +++
.../src/test/resources/vm-rhel-off-static.xml | 197 ++++
.../openstack-nova/1.7.1-stratos/README.txt | 3 -
.../openstack-nova/1.7.1-stratos/pom.xml | 143 ---
.../jclouds/openstack/nova/v2_0/NovaApi.java | 208 -----
.../openstack/nova/v2_0/NovaApiMetadata.java | 125 ---
.../openstack/nova/v2_0/NovaAsyncApi.java | 214 -----
.../v2_0/binders/BindKeyPairToJsonPayload.java | 47 -
.../v2_0/binders/BindMetadataToJsonPayload.java | 47 -
.../BindSecurityGroupRuleToJsonPayload.java | 71 --
.../nova/v2_0/compute/NovaComputeService.java | 183 ----
.../v2_0/compute/NovaComputeServiceAdapter.java | 288 ------
.../config/NovaComputeServiceContextModule.java | 286 ------
.../compute/extensions/NovaImageExtension.java | 140 ---
.../extensions/NovaSecurityGroupExtension.java | 373 --------
.../AllocateAndAddFloatingIpToNode.java | 112 ---
.../functions/CreateSecurityGroupIfNeeded.java | 93 --
.../functions/FlavorInZoneToHardware.java | 60 --
.../compute/functions/ImageInZoneToImage.java | 70 --
.../functions/ImageToOperatingSystem.java | 128 ---
.../NovaSecurityGroupInZoneToSecurityGroup.java | 75 --
.../NovaSecurityGroupToSecurityGroup.java | 69 --
.../functions/OrphanedGroupsByZoneId.java | 77 --
.../RemoveFloatingIpFromNodeAndDeallocate.java | 74 --
.../SecurityGroupRuleToIpPermission.java | 99 --
.../functions/ServerInZoneToNodeMetadata.java | 199 ----
.../compute/loaders/CreateUniqueKeyPair.java | 79 --
.../loaders/FindSecurityGroupOrCreate.java | 86 --
.../loaders/LoadFloatingIpsForInstance.java | 63 --
.../compute/options/NovaTemplateOptions.java | 649 -------------
.../predicates/AllNodesInGroupTerminated.java | 56 --
...desWithGroupEncodedIntoNameThenAddToSet.java | 165 ----
.../nova/v2_0/config/NovaParserModule.java | 159 ----
.../nova/v2_0/config/NovaProperties.java | 43 -
.../nova/v2_0/config/NovaRestClientModule.java | 191 ----
.../openstack/nova/v2_0/domain/Address.java | 138 ---
.../openstack/nova/v2_0/domain/BackupType.java | 41 -
.../openstack/nova/v2_0/domain/Flavor.java | 211 -----
.../openstack/nova/v2_0/domain/FloatingIP.java | 173 ----
.../openstack/nova/v2_0/domain/Host.java | 127 ---
.../nova/v2_0/domain/HostAggregate.java | 250 -----
.../nova/v2_0/domain/HostResourceUsage.java | 180 ----
.../openstack/nova/v2_0/domain/Image.java | 303 -------
.../openstack/nova/v2_0/domain/Ingress.java | 160 ----
.../openstack/nova/v2_0/domain/KeyPair.java | 189 ----
.../openstack/nova/v2_0/domain/Network.java | 173 ----
.../openstack/nova/v2_0/domain/Quota.java | 356 --------
.../openstack/nova/v2_0/domain/QuotaClass.java | 62 --
.../openstack/nova/v2_0/domain/RebootType.java | 35 -
.../nova/v2_0/domain/SecurityGroup.java | 188 ----
.../nova/v2_0/domain/SecurityGroupRule.java | 174 ----
.../openstack/nova/v2_0/domain/Server.java | 476 ----------
.../nova/v2_0/domain/ServerCreated.java | 127 ---
.../v2_0/domain/ServerExtendedAttributes.java | 156 ----
.../nova/v2_0/domain/ServerExtendedStatus.java | 155 ----
.../v2_0/domain/ServerWithSecurityGroups.java | 128 ---
.../nova/v2_0/domain/SimpleServerUsage.java | 312 -------
.../nova/v2_0/domain/SimpleTenantUsage.java | 245 -----
.../nova/v2_0/domain/TenantIdAndName.java | 127 ---
.../nova/v2_0/domain/VirtualInterface.java | 128 ---
.../openstack/nova/v2_0/domain/Volume.java | 346 -------
.../nova/v2_0/domain/VolumeAttachment.java | 172 ----
.../nova/v2_0/domain/VolumeSnapshot.java | 239 -----
.../openstack/nova/v2_0/domain/VolumeType.java | 192 ----
.../domain/zonescoped/AvailabilityZone.java | 73 --
.../v2_0/domain/zonescoped/FlavorInZone.java | 46 -
.../v2_0/domain/zonescoped/ImageInZone.java | 46 -
.../domain/zonescoped/SecurityGroupInZone.java | 46 -
.../v2_0/domain/zonescoped/ServerInZone.java | 46 -
.../nova/v2_0/domain/zonescoped/ZoneAndId.java | 86 --
.../v2_0/domain/zonescoped/ZoneAndName.java | 111 ---
.../ZoneSecurityGroupNameAndPorts.java | 62 --
.../nova/v2_0/domain/zonescoped/ZoneState.java | 61 --
.../v2_0/extensions/AvailabilityZoneAPI.java | 40 -
.../extensions/AvailabilityZoneAsyncApi.java | 58 --
.../v2_0/extensions/ExtensionNamespaces.java | 110 ---
.../v2_0/extensions/FlavorExtraSpecsApi.java | 77 --
.../extensions/FlavorExtraSpecsAsyncApi.java | 118 ---
.../nova/v2_0/extensions/FloatingIPApi.java | 98 --
.../v2_0/extensions/FloatingIPAsyncApi.java | 145 ---
.../v2_0/extensions/HostAdministrationApi.java | 103 ---
.../extensions/HostAdministrationAsyncApi.java | 157 ----
.../nova/v2_0/extensions/HostAggregateApi.java | 87 --
.../v2_0/extensions/HostAggregateAsyncApi.java | 161 ----
.../nova/v2_0/extensions/KeyPairApi.java | 65 --
.../nova/v2_0/extensions/KeyPairAsyncApi.java | 101 ---
.../nova/v2_0/extensions/QuotaApi.java | 57 --
.../nova/v2_0/extensions/QuotaAsyncApi.java | 89 --
.../nova/v2_0/extensions/QuotaClassApi.java | 51 --
.../v2_0/extensions/QuotaClassAsyncApi.java | 78 --
.../nova/v2_0/extensions/SecurityGroupApi.java | 89 --
.../v2_0/extensions/SecurityGroupAsyncApi.java | 152 ----
.../nova/v2_0/extensions/ServerAdminApi.java | 120 ---
.../v2_0/extensions/ServerAdminAsyncApi.java | 175 ----
.../extensions/ServerWithSecurityGroupsApi.java | 49 -
.../ServerWithSecurityGroupsAsyncApi.java | 62 --
.../v2_0/extensions/SimpleTenantUsageApi.java | 50 -
.../extensions/SimpleTenantUsageAsyncApi.java | 77 --
.../v2_0/extensions/VirtualInterfaceApi.java | 43 -
.../extensions/VirtualInterfaceAsyncApi.java | 59 --
.../nova/v2_0/extensions/VolumeApi.java | 147 ---
.../nova/v2_0/extensions/VolumeAsyncApi.java | 254 ------
.../v2_0/extensions/VolumeAttachmentApi.java | 87 --
.../extensions/VolumeAttachmentAsyncApi.java | 107 ---
.../nova/v2_0/extensions/VolumeTypeApi.java | 101 ---
.../v2_0/extensions/VolumeTypeAsyncApi.java | 161 ----
.../openstack/nova/v2_0/features/FlavorApi.java | 78 --
.../nova/v2_0/features/FlavorAsyncApi.java | 144 ---
.../openstack/nova/v2_0/features/ImageApi.java | 142 ---
.../nova/v2_0/features/ImageAsyncApi.java | 206 -----
.../openstack/nova/v2_0/features/ServerApi.java | 276 ------
.../nova/v2_0/features/ServerAsyncApi.java | 356 --------
.../functions/FieldValueResponseParsers.java | 105 ---
.../nova/v2_0/functions/OverLimitParser.java | 92 --
.../ParseImageIdFromLocationHeader.java | 39 -
.../internal/OnlyMetadataValueOrNull.java | 63 --
.../functions/internal/ParseDiagnostics.java | 47 -
.../functions/internal/ParseFlavorDetails.java | 94 --
.../v2_0/functions/internal/ParseFlavors.java | 96 --
.../functions/internal/ParseImageDetails.java | 95 --
.../v2_0/functions/internal/ParseImages.java | 96 --
.../v2_0/functions/internal/ParseKeyPairs.java | 64 --
.../functions/internal/ParseServerDetails.java | 94 --
.../v2_0/functions/internal/ParseServers.java | 96 --
.../nova/v2_0/handlers/NovaErrorHandler.java | 129 ---
.../options/CreateBackupOfServerOptions.java | 105 ---
.../nova/v2_0/options/CreateServerOptions.java | 557 ------------
.../nova/v2_0/options/CreateVolumeOptions.java | 220 -----
.../options/CreateVolumeSnapshotOptions.java | 138 ---
.../v2_0/options/CreateVolumeTypeOptions.java | 101 ---
.../nova/v2_0/options/ListOptions.java | 107 ---
.../nova/v2_0/options/RebuildServerOptions.java | 142 ---
.../FindSecurityGroupWithNameAndReturnTrue.java | 84 --
.../nova/v2_0/predicates/ImagePredicates.java | 55 --
.../nova/v2_0/predicates/KeyPairPredicates.java | 77 --
.../predicates/SecurityGroupPredicates.java | 213 -----
.../services/org.jclouds.apis.ApiMetadata | 1 -
...tKeyAndTenantIdAuthenticationExpectTest.java | 75 --
...antNamePropertyAuthenticationExpectTest.java | 75 --
...KeyAndSecretKeyAuthenticationExpectTest.java | 69 --
.../nova/v2_0/EndpointIdIsRandomExpectTest.java | 72 --
.../nova/v2_0/NovaApiMetadataTest.java | 32 -
.../v2_0/PasswordAuthenticationExpectTest.java | 60 --
...dAuthenticationWithTenantNameExpectTest.java | 69 --
.../NovaComputeServiceAdapterExpectTest.java | 321 -------
.../compute/NovaComputeServiceExpectTest.java | 382 --------
.../compute/NovaComputeServiceLiveTest.java | 96 --
.../NovaImageExtensionExpectTest.java | 92 --
.../extensions/NovaImageExtensionLiveTest.java | 43 -
.../NovaSecurityGroupExtensionExpectTest.java | 433 ---------
.../NovaSecurityGroupExtensionLiveTest.java | 35 -
...llocateAndAddFloatingIpToNodeExpectTest.java | 133 ---
.../functions/FlavorInZoneToHardwareTest.java | 90 --
.../functions/ImageInZoneToImageTest.java | 95 --
.../functions/ImageToOperatingSystemTest.java | 192 ----
...aSecurityGroupInZoneToSecurityGroupTest.java | 94 --
.../NovaSecurityGroupToSecurityGroupTest.java | 155 ----
.../functions/OrphanedGroupsByZoneIdTest.java | 96 --
.../SecurityGroupRuleToIpPermissionTest.java | 81 --
.../ServerInZoneToNodeMetadataTest.java | 311 -------
.../loaders/CreateUniqueKeyPairTest.java | 111 ---
.../loaders/FindSecurityGroupOrCreateTest.java | 144 ---
.../loaders/LoadFloatingIpsForInstanceTest.java | 108 ---
.../options/NovaTemplateOptionsTest.java | 263 ------
.../extensions/AdminActionsApiExpectTest.java | 350 -------
.../extensions/AdminActionsApiLiveTest.java | 195 ----
.../AvailabilityZoneApiExpectTest.java | 64 --
.../AvailabilityZonesApiLiveTest.java | 45 -
.../FlavorExtraSpecsApiExpectTest.java | 142 ---
.../extensions/FlavorExtraSpecsApiLiveTest.java | 123 ---
.../extensions/FloatingIPApiExpectTest.java | 191 ----
.../v2_0/extensions/FloatingIPApiLiveTest.java | 171 ----
.../HostAdministrationApiExpectTest.java | 241 -----
.../HostAdministrationApiLiveTest.java | 116 ---
.../extensions/HostAggregateApiExpectTest.java | 179 ----
.../extensions/HostAggregateApiLiveTest.java | 148 ---
.../v2_0/extensions/KeyPairApiExpectTest.java | 142 ---
.../v2_0/extensions/KeyPairApiLiveTest.java | 76 --
.../v2_0/extensions/QuotaApiExpectTest.java | 125 ---
.../nova/v2_0/extensions/QuotaApiLiveTest.java | 100 --
.../extensions/QuotaClassApiExpectTest.java | 105 ---
.../v2_0/extensions/QuotaClassApiLiveTest.java | 73 --
.../extensions/SecurityGroupApiExpectTest.java | 235 -----
.../extensions/SecurityGroupApiLiveTest.java | 100 --
.../ServerWithSecurityGroupsApiExpectTest.java | 63 --
.../ServerWithSecurityGroupsApiLiveTest.java | 80 --
.../SimpleTenantUsageApiExpectTest.java | 99 --
.../SimpleTenantUsageApiLiveTest.java | 51 --
.../VirtualInterfaceApiExpectTest.java | 64 --
.../extensions/VirtualInterfaceApiLiveTest.java | 68 --
.../v2_0/extensions/VolumeApiExpectTest.java | 460 ----------
.../nova/v2_0/extensions/VolumeApiLiveTest.java | 274 ------
.../VolumeAttachmentApiExpectTest.java | 168 ----
.../extensions/VolumeAttachmentApiLiveTest.java | 156 ----
.../extensions/VolumeTypeApiExpectTest.java | 259 ------
.../v2_0/extensions/VolumeTypeApiLiveTest.java | 126 ---
.../v2_0/features/ExtensionApiExpectTest.java | 115 ---
.../v2_0/features/ExtensionApiLiveTest.java | 84 --
.../nova/v2_0/features/FlavorApiExpectTest.java | 164 ----
.../nova/v2_0/features/FlavorApiLiveTest.java | 105 ---
.../nova/v2_0/features/ImageApiExpectTest.java | 377 --------
.../nova/v2_0/features/ImageApiLiveTest.java | 101 ---
.../nova/v2_0/features/ServerApiExpectTest.java | 746 ---------------
.../nova/v2_0/features/ServerApiLiveTest.java | 206 -----
.../CreateSecurityGroupIfNeededTest.java | 168 ----
...ityGroupWithNameAndReturnTrueExpectTest.java | 102 ---
.../v2_0/functions/InternalURLLiveTest.java | 64 --
.../v2_0/handlers/NovaErrorHandlerTest.java | 225 -----
.../v2_0/internal/BaseNovaApiExpectTest.java | 28 -
.../nova/v2_0/internal/BaseNovaApiLiveTest.java | 120 ---
...BaseNovaComputeServiceContextExpectTest.java | 87 --
.../BaseNovaComputeServiceExpectTest.java | 35 -
.../nova/v2_0/internal/BaseNovaExpectTest.java | 84 --
...eComputeServiceTypicalSecurityGroupTest.java | 76 --
.../nova/v2_0/parse/ParseCreateFlavorTest.java | 58 --
.../nova/v2_0/parse/ParseCreatedServerTest.java | 80 --
.../parse/ParseExtensionListNormalTest.java | 76 --
.../nova/v2_0/parse/ParseExtensionListTest.java | 88 --
.../nova/v2_0/parse/ParseExtensionTest.java | 71 --
.../nova/v2_0/parse/ParseFlavorListTest.java | 85 --
.../nova/v2_0/parse/ParseFlavorTest.java | 70 --
.../v2_0/parse/ParseFloatingIPListTest.java | 59 --
.../nova/v2_0/parse/ParseFloatingIPTest.java | 53 --
.../nova/v2_0/parse/ParseImageListTest.java | 85 --
.../nova/v2_0/parse/ParseImageTest.java | 98 --
.../nova/v2_0/parse/ParseKeyPairListTest.java | 68 --
.../nova/v2_0/parse/ParseKeyPairTest.java | 61 --
.../nova/v2_0/parse/ParseMetadataItemTest.java | 58 --
.../nova/v2_0/parse/ParseMetadataListTest.java | 63 --
.../v2_0/parse/ParseMetadataUpdateTest.java | 64 --
.../v2_0/parse/ParseSecurityGroupListTest.java | 72 --
.../nova/v2_0/parse/ParseSecurityGroupTest.java | 69 --
.../v2_0/parse/ParseServerDetailsEssexTest.java | 170 ----
.../nova/v2_0/parse/ParseServerDiagnostics.java | 57 --
.../nova/v2_0/parse/ParseServerListTest.java | 85 --
.../nova/v2_0/parse/ParseServerTest.java | 117 ---
.../parse/ParseServerWithAllExtensionsTest.java | 104 ---
.../ParseServerWithInternetAddressesTest.java | 99 --
...ublicIpsInPrivateAddressBlockExpectTest.java | 99 --
.../v2_0/predicates/ImagePredicatesTest.java | 44 -
.../predicates/SecurityGroupPredicatesTest.java | 129 ---
.../src/test/resources/attachment_details.json | 1 -
.../src/test/resources/attachment_list.json | 1 -
.../src/test/resources/extension_details.json | 21 -
.../src/test/resources/extension_list.json | 42 -
.../src/test/resources/extension_list_full.json | 281 ------
.../test/resources/extension_list_normal.json | 31 -
.../resources/extension_list_openstack.json | 115 ---
.../src/test/resources/flavor_details.json | 19 -
.../src/test/resources/flavor_list.json | 32 -
.../src/test/resources/flavor_list_detail.json | 1 -
.../resources/flavor_list_detail_openstack.json | 83 --
.../src/test/resources/flavor_new.json | 10 -
.../src/test/resources/floatingip_details.json | 9 -
.../src/test/resources/floatingip_list.json | 16 -
.../1.7.1-stratos/src/test/resources/host.json | 1 -
.../test/resources/host_aggregate_details.json | 1 -
.../src/test/resources/host_aggregate_list.json | 1 -
.../host_aggregate_with_host_details.json | 1 -
.../src/test/resources/hosts_list.json | 1 -
.../src/test/resources/image_active.json | 41 -
.../src/test/resources/image_details.json | 41 -
.../src/test/resources/image_list.json | 32 -
.../src/test/resources/image_list_detail.json | 1 -
.../image_list_detail_imageextension.json | 121 ---
.../resources/image_list_detail_openstack.json | 81 --
.../src/test/resources/keypair_created.json | 9 -
.../keypair_created_computeservice.json | 9 -
.../src/test/resources/keypair_list.json | 18 -
.../test/resources/listAvailabilityZones.json | 11 -
.../src/test/resources/metadata_item.json | 5 -
.../src/test/resources/metadata_list.json | 6 -
.../src/test/resources/metadata_updated.json | 7 -
.../src/test/resources/new_server.json | 41 -
.../resources/new_server_disk_config_auto.json | 42 -
.../new_server_disk_config_manual.json | 42 -
.../src/test/resources/new_server_in_zone.json | 41 -
.../resources/new_server_networks_response.json | 42 -
.../test/resources/new_server_no_adminpass.json | 40 -
.../resources/new_server_nova_networks.json | 41 -
.../src/test/resources/quota_class.json | 15 -
.../src/test/resources/quotas.json | 15 -
.../test/resources/securitygroup_created.json | 9 -
.../test/resources/securitygroup_details.json | 34 -
...itygroup_details_computeservice_typical.json | 51 --
.../securitygroup_details_extension.json | 34 -
...securitygroup_details_extension_norules.json | 10 -
.../resources/securitygroup_details_port22.json | 19 -
.../src/test/resources/securitygroup_list.json | 51 --
...oup_list_details_computeservice_typical.json | 53 --
.../resources/securitygroup_list_extension.json | 51 --
.../resources/securitygrouprule_created.json | 12 -
.../securitygrouprule_created_cidr.json | 13 -
.../securitygrouprule_created_group.json | 14 -
.../src/test/resources/server_details.json | 86 --
.../test/resources/server_details_devstack.json | 44 -
.../resources/server_details_openstack.json | 46 -
.../src/test/resources/server_diagnostics.json | 17 -
.../src/test/resources/server_list.json | 32 -
.../src/test/resources/server_list_details.json | 79 --
.../resources/server_list_details_essex.json | 152 ----
.../resources/server_public_ip_in_private.json | 51 --
.../resources/server_with_security_groups.json | 1 -
.../server_with_security_groups_extension.json | 1 -
.../src/test/resources/simple_tenant_usage.json | 1 -
.../test/resources/simple_tenant_usages.json | 1 -
.../src/test/resources/snapshot_details.json | 1 -
.../src/test/resources/snapshot_list.json | 1 -
.../test/resources/snapshot_list_detail.json | 1 -
.../test/resources/virtual_interfaces_list.json | 1 -
.../src/test/resources/volume_details.json | 1 -
.../src/test/resources/volume_list.json | 1 -
.../src/test/resources/volume_list_detail.json | 1 -
.../src/test/resources/volume_type.json | 9 -
.../test/resources/volume_type_extra_specs.json | 1 -
.../src/test/resources/volume_type_list.json | 1 -
.../provider/aws-ec2/1.7.1-stratos/pom.xml | 29 +-
.../org/jclouds/aws/ec2/AWSEC2ApiMetadata.java | 2 +-
.../BindLaunchSpecificationToFormParams.java | 13 +-
.../aws/ec2/compute/AWSEC2TemplateOptions.java | 59 +-
.../AWSEC2CreateNodesInGroupThenAddToSet.java | 39 +-
...curityGroupsAsNeededAndReturnRunOptions.java | 16 +-
.../aws/ec2/domain/AWSRunningInstance.java | 29 +-
.../aws/ec2/domain/LaunchSpecification.java | 43 +-
.../aws/ec2/options/AWSRunInstancesOptions.java | 27 +-
.../aws/ec2/xml/LaunchSpecificationHandler.java | 20 +-
.../features/PlacementGroupApiExpectTest.java | 4 +-
.../ec2/features/SpotInstanceApiExpectTest.java | 4 +-
...InstanceRequestToAWSRunningInstanceTest.java | 4 +-
.../src/test/resources/describe_instances_1.xml | 2 +-
.../src/test/resources/describe_instances_2.xml | 2 +-
.../src/test/resources/describe_instances_3.xml | 2 +-
.../resources/describe_instances_latest.xml | 2 +-
.../resources/describe_instances_pending.xml | 2 +-
.../resources/describe_security_groups_vpc.xml | 2 +-
.../test/resources/describe_spot_instance.xml | 2 +-
.../describe_spot_instance_requests.xml | 2 +-
.../resources/describe_spot_instance_tags.xml | 2 +-
.../resources/describe_spot_instances_1.xml | 2 +-
.../resources/describe_spot_price_history.xml | 2 +-
.../resources/request_spot_instances-ebs.xml | 2 +-
.../test/resources/request_spot_instances.xml | 2 +-
.../src/test/resources/run_instances_1.xml | 2 +-
.../jclouds/vcloud/1.7.1-stratos/README.txt | 6 -
.../jclouds/vcloud/1.7.1-stratos/pom.xml | 129 ---
.../vcloud/TaskInErrorStateException.java | 39 -
.../vcloud/TaskStillRunningException.java | 39 -
.../main/java/org/jclouds/vcloud/VCloudApi.java | 91 --
.../org/jclouds/vcloud/VCloudApiMetadata.java | 103 ---
.../org/jclouds/vcloud/VCloudMediaType.java | 221 -----
.../jclouds/vcloud/VCloudResponseException.java | 69 --
.../java/org/jclouds/vcloud/VCloudToken.java | 37 -
.../org/jclouds/vcloud/VCloudVersionsApi.java | 38 -
.../binders/BindCPUCountToXmlPayload.java | 79 --
.../BindCaptureVAppParamsToXmlPayload.java | 124 ---
.../binders/BindCatalogItemToXmlPayload.java | 126 ---
.../binders/BindCloneParamsToXmlPayload.java | 133 ---
.../BindCloneVAppParamsToXmlPayload.java | 65 --
...BindCloneVAppTemplateParamsToXmlPayload.java | 60 --
.../BindDeployVAppParamsToXmlPayload.java | 42 -
...ndGuestCustomizationSectionToXmlPayload.java | 112 ---
...stantiateVAppTemplateParamsToXmlPayload.java | 221 -----
.../vcloud/binders/BindMemoryToXmlPayload.java | 80 --
...indNetworkConnectionSectionToXmlPayload.java | 106 ---
.../vcloud/binders/BindParamsToXmlPayload.java | 81 --
.../BindUndeployVAppParamsToXmlPayload.java | 42 -
.../OrgNameAndCatalogNameToEndpoint.java | 79 --
.../binders/OrgNameAndVDCNameToEndpoint.java | 78 --
.../OrgNameCatalogNameItemNameToEndpoint.java | 77 --
...meCatalogNameVAppTemplateNameToEndpoint.java | 90 --
.../OrgNameVDCNameNetworkNameToEndpoint.java | 54 --
...NameVDCNameResourceEntityNameToEndpoint.java | 54 --
.../OrgNameVDCNameResourceNameToEndpoint.java | 81 --
.../VCloudComputeServiceContextModule.java | 39 -
.../VCloudComputeServiceDependenciesModule.java | 154 ----
.../functions/FindLocationForResource.java | 69 --
.../compute/functions/HardwareForVApp.java | 71 --
.../functions/HardwareForVAppTemplate.java | 84 --
.../compute/functions/ImageForVAppTemplate.java | 82 --
.../compute/functions/VAppToNodeMetadata.java | 112 ---
...dHardwareBuilderFromResourceAllocations.java | 43 -
...EnvelopeOrThrowIllegalArgumentException.java | 77 --
.../internal/VCloudTemplateBuilderImpl.java | 48 -
.../compute/options/VCloudTemplateOptions.java | 350 -------
...edIntoNameThenCustomizeDeployAndPowerOn.java | 302 -------
...etworkConfigurationForNetworkAndOptions.java | 80 --
.../strategy/VCloudComputeServiceAdapter.java | 263 ------
.../vcloud/compute/util/VCloudComputeUtils.java | 116 ---
.../vcloud/config/DefaultCatalogForOrg.java | 63 --
.../vcloud/config/DefaultNetworkForVDC.java | 65 --
.../vcloud/config/DefaultOrgForUser.java | 58 --
.../vcloud/config/DefaultTasksListForOrg.java | 53 --
.../config/DefaultVCloudReferencesModule.java | 165 ----
.../jclouds/vcloud/config/DefaultVDCForOrg.java | 63 --
.../vcloud/config/VCloudHttpApiModule.java | 538 -----------
.../jclouds/vcloud/domain/AllocationModel.java | 70 --
.../org/jclouds/vcloud/domain/Capacity.java | 108 ---
.../java/org/jclouds/vcloud/domain/Catalog.java | 69 --
.../org/jclouds/vcloud/domain/CatalogItem.java | 37 -
.../domain/GuestCustomizationSection.java | 440 ---------
.../domain/InstantiateVAppTemplateParams.java | 96 --
.../vcloud/domain/NetworkConnection.java | 233 -----
.../vcloud/domain/NetworkConnectionSection.java | 218 -----
.../java/org/jclouds/vcloud/domain/Org.java | 86 --
.../jclouds/vcloud/domain/ReferenceType.java | 55 --
.../java/org/jclouds/vcloud/domain/Status.java | 246 -----
.../java/org/jclouds/vcloud/domain/Task.java | 72 --
.../org/jclouds/vcloud/domain/TaskStatus.java | 71 --
.../org/jclouds/vcloud/domain/TasksList.java | 37 -
.../java/org/jclouds/vcloud/domain/VApp.java | 87 --
.../org/jclouds/vcloud/domain/VAppTemplate.java | 97 --
.../org/jclouds/vcloud/domain/VCloudError.java | 123 ---
.../jclouds/vcloud/domain/VCloudSession.java | 29 -
.../java/org/jclouds/vcloud/domain/VDC.java | 146 ---
.../org/jclouds/vcloud/domain/VDCStatus.java | 57 --
.../main/java/org/jclouds/vcloud/domain/Vm.java | 108 ---
.../vcloud/domain/internal/CatalogImpl.java | 193 ----
.../vcloud/domain/internal/CatalogItemImpl.java | 111 ---
.../vcloud/domain/internal/ErrorImpl.java | 119 ---
.../jclouds/vcloud/domain/internal/OrgImpl.java | 171 ----
.../domain/internal/ReferenceTypeImpl.java | 103 ---
.../vcloud/domain/internal/TaskImpl.java | 165 ----
.../vcloud/domain/internal/TasksListImpl.java | 81 --
.../vcloud/domain/internal/VAppImpl.java | 166 ----
.../domain/internal/VAppTemplateImpl.java | 205 -----
.../jclouds/vcloud/domain/internal/VDCImpl.java | 292 ------
.../jclouds/vcloud/domain/internal/VmImpl.java | 217 -----
.../vcloud/domain/network/DhcpService.java | 106 ---
.../jclouds/vcloud/domain/network/Features.java | 95 --
.../vcloud/domain/network/FenceMode.java | 70 --
.../vcloud/domain/network/FirewallService.java | 86 --
.../domain/network/IpAddressAllocationMode.java | 52 --
.../jclouds/vcloud/domain/network/IpRange.java | 76 --
.../jclouds/vcloud/domain/network/IpScope.java | 170 ----
.../vcloud/domain/network/NatService.java | 115 ---
.../vcloud/domain/network/NetworkConfig.java | 167 ----
.../vcloud/domain/network/OrgNetwork.java | 121 ---
.../domain/network/firewall/FirewallPolicy.java | 54 --
.../network/firewall/FirewallProtocols.java | 73 --
.../domain/network/firewall/FirewallRule.java | 125 ---
.../domain/network/internal/OrgNetworkImpl.java | 202 -----
.../vcloud/domain/network/nat/NatPolicy.java | 54 --
.../vcloud/domain/network/nat/NatProtocol.java | 48 -
.../vcloud/domain/network/nat/NatRule.java | 35 -
.../vcloud/domain/network/nat/NatType.java | 61 --
.../domain/network/nat/rules/MappingMode.java | 54 --
.../network/nat/rules/OneToOneVmRule.java | 110 ---
.../network/nat/rules/PortForwardingRule.java | 111 ---
.../vcloud/domain/network/nat/rules/VmRule.java | 128 ---
.../EditableResourceAllocationSettingData.java | 302 -------
.../vcloud/domain/ovf/VCloudHardDisk.java | 330 -------
.../vcloud/domain/ovf/VCloudNetworkAdapter.java | 332 -------
.../vcloud/domain/ovf/VCloudNetworkSection.java | 80 --
.../ovf/VCloudOperatingSystemSection.java | 118 ---
.../ovf/VCloudVirtualHardwareSection.java | 179 ----
.../org/jclouds/vcloud/endpoints/Catalog.java | 37 -
.../org/jclouds/vcloud/endpoints/Network.java | 37 -
.../java/org/jclouds/vcloud/endpoints/Org.java | 37 -
.../org/jclouds/vcloud/endpoints/OrgList.java | 37 -
.../org/jclouds/vcloud/endpoints/TasksList.java | 37 -
.../jclouds/vcloud/endpoints/VCloudLogin.java | 38 -
.../java/org/jclouds/vcloud/endpoints/VDC.java | 37 -
.../org/jclouds/vcloud/features/CatalogApi.java | 144 ---
.../org/jclouds/vcloud/features/NetworkApi.java | 61 --
.../org/jclouds/vcloud/features/OrgApi.java | 86 --
.../org/jclouds/vcloud/features/TaskApi.java | 82 --
.../org/jclouds/vcloud/features/VAppApi.java | 261 ------
.../vcloud/features/VAppTemplateApi.java | 180 ----
.../org/jclouds/vcloud/features/VDCApi.java | 73 --
.../java/org/jclouds/vcloud/features/VmApi.java | 295 ------
...ddVCloudAuthorizationAndCookieToRequest.java | 63 --
.../vcloud/functions/CatalogItemsInCatalog.java | 64 --
.../vcloud/functions/CatalogItemsInOrg.java | 57 --
.../jclouds/vcloud/functions/CatalogsInOrg.java | 73 --
.../functions/DefaultNetworkNameInTemplate.java | 47 -
.../jclouds/vcloud/functions/NetworksInOrg.java | 57 --
.../vcloud/functions/OrgNameToEndpoint.java | 57 --
.../functions/OrgNameToTasksListEndpoint.java | 62 --
.../vcloud/functions/OrgsForLocations.java | 73 --
.../jclouds/vcloud/functions/OrgsForNames.java | 56 --
.../ParseLoginResponseFromHeaders.java | 105 ---
.../functions/VAppTemplatesForCatalogItems.java | 66 --
.../vcloud/functions/VAppTemplatesInOrg.java | 65 --
.../org/jclouds/vcloud/functions/VDCsInOrg.java | 57 --
.../ParseVCloudErrorFromHttpResponse.java | 121 ---
.../http/filters/VCloudBasicAuthentication.java | 58 --
.../http/filters/VCloudSupportedVersions.java | 35 -
.../jclouds/vcloud/internal/VCloudLoginApi.java | 44 -
.../org/jclouds/vcloud/loaders/OVFLoader.java | 47 -
.../vcloud/loaders/VAppTemplateLoader.java | 47 -
.../org/jclouds/vcloud/location/DefaultVDC.java | 74 --
.../location/OrgAndVDCToLocationSupplier.java | 93 --
.../vcloud/options/CaptureVAppOptions.java | 51 --
.../vcloud/options/CatalogItemOptions.java | 77 --
.../jclouds/vcloud/options/CloneOptions.java | 53 --
.../vcloud/options/CloneVAppOptions.java | 88 --
.../options/CloneVAppTemplateOptions.java | 42 -
.../options/InstantiateVAppTemplateOptions.java | 178 ----
.../jclouds/vcloud/predicates/TaskSuccess.java | 65 --
.../vcloud/reference/VCloudConstants.java | 51 --
.../jclouds/vcloud/reference/package-info.java | 21 -
...thNameMatchingConfigurationKeyOrDefault.java | 99 --
.../vcloud/suppliers/VAppTemplatesSupplier.java | 86 --
.../java/org/jclouds/vcloud/util/Utils.java | 71 --
.../org/jclouds/vcloud/util/VCloudUtils.java | 67 --
.../org/jclouds/vcloud/xml/CatalogHandler.java | 104 ---
.../jclouds/vcloud/xml/CatalogItemHandler.java | 81 --
.../org/jclouds/vcloud/xml/ErrorHandler.java | 45 -
.../xml/GuestCustomizationSectionHandler.java | 137 ---
.../vcloud/xml/NetworkConnectionHandler.java | 87 --
.../xml/NetworkConnectionSectionHandler.java | 103 ---
.../java/org/jclouds/vcloud/xml/OrgHandler.java | 112 ---
.../org/jclouds/vcloud/xml/OrgListHandler.java | 54 --
.../jclouds/vcloud/xml/OrgNetworkHandler.java | 325 -------
.../vcloud/xml/SupportedVersionsHandler.java | 60 --
.../org/jclouds/vcloud/xml/TaskHandler.java | 128 ---
.../jclouds/vcloud/xml/TasksListHandler.java | 74 --
.../org/jclouds/vcloud/xml/VAppHandler.java | 151 ----
.../jclouds/vcloud/xml/VAppTemplateHandler.java | 152 ----
.../xml/VCloudVirtualHardwareHandler.java | 72 --
.../java/org/jclouds/vcloud/xml/VDCHandler.java | 167 ----
.../java/org/jclouds/vcloud/xml/VmHandler.java | 178 ----
.../xml/ovf/VCloudNetworkSectionHandler.java | 69 --
.../xml/ovf/VCloudOperatingSystemHandler.java | 81 --
...oudResourceAllocationSettingDataHandler.java | 89 --
.../services/org.jclouds.apis.ApiMetadata | 1 -
.../jclouds/vcloud/VCloudApiMetadataTest.java | 32 -
.../java/org/jclouds/vcloud/VCloudApiTest.java | 64 --
.../vcloud/VCloudSessionRefreshLiveTest.java | 41 -
.../jclouds/vcloud/VCloudVersionsApiTest.java | 69 --
.../BindCatalogItemToXmlPayloadTest.java | 53 --
.../BindCloneVAppParamsToXmlPayloadTest.java | 81 --
...CloneVAppTemplateParamsToXmlPayloadTest.java | 89 --
.../BindDeployVAppParamsToXmlPayloadTest.java | 61 --
...tiateVAppTemplateParamsToXmlPayloadTest.java | 179 ----
...etworkConnectionSectionToXmlPayloadTest.java | 68 --
.../BindUndeployVAppParamsToXmlPayloadTest.java | 61 --
.../BaseVCloudComputeServiceExpectTest.java | 160 ----
.../compute/VCloudComputeServiceLiveTest.java | 54 --
.../functions/FindLocationForResourceTest.java | 64 --
.../functions/ListImagesInVCloudExpectTest.java | 89 --
.../functions/VAppToNodeMetadataTest.java | 228 -----
.../options/VCloudTemplateOptionsTest.java | 197 ----
...ThenCustomizeDeployAndPowerOnExpectTest.java | 171 ----
.../VCloudComputeServiceAdapterTest.java | 89 --
.../vcloud/features/CatalogApiLiveTest.java | 53 --
.../jclouds/vcloud/features/CatalogApiTest.java | 131 ---
.../vcloud/features/NetworkApiLiveTest.java | 29 -
.../jclouds/vcloud/features/NetworkApiTest.java | 75 --
.../jclouds/vcloud/features/OrgApiLiveTest.java | 42 -
.../org/jclouds/vcloud/features/OrgApiTest.java | 91 --
.../vcloud/features/TaskApiLiveTest.java | 29 -
.../jclouds/vcloud/features/TaskApiTest.java | 108 ---
.../vcloud/features/VAppApiLiveTest.java | 53 --
.../jclouds/vcloud/features/VAppApiTest.java | 315 -------
.../features/VAppTemplateApiLiveTest.java | 168 ----
.../vcloud/features/VAppTemplateApiTest.java | 238 -----
.../jclouds/vcloud/features/VDCApiLiveTest.java | 29 -
.../org/jclouds/vcloud/features/VDCApiTest.java | 102 ---
.../jclouds/vcloud/features/VmApiLiveTest.java | 163 ----
.../org/jclouds/vcloud/features/VmApiTest.java | 320 -------
...loudAuthorizationAndCookieToRequestTest.java | 55 --
.../ParseLoginResponseFromHeadersTest.java | 147 ---
.../ParseVCloudErrorFromHttpResponseTest.java | 96 --
.../vcloud/internal/BasePayloadTest.java | 51 --
.../vcloud/internal/BaseVCloudApiLiveTest.java | 59 --
.../vcloud/internal/BaseVCloudApiTest.java | 272 ------
.../vcloud/internal/VCloudLoginApiTest.java | 97 --
.../InstantiateVAppTemplateOptionsTest.java | 74 --
...meMatchingConfigurationKeyOrDefaultTest.java | 115 ---
.../org/jclouds/vcloud/utils/TestUtils.java | 32 -
.../jclouds/vcloud/xml/CatalogHandlerTest.java | 135 ---
.../vcloud/xml/CatalogItemHandlerTest.java | 86 --
.../GuestCustomizationSectionHandlerTest.java | 75 --
.../xml/NetworkConnectionHandlerTest.java | 57 --
.../NetworkConnectionSectionHandlerTest.java | 63 --
.../org/jclouds/vcloud/xml/OrgHandlerTest.java | 124 ---
.../jclouds/vcloud/xml/OrgListHandlerTest.java | 57 --
.../vcloud/xml/OrgNetworkHandlerTest.java | 104 ---
.../xml/SupportedVersionsHandlerTest.java | 53 --
.../org/jclouds/vcloud/xml/TaskHandlerTest.java | 135 ---
.../vcloud/xml/TasksListHandlerTest.java | 82 --
.../org/jclouds/vcloud/xml/VAppHandlerTest.java | 77 --
.../vcloud/xml/VAppTemplateHandlerTest.java | 164 ----
.../org/jclouds/vcloud/xml/VDCHandlerTest.java | 136 ---
.../org/jclouds/vcloud/xml/VmHandlerTest.java | 79 --
...VCloudOperatingSystemSectionHandlerTest.java | 61 --
...VCloudVirtualHardwareSectionHandlerTest.java | 153 ----
.../src/test/resources/captureVApp-default.xml | 1 -
.../src/test/resources/captureVApp.xml | 1 -
.../src/test/resources/catalog-blank.xml | 7 -
.../src/test/resources/catalog-hosting.xml | 25 -
.../src/test/resources/catalog.xml | 27 -
.../src/test/resources/catalog1.0-vcd15.xml | 9 -
...alogItem-carrenza-with-default-namespace.xml | 8 -
...talogItem-carrenza-with-vcloud-namespace.xml | 8 -
.../src/test/resources/catalogItem-hosting.xml | 14 -
.../test/resources/catalogItem-terremark.xml | 16 -
.../src/test/resources/catalogItem1.0-vcd15.xml | 8 -
.../src/test/resources/copyVApp-default.xml | 1 -
.../src/test/resources/copyVApp.xml | 1 -
.../test/resources/copyVAppTemplate-default.xml | 1 -
.../src/test/resources/copyVAppTemplate.xml | 1 -
.../src/test/resources/cpuItem.xml | 1 -
.../src/test/resources/guestCustomization.xml | 23 -
.../resources/guestCustomizationSection.xml | 3 -
.../src/test/resources/instantiatedvapp.xml | 13 -
.../instantiationparams-description.xml | 1 -
.../resources/instantiationparams-network.xml | 1 -
.../src/test/resources/instantiationparams.xml | 1 -
.../1.7.1-stratos/src/test/resources/log4j.xml | 151 ----
.../src/test/resources/memoryItem.xml | 1 -
.../src/test/resources/moveVApp.xml | 1 -
.../src/test/resources/moveVAppTemplate.xml | 1 -
.../src/test/resources/networkconnection.xml | 7 -
.../test/resources/networkconnectionsection.xml | 18 -
.../src/test/resources/org-1.0.xml | 24 -
.../src/test/resources/org-hosting.xml | 12 -
.../src/test/resources/org-savvis.xml | 13 -
.../1.7.1-stratos/src/test/resources/org.xml | 5 -
.../src/test/resources/org1.0-vcd15.xml | 11 -
.../src/test/resources/orgList1.0-vcd15.xml | 4 -
.../src/test/resources/orglist-savvis.xml | 3 -
.../src/test/resources/orglist.xml | 3 -
.../src/test/resources/orgnetwork-bridged.xml | 20 -
.../src/test/resources/orgnetwork-isolated.xml | 31 -
.../1.7.1-stratos/src/test/resources/os.xml | 11 -
.../src/test/resources/ovf-multi-vm.xml | 285 ------
.../src/test/resources/ovf-ubuntu64.xml | 148 ---
.../src/test/resources/task-1.0.xml | 9 -
.../src/test/resources/task-error.xml | 9 -
.../src/test/resources/task-hosting.xml | 12 -
.../src/test/resources/task-self.xml | 11 -
.../src/test/resources/task-vcd15.xml | 5 -
.../1.7.1-stratos/src/test/resources/task.xml | 8 -
.../src/test/resources/taskslist-hosting.xml | 14 -
.../src/test/resources/taskslist.xml | 27 -
.../resources/template1.0-vcd15-multi-vm.xml | 68 --
.../src/test/resources/template1.0-vcd15.xml | 72 --
.../src/test/resources/vAppTemplate-copying.xml | 41 -
.../src/test/resources/vAppTemplate.xml | 143 ---
.../vAppTemplate1.0-vcd15_withNewlines.xml | 109 ---
.../src/test/resources/vapp-hosting.xml | 235 -----
.../src/test/resources/vapp-none.xml | 237 -----
.../src/test/resources/vapp-pool.xml | 227 -----
.../src/test/resources/vapp-rhel-off-static.xml | 325 -------
.../src/test/resources/vapp-ubuntu-off-dhcp.xml | 213 -----
.../src/test/resources/vapp-unresolved.xml | 21 -
.../src/test/resources/vapp-win-off-static.xml | 219 -----
.../src/test/resources/vdc-1.0.xml | 49 -
.../src/test/resources/vdc-hosting.xml | 60 --
.../src/test/resources/vdc-nonet.xml | 22 -
.../1.7.1-stratos/src/test/resources/vdc.xml | 36 -
.../src/test/resources/vdc1.0-vcd15.xml | 47 -
.../src/test/resources/versions-vcd15.xml | 906 -------------------
.../src/test/resources/versions.xml | 7 -
.../test/resources/virtualhardwaresection.xml | 118 ---
.../src/test/resources/vm-rhel-off-static.xml | 197 ----
dependencies/pom.xml | 4 +-
1286 files changed, 64401 insertions(+), 64290 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/README.txt
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/README.txt b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/README.txt
new file mode 100755
index 0000000..7162c0f
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/README.txt
@@ -0,0 +1,3 @@
+#
+# The jclouds API for OpenStack Nova
+#
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/pom.xml b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/pom.xml
new file mode 100644
index 0000000..e022595
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/pom.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-project</artifactId>
+ <version>1.7.1</version>
+ </parent>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>openstack-nova</artifactId>
+ <version>1.7.1-stratos</version>
+ <name>jclouds openstack-nova api</name>
+ <description>jclouds components to access an implementation of OpenStack Nova</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <jclouds.version>1.7.1</jclouds.version>
+ <!-- keystone endpoint -->
+ <test.openstack-nova.endpoint>http://localhost:5000/v2.0/</test.openstack-nova.endpoint>
+ <!-- keystone version -->
+ <test.openstack-nova.api-version>1.1</test.openstack-nova.api-version>
+ <test.openstack-nova.build-version />
+ <test.openstack-nova.identity>FIXME_IDENTITY</test.openstack-nova.identity>
+ <test.openstack-nova.credential>FIXME_CREDENTIALS</test.openstack-nova.credential>
+ <test.openstack-nova.template />
+ <test.jclouds.openstack-nova.auto-allocate-floating-ips>false</test.jclouds.openstack-nova.auto-allocate-floating-ips>
+ <test.jclouds.keystone.credential-type>passwordCredentials</test.jclouds.keystone.credential-type>
+
+ <jclouds.osgi.export>org.jclouds.openstack.nova.v2_0*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.compute.internal;version="${jclouds.version}",
+ org.jclouds.rest.internal;version="${jclouds.version}",
+ org.jclouds*;version="${jclouds.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>openstack-keystone</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>openstack-keystone</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-slf4j</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <test.openstack-nova.endpoint>${test.openstack-nova.endpoint}</test.openstack-nova.endpoint>
+ <test.openstack-nova.api-version>${test.openstack-nova.api-version}</test.openstack-nova.api-version>
+ <test.openstack-nova.build-version>${test.openstack-nova.build-version}</test.openstack-nova.build-version>
+ <test.openstack-nova.identity>${test.openstack-nova.identity}</test.openstack-nova.identity>
+ <test.openstack-nova.credential>${test.openstack-nova.credential}</test.openstack-nova.credential>
+ <test.openstack-nova.template>${test.openstack-nova.template}</test.openstack-nova.template>
+ <test.jclouds.openstack-nova.auto-allocate-floating-ips>${test.jclouds.openstack-nova.auto-allocate-floating-ips}</test.jclouds.openstack-nova.auto-allocate-floating-ips>
+ <test.jclouds.keystone.credential-type>${test.jclouds.keystone.credential-type}</test.jclouds.keystone.credential-type>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+
+</project>
[34/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFloatingIPListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFloatingIPListTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFloatingIPListTest.java
new file mode 100644
index 0000000..705b6e6
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFloatingIPListTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseSetParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "ParseFloatingIPListTest")
+public class ParseFloatingIPListTest extends BaseSetParserTest<FloatingIP> {
+
+ @Override
+ public String resource() {
+ return "/floatingip_list.json";
+ }
+
+ @Override
+ @SelectJson("floating_ips")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Set<FloatingIP> expected() {
+ return ImmutableSet.of(FloatingIP.builder().id("1").instanceId("12").ip("10.0.0.3").fixedIp("11.0.0.1").build(),
+ FloatingIP.builder().id("2").instanceId(null).ip("10.0.0.5").fixedIp(null).build());
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFloatingIPTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFloatingIPTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFloatingIPTest.java
new file mode 100644
index 0000000..a75167c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseFloatingIPTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "ParseFloatingIPTest")
+public class ParseFloatingIPTest extends BaseItemParserTest<FloatingIP> {
+
+ @Override
+ public String resource() {
+ return "/floatingip_details.json";
+ }
+
+ @Override
+ @SelectJson("floating_ip")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public FloatingIP expected() {
+ return FloatingIP.builder().id("1").instanceId("123").fixedIp("10.0.0.2").ip("10.0.0.3").build();
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseImageListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseImageListTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseImageListTest.java
new file mode 100644
index 0000000..2dd19b3
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseImageListTest.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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseSetParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Jeremy Daggett
+ */
+@Test(groups = "unit", testName = "ParseImageListTest")
+public class ParseImageListTest extends BaseSetParserTest<Resource> {
+
+ @Override
+ public String resource() {
+ return "/image_list.json";
+ }
+
+ @Override
+ @SelectJson("images")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Set<Resource> expected() {
+ return ImmutableSet
+ .of(Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f6f006e54")
+ .name("CentOS 5.2")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f6f006e54")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f6f006e54")))
+ .build(),
+ Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f5736d2a2")
+ .name("My Server Backup")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2")))
+ .build());
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseImageTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseImageTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseImageTest.java
new file mode 100644
index 0000000..4d36a56
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseImageTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.domain.Image.Status;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Jeremy Daggett
+ */
+@Test(groups = "unit", testName = "ParseImageTest")
+public class ParseImageTest extends BaseItemParserTest<Image> {
+
+ @Override
+ public String resource() {
+ return "/image_details.json";
+ }
+
+ @Override
+ @SelectJson("image")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Image expected() {
+ return Image
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f5736d2a2")
+ .name("My Server Backup")
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2010-10-10T12:00:00Z"))
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2010-08-10T12:00:00Z"))
+ .tenantId("12345")
+ .userId("joe")
+ .status(Status.SAVING)
+ .progress(80)
+ .minDisk(5)
+ .minRam(256)
+ .metadata(
+ new ImmutableMap.Builder<String, String>().put("ImageType", "Gold").put("ImageVersion", "1.5")
+ .build())
+ .server(
+ Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f335aa7b3")
+ .name("null")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f335aa7b3")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f335aa7b3")))
+ .build())
+ .links(
+ ImmutableSet.of(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"))))
+ .build();
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairListTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairListTest.java
new file mode 100644
index 0000000..9576b52
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairListTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseKeyPairs;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "ParseKeyPairListTest")
+public class ParseKeyPairListTest extends BaseItemParserTest<FluentIterable<? extends KeyPair>> {
+
+ @Override
+ public String resource() {
+ return "/keypair_list.json";
+ }
+
+ @Override
+ @ResponseParser(ParseKeyPairs.class)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public FluentIterable<? extends KeyPair> expected() {
+ return FluentIterable.from(ImmutableSet.of(
+ KeyPair
+ .builder()
+ .publicKey(
+ "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQCy9EC3O7Ff80vPEfAHDQob61PGwcpYc5KE7tEZnZhrB9n0NyHPRm0E0M+ls3fcTa04HDi+R0DzmRwoyhHQJyI658v8kWZZcuvFjKCcsgsSh/dzdX0xTreLIzSOzt5U7RnZYfshP5cmxtF99yrEY3M/swdin0L+fXsTSkR1B42STQ== nova@nv-aw2az1-api0001")
+ .name("default").fingerprint("ab:0c:f4:f3:54:c0:5d:3f:ed:62:ad:d3:94:7c:79:7c").build(),
+ KeyPair
+ .builder()
+ .publicKey(
+ "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABACE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumADSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQ== nova@nv-aw2az1-api0001")
+ .name("testkeypair").fingerprint("d2:1f:c9:2b:d8:90:77:5f:15:64:27:e3:9f:77:1d:e4").build()));
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairTest.java
new file mode 100644
index 0000000..da1423d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "ParseKeyPairTest")
+public class ParseKeyPairTest extends BaseItemParserTest<KeyPair> {
+
+ @Override
+ public String resource() {
+ return "/keypair_created.json";
+ }
+
+ @Override
+ @SelectJson("keypair")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public KeyPair expected() {
+ return KeyPair
+ .builder()
+ .publicKey(
+ "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABACE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumADSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQ== nova@nv-aw2az1-api0001\n")
+ .privateKey(
+ "-----BEGIN RSA PRIVATE KEY-----\nMIICXQIAAAKBgQDFNyGjgs6c9akgmZ2ou/fJf7Pdrc23hC95/gM/33OrG4GZABAC\nE4DTioa/PGN+7rHv9YUavUCtXrWayhGniKq/wCuI5fo5TO4AmDNv7/sCGHIHFumA\nDSIoLx0vFhGJIetXEWxL9r0lfFC7//6yZM2W3KcGjbMtlPXqBT9K9PzdyQIDAQAB\nAoGAW8Ww+KbpQK8smcgCTr/RqcmsSI8VeL2hXjJvDq0L5WbyYuFdkanDvCztUVZn\nsmyfDtwAqZXB4Ct/dN1tY7m8QpdyRaKRW4Q+hghGCAQpsG7rYDdvwdEyvMaW5RA4\ntucQyajMNyQ/tozU3wMx/v8A7RvGcE9tqoG0WK1C3kBu95UCQQDrOd+joYDkvccz\nFIVu5gNPMXEh3fGGzDxk225UlvESquYLzfz4TfmuUjH4Z1BL3wRiwfJsrrjFkm33\njIidDE8PAkEA1qHjxuaIS1yz/rfzErmcOVNlbFHMP4ihjGTTvh1ZctXlNeLwzENQ\nEDaQV3IpUY1KQR6rxcWb5AXgfF9D9PYFpwJBANucAqGAbRgh3lJgPFtXP4u2O0tF\nLPOOxmvbOdybt6KYD4LB5AXmts77SlACFMNhCXUyYaT6UuOSXDyb5gfJsB0CQQC3\nFaGXKU9Z+doQjhlq/6mjvN/nZl80Uvh7Kgb1RVPoAU1kihGeLE0/h0vZTCiyyDNv\nGRqtucMg32J+tUTi0HpBAkAwHiCZMHMeJWHUwIwlRQY/dnR86FWobRl98ViF2rCL\nDHkDVOeIser3Q6zSqU5/m99lX6an5g8pAh/R5LqnOQZC\n-----END RSA PRIVATE KEY-----\n")
+ .name("testkeypair").userId("65649731189278")
+ .fingerprint("d2:1f:c9:2b:d8:90:77:5f:15:64:27:e3:9f:77:1d:e4").build();
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataItemTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataItemTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataItemTest.java
new file mode 100644
index 0000000..a13d484
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataItemTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Jeremy Daggett
+ */
+@Test(groups = "unit", testName = "ParseMetadataItemTest")
+public class ParseMetadataItemTest extends BaseItemParserTest<Map<String, String>> {
+
+ @Override
+ public String resource() {
+ return "/metadata_item.json";
+ }
+
+ @Override
+ @SelectJson("metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Map<String, String> expected() {
+ ImmutableMap<String, String> metadata = ImmutableMap.of("Server Label", "Web Head 1");
+ return metadata;
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataListTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataListTest.java
new file mode 100644
index 0000000..5559b20
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataListTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Jeremy Daggett
+ */
+@Test(groups = "unit", testName = "ParseMetadataListTest")
+public class ParseMetadataListTest extends BaseItemParserTest<Map<String, String>> {
+
+ @Override
+ public String resource() {
+ return "/metadata_list.json";
+ }
+
+ @Override
+ @SelectJson("metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Map<String, String> expected() {
+ ImmutableMap<String, String> metadata =
+ new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 1")
+ .put("Image Version", "2.1")
+ .build();
+
+ return metadata;
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataUpdateTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataUpdateTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataUpdateTest.java
new file mode 100644
index 0000000..eb7a1e8
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseMetadataUpdateTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Jeremy Daggett
+ */
+@Test(groups = "unit", testName = "ParseMetadataUpdateTest")
+public class ParseMetadataUpdateTest extends BaseItemParserTest<Map<String, String>> {
+
+ @Override
+ public String resource() {
+ return "/metadata_updated.json";
+ }
+
+ @Override
+ @SelectJson("metadata")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Map<String, String> expected() {
+ ImmutableMap<String, String> metadata =
+ new ImmutableMap.Builder<String, String>()
+ .put("Server Label", "Web Head 2")
+ .put("Image Version", "2.1")
+ .put("Server Description", "Simple Server")
+ .build();
+
+ return metadata;
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseSecurityGroupListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseSecurityGroupListTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseSecurityGroupListTest.java
new file mode 100644
index 0000000..4e46ede
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseSecurityGroupListTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseSetParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "ParseSecurityGroupListTest")
+public class ParseSecurityGroupListTest extends BaseSetParserTest<SecurityGroup> {
+
+ @Override
+ public String resource() {
+ return "/securitygroup_list.json";
+ }
+
+ @Override
+ @SelectJson("security_groups")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Set<SecurityGroup> expected() {
+
+ Set<SecurityGroupRule> securityGroupRules = ImmutableSet.<SecurityGroupRule> of(
+ SecurityGroupRule.builder().fromPort(22)
+ .ipProtocol(IpProtocol.TCP).toPort(22).parentGroupId("3").ipRange("0.0.0.0/0")
+ .id("107").build(),
+ SecurityGroupRule.builder().fromPort(7600)
+ .ipProtocol(IpProtocol.TCP).toPort(7600).parentGroupId("3").ipRange("0.0.0.0/0")
+ .id("118").build(),
+ SecurityGroupRule.builder().fromPort(8084)
+ .ipProtocol(IpProtocol.TCP).toPort(8084).parentGroupId("3").ipRange("0.0.0.0/0")
+ .id("119").build());
+
+ return ImmutableSet.of(SecurityGroup.builder().description("description1").id("1").tenantId("tenant1")
+ .rules(securityGroupRules).name("name1").build());
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseSecurityGroupTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseSecurityGroupTest.java
new file mode 100644
index 0000000..784a0bd
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseSecurityGroupTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.domain.TenantIdAndName;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Michael Arnold
+ */
+@Test(groups = "unit", testName = "ParseSecurityGroupTest")
+public class ParseSecurityGroupTest extends BaseItemParserTest<SecurityGroup> {
+ @Override
+ public String resource() {
+ return "/securitygroup_details.json";
+ }
+
+ @Override
+ @SelectJson("security_group")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public SecurityGroup expected() {
+
+ Set<SecurityGroupRule> securityGroupRules = ImmutableSet.<SecurityGroupRule> of(
+ SecurityGroupRule.builder().fromPort(22)
+ .ipProtocol(IpProtocol.TCP).toPort(22).parentGroupId("28")
+ .ipRange("10.2.6.0/24").id("108").build(),
+ SecurityGroupRule.builder().fromPort(22).group(TenantIdAndName.builder().name("11111").tenantId("admin").build())
+ .ipProtocol(IpProtocol.TCP).toPort(22).parentGroupId("28")
+ .id("109").build());
+
+ return SecurityGroup.builder().description("description0").id("0").tenantId("tenant0").rules(securityGroupRules)
+ .name("name0").build();
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerDetailsEssexTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerDetailsEssexTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerDetailsEssexTest.java
new file mode 100644
index 0000000..afa6874
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerDetailsEssexTest.java
@@ -0,0 +1,170 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseSetParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.Address;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
+import org.jclouds.openstack.nova.v2_0.domain.ServerExtendedStatus;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseServerDetailsEssexTest")
+public class ParseServerDetailsEssexTest extends BaseSetParserTest<Server> {
+
+ @Override
+ public String resource() {
+ return "/server_list_details_essex.json";
+ }
+
+ @Override
+ @SelectJson("servers")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Set<Server> expected() {
+ return ImmutableSet.<Server>of(
+ Server.builder()
+ .addresses(ImmutableMultimap.<String, Address>builder()
+ .putAll("Net TenantA Front-Middle", Address.createV4("172.16.11.5"))
+ .putAll("Public network", Address.createV4("172.16.1.13"), Address.createV4("10.193.112.119")).build())
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://nova:8774/v1.1/8d10e6646d5d4585937395b04839a353/servers/0c80b392-db30-4736-ae02-4480090f1207")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/servers/0c80b392-db30-4736-ae02-4480090f1207")))
+ .image(
+ Resource.builder()
+ .id("416af940-2d3c-4a7c-977c-a9030685ad5e")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/images/416af940-2d3c-4a7c-977c-a9030685ad5e"))).build())
+ .flavor(
+ Resource.builder()
+ .id("1")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/flavors/1"))).build())
+ .id("0c80b392-db30-4736-ae02-4480090f1207")
+ .userId("df13814f6c354d00a8acf66502836323")
+ .status(Status.ACTIVE)
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-04-12T11:21:33Z"))
+ .hostId("03d796ebb52b1b555e5f6d9262f7dbd52b3f7c181e3aa89b34ca5408")
+ .name("VM proxy")
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-04-12T11:21:23Z"))
+ .tenantId("8d10e6646d5d4585937395b04839a353")
+ .extendedStatus(ServerExtendedStatus.builder().vmState("active").powerState(1).build())
+ .diskConfig("MANUAL").build(),
+ Server.builder()
+ .addresses(ImmutableMultimap.<String, Address>builder()
+ .putAll("Net TenantA Front-Middle", Address.createV4("172.16.11.4"))
+ .putAll("Net TenantA Middle-Back", Address.createV4("172.16.12.5")).build())
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://nova:8774/v1.1/8d10e6646d5d4585937395b04839a353/servers/b332b5cd-535e-4677-b68e-fc8badc13236")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/servers/b332b5cd-535e-4677-b68e-fc8badc13236")))
+ .image(
+ Resource.builder()
+ .id("416af940-2d3c-4a7c-977c-a9030685ad5e")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/images/416af940-2d3c-4a7c-977c-a9030685ad5e"))).build())
+ .flavor(
+ Resource.builder()
+ .id("1")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/flavors/1"))).build())
+ .id("b332b5cd-535e-4677-b68e-fc8badc13236")
+ .userId("df13814f6c354d00a8acf66502836323")
+ .status(Status.ACTIVE)
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-04-12T11:18:58Z"))
+ .hostId("e5bbff80bebacfe1db63951e787b5341427060a602d33abfefb6a1bc")
+ .name("VM blog")
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-04-12T11:18:48Z"))
+ .tenantId("8d10e6646d5d4585937395b04839a353")
+ .extendedStatus(ServerExtendedStatus.builder().vmState("active").powerState(1).build())
+ .diskConfig("MANUAL").build(),
+ Server.builder()
+ .addresses(ImmutableMultimap.<String, Address>builder()
+ .putAll("Net TenantA Middle-Back", Address.createV4("172.16.12.4")).build())
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://nova:8774/v1.1/8d10e6646d5d4585937395b04839a353/servers/f9d43436-4572-4c9b-9b74-5fa6890a2f21")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/servers/f9d43436-4572-4c9b-9b74-5fa6890a2f21")))
+ .image(
+ Resource.builder()
+ .id("416af940-2d3c-4a7c-977c-a9030685ad5e")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/images/416af940-2d3c-4a7c-977c-a9030685ad5e"))).build())
+ .flavor(
+ Resource.builder()
+ .id("1")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://nova:8774/8d10e6646d5d4585937395b04839a353/flavors/1"))).build())
+ .id("f9d43436-4572-4c9b-9b74-5fa6890a2f21")
+ .userId("df13814f6c354d00a8acf66502836323")
+ .status(Status.ACTIVE)
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-04-12T11:15:09Z"))
+ .hostId("03d796ebb52b1b555e5f6d9262f7dbd52b3f7c181e3aa89b34ca5408")
+ .name("VM MySQL")
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-04-12T11:14:56Z"))
+ .tenantId("8d10e6646d5d4585937395b04839a353")
+ .extendedStatus(ServerExtendedStatus.builder().vmState("active").powerState(1).build())
+ .diskConfig("MANUAL").build());
+ }
+
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerDiagnostics.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerDiagnostics.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerDiagnostics.java
new file mode 100644
index 0000000..8d4eb8b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerDiagnostics.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.jclouds.openstack.nova.v2_0.parse;
+
+import java.util.Map;
+
+import org.jclouds.json.BaseItemParserTest;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ *
+ * @author Leander Beernaert
+ */
+public class ParseServerDiagnostics extends BaseItemParserTest<Optional<Map<String,String>>> {
+
+
+ @Override
+ public Optional<Map<String,String>> expected() {
+ return Optional.<Map<String,String>>of(
+ new ImmutableMap.Builder<String,String>()
+ .put("vnet0_tx_errors", "0")
+ .put("vda_read","77364736")
+ .put("vda_write","415446016")
+ .put("vnet0_tx_packets","9701")
+ .put("vda_write_req","47278")
+ .put("cpu0_time","143150000000")
+ .put("vnet0_tx","1691221")
+ .put("vnet0_rx_drop","0")
+ .put("vda_errors","-1")
+ .put("vnet0_rx_errors","0")
+ .put("memory","524288")
+ .put("vnet0_rx_packets","11271")
+ .put("vda_read_req","9551")
+ .put("vnet0_rx","1805288")
+ .put("vnet0_tx_drop","0").build());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerListTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerListTest.java
new file mode 100644
index 0000000..4ebbcf2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerListTest.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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.json.BaseSetParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseServerListTest")
+public class ParseServerListTest extends BaseSetParserTest<Resource> {
+
+ @Override
+ public String resource() {
+ return "/server_list.json";
+ }
+
+ @Override
+ @SelectJson("servers")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Set<Resource> expected() {
+ return ImmutableSet
+ .of(Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f6af67565")
+ .name("sample-server")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f6af67565")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f6af67565")))
+ .build(),
+ Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f1f1350e5")
+ .name("sample-server2")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f1f1350e5")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f1f1350e5")))
+ .build());
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerTest.java
new file mode 100644
index 0000000..1b53135
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.Address;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+import static org.jclouds.openstack.nova.v2_0.domain.Address.createV4;
+import static org.jclouds.openstack.nova.v2_0.domain.Address.createV6;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseServerTest")
+public class ParseServerTest extends BaseItemParserTest<Server> {
+
+ @Override
+ public String resource() {
+ return "/server_details.json";
+ }
+
+ @Override
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Server expected() {
+ return Server
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f000004d2")
+ .tenantId("1234")
+ .userId("5678")
+ .name("sample-f352")
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2010-10-10T12:00:00Z"))
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2010-08-10T12:00:00Z"))
+ .hostId("e4d909c290d0fb1ca068ffaddf22cbd0")
+ .accessIPv4("67.23.10.132")
+ .accessIPv6("::babe:67.23.10.132")
+ .status(Status.BUILD)
+ .diskConfig(Server.DISK_CONFIG_AUTO)
+ .image(
+ Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f6f006e54")
+ .name("null")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f6f006e54")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f6f006e54")))
+ .build())
+ .flavor(
+ Resource
+ .builder()
+ .id("52415800-8b69-11e0-9b19-734f216543fd")
+ .name("null")
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd")))
+ .build())
+ .metadata(
+ new ImmutableMap.Builder<String, String>().put("Server Label", "Web Head 1")
+ .put("Image Version", "2.1").build())
+ .addresses(ImmutableMultimap.<String, Address>builder()
+ .putAll("public", createV4("67.23.10.132"), createV6("::babe:67.23.10.132"), createV4("67.23.10.131"), createV6("::babe:4317:0A83"))
+ .putAll("private", createV4("10.176.42.16"), createV6("::babe:10.176.42.16"))
+ .build())
+ .links(Link.create(
+ Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f6f006e54")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f6f006e54")))
+ .build();
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithAllExtensionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithAllExtensionsTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithAllExtensionsTest.java
new file mode 100644
index 0000000..e5d37d0
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithAllExtensionsTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.Address;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
+import org.jclouds.openstack.nova.v2_0.domain.ServerExtendedAttributes;
+import org.jclouds.openstack.nova.v2_0.domain.ServerExtendedStatus;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMultimap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "ParseServerWithAllExtensionsTest")
+public class ParseServerWithAllExtensionsTest extends BaseItemParserTest<Server> {
+
+ @Override
+ public String resource() {
+ return "/server_details_devstack.json";
+ }
+
+ @Override
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Server expected() {
+ return Server
+ .builder()
+ .id("141b775f-7ac1-45f0-9a95-146260f33a53")
+ .tenantId("7f312675f9b84c97bff8f5054e181419")
+ .userId("89c01b67395d4bea945f7f5bfd7f344a")
+ .name("test")
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-04T15:07:48Z"))
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-04T15:07:36Z"))
+ .hostId("eab9a77d1c44b8833e4a3dc6d2d9d50de556e780a319f184d8c82d9b")
+ .status(Status.PAUSED)
+ .image(
+ Resource
+ .builder()
+ .id("8e6f5bc4-a210-45b2-841f-c510eae14300")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://172.16.89.149:8774/7f312675f9b84c97bff8f5054e181419/images/8e6f5bc4-a210-45b2-841f-c510eae14300")))
+ .build())
+ .flavor(
+ Resource
+ .builder()
+ .id("1")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://172.16.89.149:8774/7f312675f9b84c97bff8f5054e181419/flavors/1")))
+ .build())
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("http://172.16.89.149:8774/v2/7f312675f9b84c97bff8f5054e181419/servers/141b775f-7ac1-45f0-9a95-146260f33a53")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("http://172.16.89.149:8774/7f312675f9b84c97bff8f5054e181419/servers/141b775f-7ac1-45f0-9a95-146260f33a53")))
+ .addresses(ImmutableMultimap.of("private", Address.createV4("10.0.0.8")))
+ .diskConfig("MANUAL")
+ .extendedStatus(ServerExtendedStatus.builder().vmState("paused").powerState(3).build())
+ .extendedAttributes(ServerExtendedAttributes.builder().instanceName("instance-00000014").hostName("ubuntu").build())
+ .build();
+ }
+
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithInternetAddressesTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithInternetAddressesTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithInternetAddressesTest.java
new file mode 100644
index 0000000..2065f20
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithInternetAddressesTest.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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.Address;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMultimap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseServerTest")
+public class ParseServerWithInternetAddressesTest extends BaseItemParserTest<Server> {
+
+ @Override
+ public String resource() {
+ return "/server_details_openstack.json";
+ }
+
+ @Override
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Server expected() {
+ return Server
+ .builder()
+ .id("1459")
+ .uuid("2443c9c7-9791-412e-ac09-a6d55ec25335")
+ .tenantId("37")
+ .userId("508151008")
+ .name("mygroup-72c")
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-03-23T01:30:26Z"))
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-03-23T01:30:26Z"))
+ .hostId("881706597197955ac7cc4b353bc7ec884e13fa280de9cc82057796cb")
+ .status(Status.ACTIVE)
+ .image(
+ Resource
+ .builder()
+ .id("14")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("https://nova-api.openstack.org:9774/37/images/14")))
+ .build())
+ .flavor(
+ Resource
+ .builder()
+ .id("1")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("https://nova-api.openstack.org:9774/37/flavors/1")))
+ .build())
+ .links(
+ Link.create(
+ Relation.SELF,
+ URI.create("https://nova-api.openstack.org:9774/v1.1/37/servers/1459")),
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("https://nova-api.openstack.org:9774/37/servers/1459")))
+ .addresses(ImmutableMultimap.of("internet", Address.createV4("8.21.28.47"))).build();
+ }
+
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/PublicIpsInPrivateAddressBlockExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/PublicIpsInPrivateAddressBlockExpectTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/PublicIpsInPrivateAddressBlockExpectTest.java
new file mode 100644
index 0000000..3b56766
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/parse/PublicIpsInPrivateAddressBlockExpectTest.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.openstack.nova.v2_0.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
+import org.jclouds.openstack.nova.v2_0.domain.Address;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
+import org.jclouds.openstack.v2_0.domain.Resource;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ParseCreatedServerTest")
+public class PublicIpsInPrivateAddressBlockExpectTest extends BaseItemParserTest<Server> {
+
+ @Override
+ public String resource() {
+ return "/server_public_ip_in_private.json";
+ }
+
+ @Override
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Server expected() {
+ return Server
+ .builder()
+ .id("59662")
+ .hostId("cb0d9e5004bef8c21270a0b09f7624f4c387f3a523f3aaa4c5694a61")
+ .uuid("7aed8e05-1daf-476a-87b2-640e8f7dcafd")
+ .tenantId("37936628937291")
+ .userId("54297837463082")
+ .name("hpcloud-computes-38d")
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-03-22T22:11:55Z"))
+ .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-03-22T22:11:19Z"))
+ .status(Status.ACTIVE)
+ .keyName("jclouds_hpcloud-computes_77")
+ .image(
+ Resource
+ .builder()
+ .id("229")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/229")))
+ .build())
+ .flavor(
+ Resource
+ .builder()
+ .id("100")
+ .links(
+ Link.create(
+ Relation.BOOKMARK,
+ URI.create("https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100")))
+ .build())
+ .metadata(ImmutableMap.of("Name", "hpcloud-computes"))
+ .addresses(ImmutableMultimap.<String, Address>builder()
+ .putAll("private", Address.createV4("10.6.39.189"), Address.createV4("15.185.181.94")).build())
+ .links(
+ Link.create(Relation.SELF, URI.create("https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/59662")),
+ Link.create(Relation.BOOKMARK, URI.create("https://az-2.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/59662"))).build();
+
+ }
+
+ protected Injector injector() {
+ return Guice.createInjector(new NovaParserModule(), new GsonModule());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicatesTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicatesTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicatesTest.java
new file mode 100644
index 0000000..b4cad2b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicatesTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.openstack.nova.v2_0.predicates;
+
+import static org.jclouds.openstack.nova.v2_0.predicates.ImagePredicates.statusEquals;
+
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.domain.Image.Status;
+import org.jclouds.openstack.nova.v2_0.parse.ParseImageTest;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "ImagePredicatesTest")
+public class ImagePredicatesTest {
+ Image ref = new ParseImageTest().expected();
+
+ @Test
+ public void teststatusEqualsWhenEqual() {
+ assert statusEquals(Status.SAVING).apply(ref);
+ }
+
+ @Test
+ public void teststatusEqualsWhenNotEqual() {
+ assert !statusEquals(Status.DELETED).apply(ref);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicatesTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicatesTest.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicatesTest.java
new file mode 100644
index 0000000..26e5ce2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicatesTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.openstack.nova.v2_0.predicates;
+
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.nameEquals;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.nameIn;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleCidr;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleEndPort;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleGroup;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleProtocol;
+import static org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates.ruleStartPort;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+import org.jclouds.openstack.nova.v2_0.domain.TenantIdAndName;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "SecurityGroupPredicatesTest")
+public class SecurityGroupPredicatesTest {
+ SecurityGroup ref = SecurityGroup.builder().id("12345").name("jclouds").description("description").build();
+ SecurityGroupRule ruleRef = SecurityGroupRule.builder().id("6789").parentGroupId("12345").ipRange("0.0.0.0/0")
+ .fromPort(10).toPort(20).ipProtocol(IpProtocol.TCP)
+ .group(TenantIdAndName.builder().tenantId("11111111").name("abcd").build())
+ .build();
+
+ public void testnameEqualsWhenEqual() {
+ assertTrue(nameEquals("jclouds").apply(ref), "expected 'jclouds' as the name of " + ref);
+ }
+
+ @Test
+ public void testnameEqualsWhenNotEqual() {
+ assertTrue(!nameEquals("foo").apply(ref), "expected 'foo' not to be the name of " + ref);
+ }
+
+ @Test
+ public void testNameInWhenIn() {
+ assertTrue(nameIn(ImmutableSet.of("jclouds", "pants")).apply(ref),
+ "expected the name of " + ref + " to be one of 'jclouds' or 'pants'");
+ }
+
+ @Test
+ public void testNameInWhenNotIn() {
+ assertTrue(!nameIn(ImmutableSet.of("foo", "pants")).apply(ref),
+ "expected the name of " + ref + " to not be either of 'foo' or 'pants'");
+
+ }
+
+ @Test
+ public void testRuleCidrWhenEqual() {
+ assertTrue(ruleCidr("0.0.0.0/0").apply(ruleRef),
+ "expected the CIDR to be '0.0.0.0/0' for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleCidrWhenNotEqual() {
+ assertTrue(!ruleCidr("1.1.1.1/0").apply(ruleRef),
+ "expected the CIDR to not be '1.1.1.1/0' for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleGroupWhenEqual() {
+ assertTrue(ruleGroup("abcd").apply(ruleRef),
+ "expected the group to be equal to 'abcd' for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleGroupWhenNotEqual() {
+ assertTrue(!ruleGroup("pants").apply(ruleRef),
+ "expected the group to not be equal to 'pants' for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleProtocolWhenEqual() {
+ assertTrue(ruleProtocol(IpProtocol.TCP).apply(ruleRef),
+ "expected TCP for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleProtocolWhenNotEqual() {
+ assertTrue(!ruleProtocol(IpProtocol.UDP).apply(ruleRef),
+ "expected not UDP for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleStartPortWhenEqual() {
+ assertTrue(ruleStartPort(10).apply(ruleRef),
+ "expected start port 10 for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleStartPortWhenNotEqual() {
+ assertTrue(!ruleStartPort(50).apply(ruleRef),
+ "expected start port not to be 50 for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleEndPortWhenEqual() {
+ assertTrue(ruleEndPort(20).apply(ruleRef),
+ "expected end port 20 for " + ruleRef);
+ }
+
+ @Test
+ public void testRuleEndPortWhenNotEqual() {
+ assertTrue(!ruleEndPort(50).apply(ruleRef),
+ "expected end port not to be 50 for " + ruleRef);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/attachment_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/attachment_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/attachment_details.json
new file mode 100644
index 0000000..c436406
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/attachment_details.json
@@ -0,0 +1 @@
+{"volumeAttachment": {"device": "/dev/vdc", "serverId": "b4785058-cb80-491b-baa3-e4ee6546450e", "id": 1, "volumeId": 1}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/attachment_list.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/attachment_list.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/attachment_list.json
new file mode 100644
index 0000000..b40de0b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/attachment_list.json
@@ -0,0 +1 @@
+{"volumeAttachments": [{"device": "/dev/vdc", "serverId": "b4785058-cb80-491b-baa3-e4ee6546450e", "id": 1, "volumeId": 1}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_details.json
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_details.json b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_details.json
new file mode 100644
index 0000000..6336a42
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/test/resources/extension_details.json
@@ -0,0 +1,21 @@
+{
+ "extension" : {
+ "name" : "Public Image Extension",
+ "namespace" : "http://docs.rackspacecloud.com/servers/api/ext/pie/v1.0",
+ "alias" : "RS-PIE",
+ "updated" : "2011-01-22T13:25:27-06:00",
+ "description" : "Adds the capability to share an image with other users.",
+ "links" : [
+ {
+ "rel" : "describedby",
+ "type" : "application/pdf",
+ "href" : "http://docs.rackspacecloud.com/servers/api/ext/cs-pie-20111111.pdf"
+ },
+ {
+ "rel" : "describedby",
+ "type" : "application/vnd.sun.wadl+xml",
+ "href" : "http://docs.rackspacecloud.com/servers/api/ext/cs-pie.wadl"
+ }
+ ]
+ }
+}
\ No newline at end of file
[08/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/SecurityGroupInZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/SecurityGroupInZone.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/SecurityGroupInZone.java
deleted file mode 100644
index 28e2b0f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/SecurityGroupInZone.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain.zonescoped;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
-
-/**
- * @author Adrian Cole
- */
-public class SecurityGroupInZone extends ZoneAndName {
- protected final SecurityGroup securityGroup;
-
- public SecurityGroupInZone(SecurityGroup securityGroup, String zoneId) {
- super(zoneId, checkNotNull(securityGroup, "securityGroup").getName());
- this.securityGroup = securityGroup;
- }
-
- public SecurityGroup getSecurityGroup() {
- return securityGroup;
- }
-
- // superclass hashCode/equals are good enough, and help us use ZoneAndName and ServerInZone
- // interchangeably as Map keys
-
- @Override
- public String toString() {
- return "[securityGroup=" + securityGroup + ", zoneId=" + zoneId + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ServerInZone.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ServerInZone.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ServerInZone.java
deleted file mode 100644
index 2249cf7..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ServerInZone.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain.zonescoped;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-
-/**
- * @author Adrian Cole
- */
-public class ServerInZone extends ZoneAndId {
- protected final Server server;
-
- public ServerInZone(Server server, String zoneId) {
- super(zoneId, checkNotNull(server, "server").getId());
- this.server = server;
- }
-
- public Server getServer() {
- return server;
- }
-
- // superclass hashCode/equals are good enough, and help us use ZoneAndId and ServerInZone
- // interchangeably as Map keys
-
- @Override
- public String toString() {
- return "[server=" + server + ", zoneId=" + zoneId + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndId.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndId.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndId.java
deleted file mode 100644
index 6c6f0c6..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndId.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain.zonescoped;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-
-/**
- * @author Adam Lowe
- */
-public class ZoneAndId {
- public static ZoneAndId fromSlashEncoded(String id) {
- Iterable<String> parts = Splitter.on('/').split(checkNotNull(id, "id"));
- checkArgument(Iterables.size(parts) == 2, "id must be in format zoneId/id");
- return new ZoneAndId(Iterables.get(parts, 0), Iterables.get(parts, 1));
- }
-
- public static ZoneAndId fromZoneAndId(String zoneId, String id) {
- return new ZoneAndId(zoneId, id);
- }
-
- private static String slashEncodeZoneAndId(String zoneId, String id) {
- return checkNotNull(zoneId, "zoneId") + "/" + checkNotNull(id, "id");
- }
-
- public String slashEncode() {
- return slashEncodeZoneAndId(zoneId, id);
- }
-
- protected final String zoneId;
- protected final String id;
-
- protected ZoneAndId(String zoneId, String id) {
- this.zoneId = checkNotNull(zoneId, "zoneId");
- this.id = checkNotNull(id, "id");
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(zoneId, id);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ZoneAndId other = (ZoneAndId) obj;
- return Objects.equal(zoneId, other.zoneId) && Objects.equal(id, other.id);
- }
-
- public String getZone() {
- return zoneId;
- }
-
- public String getId() {
- return id;
- }
-
- @Override
- public String toString() {
- return "[zoneId=" + zoneId + ", id=" + id + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndName.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndName.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndName.java
deleted file mode 100644
index fdb49e1..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneAndName.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain.zonescoped;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Splitter;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.Iterables;
-
-/**
- * Helpful when looking for resources by zone and name
- *
- * @author Adrian Cole
- */
-public class ZoneAndName {
-
- public static final Function<ZoneAndName, String> NAME_FUNCTION = new Function<ZoneAndName, String>() {
-
- @Override
- public String apply(ZoneAndName input) {
- return input.getName();
- }
-
- };
-
- public static final Function<ZoneAndName, String> ZONE_FUNCTION = new Function<ZoneAndName, String>() {
-
- @Override
- public String apply(ZoneAndName input) {
- return input.getZone();
- }
-
- };
-
- public static ZoneAndName fromSlashEncoded(String name) {
- Iterable<String> parts = Splitter.on('/').split(checkNotNull(name, "name"));
- checkArgument(Iterables.size(parts) == 2, "name must be in format zoneId/name");
- return new ZoneAndName(Iterables.get(parts, 0), Iterables.get(parts, 1));
- }
-
- public static ZoneAndName fromZoneAndName(String zoneId, String name) {
- return new ZoneAndName(zoneId, name);
- }
-
- private static String slashEncodeZoneAndName(String zoneId, String name) {
- return checkNotNull(zoneId, "zoneId") + "/" + checkNotNull(name, "name");
- }
-
- public String slashEncode() {
- return slashEncodeZoneAndName(zoneId, name);
- }
-
- protected final String zoneId;
- protected final String name;
-
- protected ZoneAndName(String zoneId, String name) {
- this.zoneId = checkNotNull(zoneId, "zoneId");
- this.name = checkNotNull(name, "name");
- }
-
- public String getZone() {
- return zoneId;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- ZoneAndName that = ZoneAndName.class.cast(o);
- return equal(this.zoneId, that.zoneId) && equal(this.name, that.name);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(zoneId, name);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper("").add("zoneId", zoneId).add("name", name);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneSecurityGroupNameAndPorts.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneSecurityGroupNameAndPorts.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneSecurityGroupNameAndPorts.java
deleted file mode 100644
index 4182d91..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneSecurityGroupNameAndPorts.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain.zonescoped;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * @author Adrian Cole
- */
-public class ZoneSecurityGroupNameAndPorts extends ZoneAndName {
- protected final Set<Integer> ports;
-
- public ZoneSecurityGroupNameAndPorts(String zoneId, String name, Iterable<Integer> ports) {
- super(zoneId, name);
- this.ports = ImmutableSet.<Integer> copyOf(checkNotNull(ports, "ports"));
- }
-
- public Set<Integer> getPorts() {
- return ports;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- ZoneSecurityGroupNameAndPorts that = ZoneSecurityGroupNameAndPorts.class.cast(o);
- return super.equals(that) && equal(this.ports, that.ports);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), ports);
- }
-
- @Override
- public ToStringHelper string() {
- return super.string().add("ports", ports);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
deleted file mode 100644
index c786095..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.domain.zonescoped;
-
-import com.google.common.base.Objects;
-
-/**
- * @author Inbar Stolberg
- */
-public class ZoneState {
-
- private final boolean available;
-
- protected ZoneState(boolean available) {
- this.available = available;
- }
-
- public boolean available() {
- return this.available;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(available);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this != obj) return false;
- if (obj == null || getClass() != obj.getClass()) return false;
- ZoneState that = ZoneState.class.cast(obj);
- return Objects.equal(this.available, that.available);
- }
-
- protected Objects.ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("available", available);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
deleted file mode 100644
index d248681..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.extensions;
-
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-/**
- * @author Inbar Stolberg
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
-public interface AvailabilityZoneAPI {
-
- /**
- * @return all availability zones
- */
- FluentIterable<? extends AvailabilityZone> list();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
deleted file mode 100644
index d85f305..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.openstack.nova.v2_0.extensions;
-
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.jclouds.Fallbacks;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-/**
- * @author Inbar Stolberg
- */
-
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
-@RequestFilters(AuthenticateRequest.class)
-public interface AvailabilityZoneAsyncApi {
-
- /**
- * @return all availability zones
- */
- @GET
- @Path("/os-availability-zone")
- @SelectJson("availabilityZoneInfo")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends AvailabilityZone>> list();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
deleted file mode 100644
index a249190..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-/**
- * Extension namespaces
- *
- * @author Adrian Cole
- * @see <a href= "http://nova.openstack.org/api_ext/" />
- */
-public interface ExtensionNamespaces {
- /**
- * Keypair Support
- */
- public static final String KEYPAIRS = "http://docs.openstack.org/ext/keypairs/api/v1.1";
- /**
- * Volumes support
- */
- public static final String VOLUMES = "http://docs.openstack.org/ext/volumes/api/v1.1";
- /**
- * Volume types support
- */
- public static final String VOLUME_TYPES = "http://docs.openstack.org/ext/volume_types/api/v1.1";
- /**
- * Security group support
- */
- public static final String SECURITY_GROUPS = "http://docs.openstack.org/ext/securitygroups/api/v1.1";
- /**
- * Floating IPs support
- */
- public static final String FLOATING_IPS = "http://docs.openstack.org/ext/floating_ips/api/v1.1";
- /**
- * Multiple network support
- */
- public static final String MULTINIC = "http://docs.openstack.org/ext/multinic/api/v1.1";
- /**
- * Host administration
- */
- public static final String HOSTS = "http://docs.openstack.org/ext/hosts/api/v1.1";
- /**
- * Quotas management support
- */
- public static final String QUOTAS = "http://docs.openstack.org/ext/quotas-sets/api/v1.1";
- /**
- * Instance type (flavor) extra specs
- */
- public static final String FLAVOR_EXTRA_SPECS = "http://docs.openstack.org/ext/flavor_extra_specs/api/v1.1";
- /**
- * Provide additional data for flavors
- */
- public static final String FLAVOR_EXTRA_DATA = "http://docs.openstack.org/ext/flavor_extra_data/api/v1.1";
- /**
- * Virtual interface support
- */
- public static final String VIRTUAL_INTERFACES = "http://docs.openstack.org/ext/virtual_interfaces/api/v1.1";
- /**
- * Extended support to the Create Server v1.1 API
- */
- public static final String CREATESERVEREXT = "http://docs.openstack.org/ext/createserverext/api/v1.1";
- /**
- * Virtual Storage Arrays support
- */
- public static final String VSA = "http://docs.openstack.org/ext/vsa/api/v1.1";
- /**
- * Simple tenant usage extension
- */
- public static final String SIMPLE_TENANT_USAGE = "http://docs.openstack.org/ext/os-simple-tenant-usage/api/v1.1";
- /**
- * Instance rescue mode
- */
- public static final String RESCUE = "http://docs.openstack.org/ext/rescue/api/v1.1";
- /**
- * Admin Action extension
- */
- public static final String ADMIN_ACTIONS = "http://docs.openstack.org/ext/admin-actions/api/v1.1";
-
- /**
- * Extended Server Status extension
- */
- public static final String EXTENDED_STATUS = "http://docs.openstack.org/compute/ext/extended_status/api/v1.1";
-
- /**
- * Quota Classes extension
- */
- public static final String QUOTA_CLASSES = "http://docs.openstack.org/ext/quota-classes-sets/api/v1.1";
-
- /**
- * Disk Config extension
- */
- public static final String DISK_CONFIG = "http://docs.openstack.org/compute/ext/disk_config/api/v1.1";
-
- /**
- * Aggregates extension
- */
- public static final String AGGREGATES = "http://docs.openstack.org/ext/aggregates/api/v1.1";
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApi.java
deleted file mode 100644
index 946463c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApi.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import java.util.Map;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Provide access to extra metadata for Nova flavors.
- *
- * @author Adam Lowe
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.flavorextraspecs.html"/>
- * @see org.jclouds.openstack.nova.v2_0.features.FlavorApi
- * @see org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLAVOR_EXTRA_SPECS)
-public interface FlavorExtraSpecsApi {
-
- /**
- * Retrieve all extra specs for a flavor
- *
- * @return the set of extra metadata for the flavor
- */
- Map<String, String> getMetadata(String flavorId);
-
- /**
- * Creates or updates the extra specs for a given flavor
- *
- * @param flavorId the id of the flavor to modify
- * @param specs the extra specs to apply
- */
- Boolean updateMetadata(String flavorId, Map<String, String> specs);
-
- /**
- * Return a single extra spec value
- *
- * @param flavorId the id of the flavor to modify
- * @param key the extra spec key to retrieve
- */
- String getMetadataKey(String flavorId, String key);
-
- /**
- * Creates or updates a single extra spec value
- *
- * @param flavorId the id of the flavor to modify
- * @param key the extra spec key (when creating ensure this does not include whitespace or other difficult characters)
- * @param value the value to associate with the key
- */
- Boolean updateMetadataEntry(String flavorId, String key, String value);
-
- /**
- * Deletes an extra spec
- *
- * @param flavorId the id of the flavor to modify
- * @param key the extra spec key to delete
- */
- Boolean deleteMetadataKey(String flavorId, String key);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsAsyncApi.java
deleted file mode 100644
index f788e6e..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsAsyncApi.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Unwrap;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provide access to extra metadata for Nova flavors.
- *
- * @author Adam Lowe
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.flavorextraspecs.html"/>
- * @see org.jclouds.openstack.nova.v2_0.features.FlavorApi
- * @see FlavorExtraSpecsApi
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLAVOR_EXTRA_SPECS)
-@RequestFilters(AuthenticateRequest.class)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface FlavorExtraSpecsAsyncApi {
-
- /**
- * @see FlavorExtraSpecsApi#getMetadata(String)
- */
- @Named("flavor:getmetadata")
- @GET
- @SelectJson("extra_specs")
- @Path("/flavors/{flavor_id}/os-extra_specs")
- @Fallback(EmptyMapOnNotFoundOr404.class)
- ListenableFuture<Map<String, String>> getMetadata(@PathParam("flavor_id") String flavorId);
-
- /**
- * @see FlavorExtraSpecsApi#updateMetadataEntry(String, String, String)
- */
- @Named("flavor:updatemetadata")
- @POST
- @Path("/flavors/{flavor_id}/os-extra_specs")
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<Boolean> updateMetadata(@PathParam("flavor_id") String flavorId, @PayloadParam("extra_specs") Map<String, String> specs);
-
- /**
- * @see FlavorExtraSpecsApi#getMetadataKey(String, String)
- */
- @Named("flavor:getmetadata")
- @GET
- @Path("/flavors/{flavor_id}/os-extra_specs/{key}")
- @Unwrap
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<String> getMetadataKey(@PathParam("flavor_id") String flavorId, @PathParam("key") String key);
-
- /**
- * @see FlavorExtraSpecsApi#updateMetadataEntry(String, String, String)
- */
- @Named("flavor:updatemetadata")
- @PUT
- @Path("/flavors/{flavor_id}/os-extra_specs/{key}")
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- @Payload("%7B\"{key}\":\"{value}\"%7D")
- ListenableFuture<Boolean> updateMetadataEntry(@PathParam("flavor_id") String flavorId,
- @PathParam("key") @PayloadParam("key") String key,
- @PayloadParam("value") String value);
-
- /**
- * @see FlavorExtraSpecsApi#deleteMetadataKey(String, String)
- */
- @Named("flavor:deletemetadata")
- @DELETE
- @Path("/flavors/{flavor_id}/os-extra_specs/{key}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> deleteMetadataKey(@PathParam("flavor_id") String flavorId,
- @PathParam("key") String key);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java
deleted file mode 100644
index ddf720f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Floating IPs.
- * <p/>
- *
- * @see FloatingIPAsyncApi
- * @author Jeremy Daggett
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLOATING_IPS)
-public interface FloatingIPApi {
-
- /**
- * List all Floating IP addresses
- *
- * @return all Floating IPs
- */
- FluentIterable<? extends FloatingIP> list();
-
- /**
- * Get a specific Floating IP address
- *
- * @return all Floating IPs
- */
- FloatingIP get(String id);
-
- /**
- * Allocate a Floating IP address
- *
- * @return a newly created FloatingIP
- */
- FloatingIP create();
-
- /**
- * Allocate a Floating IP address from a pool
- *
- * @param pool
- * Pool to allocate IP address from
- * @return a newly created FloatingIP
- */
- FloatingIP allocateFromPool(String pool);
-
- /**
- * Decreate a Floating IP address
- *
- * @param id
- * the Floating IP id
- */
- void delete(String id);
-
- /**
- * Add a Floating IP address to a Server
- *
- * @param serverId
- * the serverId
- * @param address
- * the IP address to add
- *
- * NOTE: Possibly move this to ServerApi?
- */
- void addToServer(String address, String serverId);
-
- /**
- * Remove a Floating IP address from a Server
- *
- * @param serverId
- * the serverId
- * @param address
- * the IP address to remove
- *
- * NOTE: Possibly move this to ServerApi?
- */
- void removeFromServer(String address, String serverId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java
deleted file mode 100644
index f6cc543..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Floating IPs via the REST API.
- * <p/>
- *
- * @see FloatingIPApi
- * @author Jeremy Daggett
- * @see ExtensionAsyncApi
- * @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
- * />
- * @see <a href="http://nova.openstack.org/api_ext" />
- * @see <a href="http://wiki.openstack.org/os_api_floating_ip"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLOATING_IPS)
-@RequestFilters(AuthenticateRequest.class)
-public interface FloatingIPAsyncApi {
-
- /**
- * @see FloatingIPApi#list
- */
- @Named("floatingip:list")
- @GET
- @Path("/os-floating-ips")
- @SelectJson("floating_ips")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends FloatingIP>> list();
-
- /**
- * @see FloatingIPApi#get
- */
- @Named("floatingip:get")
- @GET
- @Path("/os-floating-ips/{id}")
- @SelectJson("floating_ip")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends FloatingIP> get(@PathParam("id") String id);
-
- /**
- * @see FloatingIPApi#create
- */
- @Named("floatingip:create")
- @POST
- @Path("/os-floating-ips")
- @SelectJson("floating_ip")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @Payload("{}")
- ListenableFuture<? extends FloatingIP> create();
-
- /**
- * @see org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi#allocateFromPool
- */
- @Named("floatingip:create")
- @POST
- @Path("/os-floating-ips")
- @SelectJson("floating_ip")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @Payload("%7B\"pool\":\"{pool}\"%7D")
- ListenableFuture<? extends FloatingIP> allocateFromPool(@PayloadParam("pool") String pool);
-
-
- /**
- * @see FloatingIPApi#delete
- */
- @Named("floatingip:delete")
- @DELETE
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @Path("/os-floating-ips/{id}")
- ListenableFuture<Void> delete(@PathParam("id") String id);
-
- /**
- * @see FloatingIPApi#addToServer
- */
- @Named("floatingip:add")
- @POST
- @Path("/servers/{server}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"addFloatingIp\":%7B\"address\":\"{address}\"%7D%7D")
- ListenableFuture<Void> addToServer(@PayloadParam("address") String address,
- @PathParam("server") String serverId);
-
- /**
- * @see FloatingIPApi#removeFromServer
- */
- @Named("floatingip:remove")
- @POST
- @Path("/servers/{server}/action")
- @Consumes
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"removeFloatingIp\":%7B\"address\":\"{address}\"%7D%7D")
- ListenableFuture<Void> removeFromServer(@PayloadParam("address") String address,
- @PathParam("server") String serverId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java
deleted file mode 100644
index 95b8f42..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.Host;
-import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides asynchronous access to Host Administration features via the REST API.
- * <p/>
- *
- * @author Adam Lowe
- * @see HostAdministrationAsyncApi
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.HOSTS)
-public interface HostAdministrationApi {
-
- /**
- * Returns the list of hosts
- *
- * @return the usage information
- */
- FluentIterable<? extends Host> list();
-
- /**
- * Retrieves the physical/usage resource on a specific host
- *
- * @return the usage information
- */
- FluentIterable<? extends HostResourceUsage> listResourceUsage(String hostId);
-
- /**
- * Allow the specified host to accept new instances.
- *
- * @return true if successful
- */
- boolean enable(String hostId);
-
- /**
- * Prevent the specified host from accepting new instances.
- *
- * @return true if successful
- */
- boolean disable(String hostId);
-
- /**
- * Start host maintenance window.
- * <p/>
- * Note: this triggers guest VMs evacuation.
- *
- * @return true if successful
- */
- boolean startMaintenance(String hostId);
-
- /**
- * Stop host maintenance window.
- *
- * @return true if successful
- */
- boolean stopMaintenance(String hostId);
-
- /**
- * Startup a host.
- *
- * @return true if successful
- */
- boolean startup(String hostId);
-
- /**
- * Shutdown a host.
- *
- * @return true if successful
- */
- boolean shutdown(String hostId);
-
- /**
- * Reboot a host.
- *
- * @return true if successful
- */
- boolean reboot(String hostId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java
deleted file mode 100644
index cf066c2..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.Host;
-import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
-import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.MaintenanceModeDisabledResponseParser;
-import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.MaintenanceModeEnabledResponseParser;
-import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.PowerIsRebootResponseParser;
-import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.PowerIsShutdownResponseParser;
-import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.PowerIsStartupResponseParser;
-import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.StatusDisabledResponseParser;
-import org.jclouds.openstack.nova.v2_0.functions.FieldValueResponseParsers.StatusEnabledResponseParser;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Host Administration features via the REST API.
- * <p/>
- *
- * @author Adam Lowe
- * @see HostAdministrationApi
- * @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"/>
- * @see <a href="http://nova.openstack.org/api_ext" />
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.hosts.html" />
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.HOSTS)
-@RequestFilters(AuthenticateRequest.class)
-@Path("/os-hosts")
-@Consumes(MediaType.APPLICATION_JSON)
-public interface HostAdministrationAsyncApi {
-
- /**
- * @see HostAdministrationApi#list()
- */
- @Named("hostadmin:list")
- @GET
- @SelectJson("hosts")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends Host>> list();
-
- /**
- * @see HostAdministrationApi#listResourceUsage(String)
- */
- @Named("hostadmin:listresource")
- @GET
- @Path("/{id}")
- @SelectJson("host")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends HostResourceUsage>> listResourceUsage(@PathParam("id") String hostId);
-
- /**
- * @see HostAdministrationApi#enable(String)
- */
- @Named("hostadmin:enable")
- @PUT
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/{id}")
- @Payload("{\"status\":\"enable\"}")
- @ResponseParser(StatusEnabledResponseParser.class)
- ListenableFuture<Boolean> enable(@PathParam("id") String hostId);
-
- /**
- * @see HostAdministrationApi#disable(String)
- */
- @Named("hostadmin:disable")
- @PUT
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/{id}")
- @Payload("{\"status\":\"disable\"}")
- @ResponseParser(StatusDisabledResponseParser.class)
- ListenableFuture<Boolean> disable(@PathParam("id") String hostId);
-
- /**
- * @see HostAdministrationApi#startMaintenance(String)
- */
- @Named("hostadmin:startmaintenance")
- @PUT
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/{id}")
- @Payload("{\"maintenance_mode\":\"enable\"}")
- @ResponseParser(MaintenanceModeEnabledResponseParser.class)
- ListenableFuture<Boolean> startMaintenance(@PathParam("id") String hostId);
-
- /**
- * @see HostAdministrationApi#stopMaintenance(String)
- */
- @Named("hostadmin:stopmaintenance")
- @PUT
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/{id}")
- @Payload("{\"maintenance_mode\":\"disable\"}")
- @ResponseParser(MaintenanceModeDisabledResponseParser.class)
- ListenableFuture<Boolean> stopMaintenance(@PathParam("id") String hostId);
-
- /**
- * @see HostAdministrationApi#startup(String)
- */
- @Named("hostadmin:startup")
- @GET
- @Path("/{id}/startup")
- @ResponseParser(PowerIsStartupResponseParser.class)
- ListenableFuture<Boolean> startup(@PathParam("id") String hostId);
-
- /**
- * @see HostAdministrationApi#shutdown(String)
- */
- @Named("hostadmin:shutdown")
- @GET
- @Path("/{id}/shutdown")
- @ResponseParser(PowerIsShutdownResponseParser.class)
- ListenableFuture<Boolean> shutdown(@PathParam("id") String hostId);
-
- /**
- * @see HostAdministrationApi#reboot(String)
- */
- @Named("hostadmin:reboot")
- @GET
- @Path("/{id}/reboot")
- @ResponseParser(PowerIsRebootResponseParser.class)
- ListenableFuture<Boolean> reboot(@PathParam("id") String hostId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java
deleted file mode 100644
index a6461aa..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import java.util.Map;
-import org.jclouds.openstack.nova.v2_0.domain.HostAggregate;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provide access to Host Aggregates in Nova (alias "OS-AGGREGATES")
- *
- * @author Adam Lowe
- * @see HostAggregateAsyncApi
- * @see <a href="http://nova.openstack.org/api_ext/ext_aggregates.html"/>
- * @see <a href="http://wiki.openstack.org/host-aggregates"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.AGGREGATES)
-public interface HostAggregateApi {
-
- /**
- * @return the set of host aggregates.
- */
- FluentIterable<? extends HostAggregate> list();
-
- /**
- * Retrieves the details of an aggregate, hosts and metadata included.
- *
- * @return the details of the aggregate requested.
- */
- HostAggregate get(String id);
-
- /**
- * Creates an aggregate, given its name and availability zone.
- *
- * @return the newly created Aggregate
- */
- HostAggregate createInAvailabilityZone(String name, String availabilityZone);
-
- /**
- * Updates the name of an aggregate.
- */
- HostAggregate updateName(String id, String name);
-
- /**
- * Updates the availability zone an aggregate.
- */
- HostAggregate updateAvailabilityZone(String id, String availabilityZone);
-
- /**
- * Removes an aggregate.
- */
- Boolean delete(String id);
-
- /**
- * Adds a host to an aggregate
- */
- HostAggregate addHost(String id, String host);
-
- /**
- * Removes a host from an aggregate
- */
- HostAggregate removeHost(String id, String host);
-
- /**
- * Adds metadata to an aggregate
- */
- HostAggregate setMetadata(String id, Map<String, String> metadata);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java
deleted file mode 100644
index 1ee3dc7..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.HostAggregate;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provide access to Aggregates in Nova.
- *
- * @author Adam Lowe
- * @see HostAggregateApi
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.AGGREGATES)
-@RequestFilters(AuthenticateRequest.class)
-@Path("/os-aggregates")
-public interface HostAggregateAsyncApi {
-
- /**
- * @see HostAggregateApi#list()
- */
- @Named("hostaggregate:list")
- @GET
- @SelectJson("aggregates")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends HostAggregate>> list();
-
- /**
- * @see HostAggregateApi#get(String)
- */
- @Named("hostaggregate:get")
- @GET
- @Path("/{id}")
- @SelectJson("aggregate")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends HostAggregate> get(@PathParam("id") String id);
-
- /**
- * @see HostAggregateApi#createInAvailabilityZone(String, String)
- */
- @Named("hostaggregate:create")
- @POST
- @SelectJson("aggregate")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @WrapWith("aggregate")
- ListenableFuture<? extends HostAggregate> createInAvailabilityZone(@PayloadParam("name") String name,
- @PayloadParam("availability_zone") String availabilityZone);
-
- /**
- * @see HostAggregateApi#updateName
- */
- @Named("hostaggregate:update")
- @POST
- @Path("/{id}")
- @SelectJson("aggregate")
- @Consumes(MediaType.APPLICATION_JSON)
- @WrapWith("aggregate")
- ListenableFuture<? extends HostAggregate> updateName(@PathParam("id") String id, @PayloadParam("name") String name);
-
- /**
- * @see HostAggregateApi#updateAvailabilityZone
- */
- @Named("hostaggregate:update")
- @POST
- @Path("/{id}")
- @SelectJson("aggregate")
- @Consumes(MediaType.APPLICATION_JSON)
- @WrapWith("aggregate")
- ListenableFuture<? extends HostAggregate> updateAvailabilityZone(@PathParam("id") String id, @PayloadParam("availability_zone") String availabilityZone);
-
- /**
- * @see HostAggregateApi#delete(String)
- */
- @Named("hostaggregate:delete")
- @DELETE
- @Path("/{id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@PathParam("id") String id);
-
- /**
- * @see HostAggregateApi#addHost(String,String)
- */
- @Named("hostaggregate:addhost")
- @POST
- @Path("/{id}/action")
- @SelectJson("aggregate")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @WrapWith("add_host")
- ListenableFuture<? extends HostAggregate> addHost(@PathParam("id") String id, @PayloadParam("host") String host);
-
-
- /**
- * @see HostAggregateApi#removeHost(String,String)
- */
- @Named("hostaggregate:removehost")
- @POST
- @Path("/{id}/action")
- @SelectJson("aggregate")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @WrapWith("remove_host")
- ListenableFuture<? extends HostAggregate> removeHost(@PathParam("id") String id, @PayloadParam("host") String host);
-
- /**
- * @see HostAggregateApi#setMetadata
- */
- @Named("hostaggregate:setmetadata")
- @POST
- @Path("/{id}/action")
- @SelectJson("aggregate")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @WrapWith("set_metadata")
- ListenableFuture<? extends HostAggregate> setMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map<String, String> metadata);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java
deleted file mode 100644
index 6b4af7b..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Security Groups.
- * <p/>
- *
- * @see KeyPairAsyncApi
- * @author Jeremy Daggett
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.KEYPAIRS)
-public interface KeyPairApi {
-
- /**
- * List all Key Pairs.
- *
- * @return all Key Pairs
- */
- FluentIterable<? extends KeyPair> list();
-
- /**
- * Create a Key Pair.
- *
- * @return a Key Pair
- */
- KeyPair create(String name);
-
- /**
- * Create a Key Pair with a public key.
- *
- * @return a Key Pair with a public key.
- */
- KeyPair createWithPublicKey(String name, String publicKey);
-
- /**
- * Delete a Key Pairs.
- *
- * @return
- */
- boolean delete(String name);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java
deleted file mode 100644
index 246aec8..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.binders.BindKeyPairToJsonPayload;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.functions.internal.ParseKeyPairs;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Key Pairs via the REST API.
- * <p/>
- *
- * @see KeyPairApi
- * @author Jeremy Daggett
- * @see ExtensionAsyncApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
- * />
- * @see <a href="http://nova.openstack.org/api_ext" />
- * @see <a href="http://nova.openstack.org/api_ext/ext_keypairs.html" />
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.KEYPAIRS)
-@RequestFilters(AuthenticateRequest.class)
-public interface KeyPairAsyncApi {
-
- @Named("keypair:list")
- @GET
- @Path("/os-keypairs")
- @ResponseParser(ParseKeyPairs.class)
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends KeyPair>> list();
-
- @Named("keypair:create")
- @POST
- @Path("/os-keypairs")
- @SelectJson("keypair")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"keypair\":%7B\"name\":\"{name}\"%7D%7D")
- ListenableFuture<? extends KeyPair> create(@PayloadParam("name") String name);
-
- @Named("keypair:create")
- @POST
- @Path("/os-keypairs")
- @SelectJson("keypair")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @MapBinder(BindKeyPairToJsonPayload.class)
- ListenableFuture<? extends KeyPair> createWithPublicKey(@PayloadParam("name") String name,
- @PayloadParam("public_key") String publicKey);
-
- @Named("keypair:delete")
- @DELETE
- @Path("/os-keypairs/{name}")
- @Fallback(FalseOnNotFoundOr404.class)
- @Consumes
- ListenableFuture<Boolean> delete(@PathParam("name") String name);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApi.java
deleted file mode 100644
index ea59d0f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApi.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.Quota;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-
-/**
- * The quotas extension enables limiters placed on the resources used per tenant (project) for virtual instances. It is
- * used with the OpenStack Compute API 1.1 for administrators who need to control the amount of volumes, memory, floating
- * IP addresses, instances, or cores allowed within a defined tenant or project.
- * <p/>
- * To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas.
- *
- * @author Adam Lowe
- * @see QuotaAsyncApi
- * @see <a href="http://nova.openstack.org/api_ext/ext_quotas.html"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTAS)
-public interface QuotaApi {
-
- /**
- * @return the quota settings for the tenant
- */
- Quota getByTenant(String tenantId);
-
- /**
- * Update the quotas for a given tenant
- *
- * @return true if successful
- */
- boolean updateQuotaOfTenant(Quota quota, String tenantId);
-
- /**
- * @return the set of default quotas for the tenant
- */
- Quota getDefaultsForTenant(String tenantId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java
deleted file mode 100644
index b364fcb..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.Quota;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provide access to Quota information for Nova tenants.
- *
- * @author Adam Lowe
- * @see QuotaApi
- * @see <a href="http://nova.openstack.org/api_ext/ext_quotas.html"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTAS)
-@RequestFilters(AuthenticateRequest.class)
-@Path("/os-quota-sets")
-public interface QuotaAsyncApi {
-
- /**
- * @see QuotaApi#getDefaultsForTenant(String)
- */
- @Named("quota:get")
- @GET
- @SelectJson("quota_set")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/{tenant_id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Quota> getByTenant(@PathParam("tenant_id") String tenantId);
-
- /**
- * @see QuotaApi#updateQuotaOfTenant
- */
- @Named("quota:update")
- @PUT
- @Path("/{tenant_id}")
- @Produces(MediaType.APPLICATION_JSON)
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<Boolean> updateQuotaOfTenant(@PayloadParam("quota_set") Quota quota,
- @PathParam("tenant_id") String tenantId);
-
- /**
- * @see QuotaApi#getDefaultsForTenant(String)
- */
- @Named("quota:get")
- @GET
- @SelectJson("quota_set")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/{tenant_id}/defaults")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Quota> getDefaultsForTenant(@PathParam("tenant_id") String tenantId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java
deleted file mode 100644
index 4a6c010..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import org.jclouds.openstack.nova.v2_0.domain.QuotaClass;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Provides synchronous access to Quota Classes via the REST API.
- * <p/>
- * To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas.
- *
- * @author Adam Lowe
- * @see QuotaClassAsyncApi
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.quota_classes.html"/>
- * @see <a href="http://wiki.openstack.org/QuotaClass"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTA_CLASSES)
-public interface QuotaClassApi {
-
- /**
- * @return the quota settings for the tenant
- */
- QuotaClass get(String id);
-
- /**
- * Update the quotas for a given tenant
- *
- * @return true if successful
- */
- boolean update(String id, QuotaClass quotas);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java
deleted file mode 100644
index f07148f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.nova.v2_0.domain.QuotaClass;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Quota Classes via the REST API.
- *
- * @author Adam Lowe
- * @see QuotaClassApi
- * @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.quota_classes.html"/>
- * @see <a href="http://wiki.openstack.org/QuotaClass"/>
- */
-@Beta
-@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTA_CLASSES)
-@RequestFilters(AuthenticateRequest.class)
-@Path("/os-quota-class-sets")
-public interface QuotaClassAsyncApi {
-
- /**
- * @see QuotaClassApi#get
- */
- @Named("quotaclass:get")
- @GET
- @SelectJson("quota_class_set")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends QuotaClass> get(@PathParam("id") String id);
-
- /**
- * @see QuotaClassApi#update
- */
- @Named("quotaclass:update")
- @PUT
- @Path("/{id}")
- @Produces(MediaType.APPLICATION_JSON)
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<Boolean> update(@PathParam("id") String id, @PayloadParam("quota_class_set") QuotaClass quotas);
-
-}
[48/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java
new file mode 100644
index 0000000..b85dfd4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java
@@ -0,0 +1,649 @@
+/*
+ * 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.openstack.nova.v2_0.compute.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Strings.emptyToNull;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Set;
+
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.openstack.nova.v2_0.domain.Network;
+import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
+import org.jclouds.scriptbuilder.domain.Statement;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Contains options supported in the {@code ComputeService#runNode} operation on the
+ * "openstack-nova" provider. <h2>Usage</h2> The recommended way to instantiate a
+ * NovaTemplateOptions object is to statically import NovaTemplateOptions.* and invoke a static
+ * creation method followed by an instance mutator (if needed):
+ * <p/>
+ * <code>
+ * import static org.jclouds.aws.ec2.compute.options.NovaTemplateOptions.Builder.*;
+ * <p/>
+ * ComputeService api = // get connection
+ * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
+ * Set<? extends NodeMetadata> set = api.createNodesInGroup(tag, 2, templateBuilder.build());
+ * <code>
+ *
+ * @author Adam Lowe
+ */
+public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
+ @Override
+ public NovaTemplateOptions clone() {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ copyTo(options);
+ return options;
+ }
+
+ @Override
+ public void copyTo(TemplateOptions to) {
+ super.copyTo(to);
+ if (to instanceof NovaTemplateOptions) {
+ NovaTemplateOptions eTo = NovaTemplateOptions.class.cast(to);
+ eTo.autoAssignFloatingIp(shouldAutoAssignFloatingIp());
+ if (getSecurityGroupNames().isPresent())
+ eTo.securityGroupNames(getSecurityGroupNames().get());
+ eTo.generateKeyPair(shouldGenerateKeyPair());
+ eTo.keyPairName(getKeyPairName());
+ eTo.availabilityZone(getAvailabilityZone());
+ if (getUserData() != null) {
+ eTo.userData(getUserData());
+ }
+ if (getDiskConfig() != null) {
+ eTo.diskConfig(getDiskConfig());
+ }
+
+ eTo.configDrive(getConfigDrive());
+ eTo.novaNetworks(getNovaNetworks());
+ }
+ }
+
+ protected boolean autoAssignFloatingIp = false;
+ protected Optional<Set<String>> securityGroupNames = Optional.absent();
+ protected boolean generateKeyPair = false;
+ protected String keyPairName;
+ protected byte[] userData;
+ protected String diskConfig;
+ protected boolean configDrive;
+ protected String availabilityZone;
+ protected Set<Network> novaNetworks;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ NovaTemplateOptions that = NovaTemplateOptions.class.cast(o);
+ return super.equals(that) && equal(this.autoAssignFloatingIp, that.autoAssignFloatingIp)
+ && equal(this.securityGroupNames, that.securityGroupNames)
+ && equal(this.generateKeyPair, that.generateKeyPair)
+ && equal(this.keyPairName, that.keyPairName)
+ && Arrays.equals(this.userData, that.userData)
+ && equal(this.diskConfig, that.diskConfig)
+ && equal(this.configDrive, that.configDrive)
+ && equal(this.availabilityZone, that.availabilityZone)
+ && equal(this.novaNetworks, that.novaNetworks);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), autoAssignFloatingIp, securityGroupNames, generateKeyPair, keyPairName, userData, diskConfig, configDrive,availabilityZone, novaNetworks);
+ }
+
+ @Override
+ public ToStringHelper string() {
+ ToStringHelper toString = super.string();
+ if (!autoAssignFloatingIp)
+ toString.add("autoAssignFloatingIp", autoAssignFloatingIp);
+ if (securityGroupNames.isPresent())
+ toString.add("securityGroupNames", securityGroupNames.get());
+ if (generateKeyPair)
+ toString.add("generateKeyPair", generateKeyPair);
+ toString.add("keyPairName", keyPairName);
+ toString.add("userData", userData);
+ toString.add("diskConfig", diskConfig);
+ toString.add("configDrive", configDrive);
+ toString.add("availabilityZone", availabilityZone);
+ toString.add("novaNetworks", novaNetworks);
+ return toString;
+ }
+
+ public static final NovaTemplateOptions NONE = new NovaTemplateOptions();
+
+ /**
+ * @see #shouldAutoAssignFloatingIp()
+ */
+ public NovaTemplateOptions autoAssignFloatingIp(boolean enable) {
+ this.autoAssignFloatingIp = enable;
+ return this;
+ }
+
+ /**
+ * @see #shouldGenerateKeyPair()
+ */
+ public NovaTemplateOptions generateKeyPair(boolean enable) {
+ this.generateKeyPair = enable;
+ return this;
+ }
+
+ /**
+ * @see #shouldGenerateKeyPair()
+ */
+ public NovaTemplateOptions keyPairName(String keyPairName) {
+ this.keyPairName = keyPairName;
+ return this;
+ }
+
+ /**
+ * set availability zone
+ */
+ public NovaTemplateOptions availabilityZone(String zone) {
+ this.availabilityZone = zone;
+ return this;
+ }
+
+
+ /**
+ *
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
+ */
+ public NovaTemplateOptions securityGroupNames(String... securityGroupNames) {
+ return securityGroupNames(ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames")));
+ }
+
+ /**
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
+ */
+ public NovaTemplateOptions securityGroupNames(Iterable<String> securityGroupNames) {
+ for (String groupName : checkNotNull(securityGroupNames, "securityGroupNames"))
+ checkNotNull(emptyToNull(groupName), "all security groups must be non-empty");
+ this.securityGroupNames = Optional.<Set<String>> of(ImmutableSet.copyOf(securityGroupNames));
+ return this;
+ }
+
+ /**
+ * <h3>Note</h3>
+ *
+ * This requires that {@link NovaApi#getExtensionForZone(String)} to return
+ * {@link Optional#isPresent present}
+ *
+ * @return true if auto assignment of a floating ip to each vm is enabled
+ */
+ public boolean shouldAutoAssignFloatingIp() {
+ return autoAssignFloatingIp;
+ }
+
+ /**
+ * Specifies the keypair used to run instances with
+ * @return the keypair to be used
+ */
+ public String getKeyPairName() {
+ return keyPairName;
+ }
+
+ /**
+ * Specifies the availability zone used to run instances with
+ * @return the availability zone to be used
+ */
+ public String getAvailabilityZone() {
+ return availabilityZone;
+ }
+
+
+ /**
+ * <h3>Note</h3>
+ *
+ * This requires that {@link NovaApi#getKeyPairExtensionForZone(String)} to return
+ * {@link Optional#isPresent present}
+ *
+ * @return true if auto generation of keypairs is enabled
+ */
+ public boolean shouldGenerateKeyPair() {
+ return generateKeyPair;
+ }
+
+ /**
+ * if unset, generate a default group prefixed with {@link jclouds#} according
+ * to {@link #getInboundPorts()}
+ *
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
+ */
+ public Optional<Set<String>> getSecurityGroupNames() {
+ return securityGroupNames;
+ }
+
+ public byte[] getUserData() {
+ return userData;
+ }
+
+ /**
+ * @see CreateServerOptions#getDiskConfig()
+ */
+ public String getDiskConfig() {
+ return diskConfig;
+ }
+
+ /**
+ * @see CreateServerOptions#getConfigDrive()
+ */
+ public boolean getConfigDrive() {
+ return configDrive;
+ }
+
+ /**
+ * @see CreateServerOptions#getNetworks()
+ */
+ public Set<Network> getNovaNetworks() {
+ return novaNetworks;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see NovaTemplateOptions#shouldAutoAssignFloatingIp()
+ */
+ public static NovaTemplateOptions autoAssignFloatingIp(boolean enable) {
+ return new NovaTemplateOptions().autoAssignFloatingIp(enable);
+ }
+
+ /**
+ * @see NovaTemplateOptions#shouldGenerateKeyPair()
+ */
+ public static NovaTemplateOptions generateKeyPair(boolean enable) {
+ return new NovaTemplateOptions().generateKeyPair(enable);
+ }
+
+ /**
+ * @see NovaTemplateOptions#getKeyPairName()
+ */
+ public static NovaTemplateOptions keyPairName(String keyPairName) {
+ return new NovaTemplateOptions().keyPairName(keyPairName);
+ }
+
+ /**
+ * @see NovaTemplateOptions#getAvailabilityZone()
+ */
+ public static NovaTemplateOptions availabilityZone(String zone) {
+ return new NovaTemplateOptions().availabilityZone(zone);
+ }
+
+ /**
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
+ */
+ public static NovaTemplateOptions securityGroupNames(String... groupNames) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.securityGroupNames(groupNames));
+ }
+
+ /**
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
+ */
+ public static NovaTemplateOptions securityGroupNames(Iterable<String> groupNames) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.securityGroupNames(groupNames));
+ }
+
+ // methods that only facilitate returning the correct object type
+
+ /**
+ * @see TemplateOptions#inboundPorts
+ */
+ public static NovaTemplateOptions inboundPorts(int... ports) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.inboundPorts(ports));
+ }
+
+ /**
+ * @see TemplateOptions#port
+ */
+ public static NovaTemplateOptions blockOnPort(int port, int seconds) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.blockOnPort(port, seconds));
+ }
+
+ /**
+ * @see TemplateOptions#installPrivateKey
+ */
+ public static NovaTemplateOptions installPrivateKey(String rsaKey) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.installPrivateKey(rsaKey));
+ }
+
+ /**
+ * @see TemplateOptions#authorizePublicKey
+ */
+ public static NovaTemplateOptions authorizePublicKey(String rsaKey) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
+ }
+
+ /**
+ * @see TemplateOptions#userMetadata
+ */
+ public static NovaTemplateOptions userMetadata(Map<String, String> userMetadata) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.userMetadata(userMetadata));
+ }
+
+ /**
+ * @see TemplateOptions#nodeNames(Iterable)
+ */
+ public static NovaTemplateOptions nodeNames(Iterable<String> nodeNames) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.nodeNames(nodeNames));
+ }
+
+ /**
+ * @see TemplateOptions#networks(Iterable)
+ */
+ public static NovaTemplateOptions networks(Iterable<String> networks) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.networks(networks));
+ }
+
+ /**
+ * @see TemplateOptions#overrideLoginUser
+ */
+ public static NovaTemplateOptions overrideLoginUser(String user) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return options.overrideLoginUser(user);
+ }
+
+ /**
+ * @see TemplateOptions#overrideLoginPassword
+ */
+ public static NovaTemplateOptions overrideLoginPassword(String password) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return options.overrideLoginPassword(password);
+ }
+
+ /**
+ * @see TemplateOptions#overrideLoginPrivateKey
+ */
+ public static NovaTemplateOptions overrideLoginPrivateKey(String privateKey) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return options.overrideLoginPrivateKey(privateKey);
+ }
+
+ /**
+ * @see TemplateOptions#overrideAuthenticateSudo
+ */
+ public static NovaTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return options.overrideAuthenticateSudo(authenticateSudo);
+ }
+
+ /**
+ * @see TemplateOptions#overrideLoginCredentials
+ */
+ public static NovaTemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return options.overrideLoginCredentials(credentials);
+ }
+
+ /**
+ * @see TemplateOptions#blockUntilRunning
+ */
+ public static NovaTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return options.blockUntilRunning(blockUntilRunning);
+ }
+
+ /**
+ * @see NovaTemplateOptions#userData
+ */
+ public static NovaTemplateOptions userData(byte[] userData) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.userData(userData));
+ }
+
+ /**
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getDiskConfig()
+ */
+ public static NovaTemplateOptions diskConfig(String diskConfig) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.diskConfig(diskConfig));
+ }
+
+ /**
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getConfigDrive()
+ */
+ public static NovaTemplateOptions configDrive(boolean configDrive) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.configDrive(configDrive));
+ }
+
+ /**
+ * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getNetworks()
+ */
+ public static NovaTemplateOptions novaNetworks(Set<Network> novaNetworks) {
+ NovaTemplateOptions options = new NovaTemplateOptions();
+ return NovaTemplateOptions.class.cast(options.novaNetworks(novaNetworks));
+ }
+ }
+
+ // methods that only facilitate returning the correct object type
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions blockOnPort(int port, int seconds) {
+ return NovaTemplateOptions.class.cast(super.blockOnPort(port, seconds));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions inboundPorts(int... ports) {
+ return NovaTemplateOptions.class.cast(super.inboundPorts(ports));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions authorizePublicKey(String publicKey) {
+ return NovaTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions installPrivateKey(String privateKey) {
+ return NovaTemplateOptions.class.cast(super.installPrivateKey(privateKey));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
+ return NovaTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions dontAuthorizePublicKey() {
+ return NovaTemplateOptions.class.cast(super.dontAuthorizePublicKey());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions nameTask(String name) {
+ return NovaTemplateOptions.class.cast(super.nameTask(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions runAsRoot(boolean runAsRoot) {
+ return NovaTemplateOptions.class.cast(super.runAsRoot(runAsRoot));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions runScript(Statement script) {
+ return NovaTemplateOptions.class.cast(super.runScript(script));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
+ return NovaTemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions overrideLoginPassword(String password) {
+ return NovaTemplateOptions.class.cast(super.overrideLoginPassword(password));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions overrideLoginPrivateKey(String privateKey) {
+ return NovaTemplateOptions.class.cast(super.overrideLoginPrivateKey(privateKey));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions overrideLoginUser(String loginUser) {
+ return NovaTemplateOptions.class.cast(super.overrideLoginUser(loginUser));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
+ return NovaTemplateOptions.class.cast(super.overrideAuthenticateSudo(authenticateSudo));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions userMetadata(Map<String, String> userMetadata) {
+ return NovaTemplateOptions.class.cast(super.userMetadata(userMetadata));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions userMetadata(String key, String value) {
+ return NovaTemplateOptions.class.cast(super.userMetadata(key, value));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NovaTemplateOptions nodeNames(Iterable<String> nodeNames) {
+ return NovaTemplateOptions.class.cast(super.nodeNames(nodeNames));
+ }
+
+ /**
+ * <br>Ensures NovaTemplateOptions can work with networks specified as Strings.
+ * Also provides for compatibility with the abstraction layer.
+ */
+ @Override
+ public NovaTemplateOptions networks(Iterable<String> networks) {
+ return NovaTemplateOptions.class.cast(super.networks(networks));
+ }
+
+ /**
+ * <br>Ensures NovaTemplateOptions can work with networks specified as Strings.
+ * Also provides for compatibility with the abstraction layer.
+ */
+ @Override
+ public NovaTemplateOptions networks(String... networks) {
+ return NovaTemplateOptions.class.cast(super.networks(networks));
+ }
+
+ /**
+ * User data as bytes (not base64-encoded)
+ */
+ public NovaTemplateOptions userData(byte[] userData) {
+ // This limit may not be needed for nova
+ checkArgument(checkNotNull(userData, "userData").length <= 16 * 1024,
+ "userData cannot be larger than 16kb");
+ this.userData = userData;
+ return this;
+ }
+
+ /**
+ * @see CreateServerOptions#getDiskConfig()
+ */
+ public NovaTemplateOptions diskConfig(String diskConfig) {
+ this.diskConfig = diskConfig;
+ return this;
+ }
+
+ /**
+ * OpenStack can be configured to write metadata to a special configuration drive that will be
+ * attached to the instance when it boots. The instance can retrieve any information that would
+ * normally be available through the metadata service by mounting this disk and reading files from it.
+ * To enable the config drive, set this parameter to "true".
+ * This has to be enabled for user data cases.
+ * @see CreateServerOptions#getConfigDrive()
+ */
+ public NovaTemplateOptions configDrive(boolean configDrive) {
+ this.configDrive = configDrive;
+ return this;
+ }
+
+ /**
+ * @param novaNetworks The list of network declarations.
+ * Nova-specific network declarations allow for specifying network UUIDs, port UUIDs, and fixed IPs.
+ * Unline {@link #networks(Iterable)} this supports setting additional network parameters and not just network UUIDs.
+ * @see CreateServerOptions#getNetworks()
+ */
+ public NovaTemplateOptions novaNetworks(Set<Network> novaNetworks) {
+ this.novaNetworks = novaNetworks;
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
new file mode 100644
index 0000000..680a82c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
@@ -0,0 +1,56 @@
+/*
+ * 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.openstack.nova.v2_0.compute.predicates;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Predicates.and;
+import static com.google.common.collect.Iterables.all;
+import static org.jclouds.compute.predicates.NodePredicates.TERMINATED;
+import static org.jclouds.compute.predicates.NodePredicates.inGroup;
+import static org.jclouds.compute.predicates.NodePredicates.locationId;
+import static org.jclouds.compute.predicates.NodePredicates.parentLocationId;
+
+import javax.inject.Inject;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.ComputeMetadata;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+/**
+ * @author Adrian Cole
+ */
+public class AllNodesInGroupTerminated implements Predicate<ZoneAndName> {
+ private final ComputeService computeService;
+
+
+ //TODO: TESTME
+ @Inject
+ public AllNodesInGroupTerminated(ComputeService computeService) {
+ this.computeService = checkNotNull(computeService, "computeService");
+ }
+
+ @Override
+ public boolean apply(ZoneAndName input) {
+ // new nodes can have the zone as their location, existing nodes, the parent is the
+ // location
+ return all(computeService.listNodesDetailsMatching(Predicates.<ComputeMetadata> or(locationId(input.getZone()),
+ parentLocationId(input.getZone()))), and(inGroup(input.getName()), TERMINATED));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/strategy/ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/strategy/ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/strategy/ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
new file mode 100644
index 0000000..e3ea4cc
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/strategy/ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
@@ -0,0 +1,165 @@
+/*
+ * 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.openstack.nova.v2_0.compute.strategy;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.ssh.SshKeys.fingerprintPrivateKey;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.compute.config.CustomizationResponse;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
+import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
+import org.jclouds.compute.strategy.ListNodesStrategy;
+import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.compute.functions.AllocateAndAddFloatingIpToNode;
+import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
+
+import com.google.common.base.Throwables;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.Multimap;
+import com.google.common.primitives.Ints;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet extends
+ CreateNodesWithGroupEncodedIntoNameThenAddToSet {
+
+ private final AllocateAndAddFloatingIpToNode createAndAddFloatingIpToNode;
+ private final LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupCache;
+ private final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
+ private final NovaApi novaApi;
+
+ @Inject
+ protected ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(
+ CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
+ ListNodesStrategy listNodesStrategy,
+ GroupNamingConvention.Factory namingConvention,
+ CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
+ @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
+ AllocateAndAddFloatingIpToNode createAndAddFloatingIpToNode,
+ LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupCache,
+ LoadingCache<ZoneAndName, KeyPair> keyPairCache, NovaApi novaApi) {
+ super(addNodeWithTagStrategy, listNodesStrategy, namingConvention, userExecutor,
+ customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
+ this.securityGroupCache = checkNotNull(securityGroupCache, "securityGroupCache");
+ this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
+ this.createAndAddFloatingIpToNode = checkNotNull(createAndAddFloatingIpToNode,
+ "createAndAddFloatingIpToNode");
+ this.novaApi = checkNotNull(novaApi, "novaApi");
+ }
+
+ @Override
+ public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
+ Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
+
+ Template mutableTemplate = template.clone();
+
+ NovaTemplateOptions templateOptions = NovaTemplateOptions.class.cast(mutableTemplate.getOptions());
+
+ assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
+
+ String zone = mutableTemplate.getLocation().getId();
+
+ if (templateOptions.shouldAutoAssignFloatingIp()) {
+ checkArgument(novaApi.getFloatingIPExtensionForZone(zone).isPresent(),
+ "Floating IPs are required by options, but the extension is not available! options: %s",
+ templateOptions);
+ }
+
+ boolean keyPairExtensionPresent = novaApi.getKeyPairExtensionForZone(zone).isPresent();
+ if (templateOptions.shouldGenerateKeyPair()) {
+ checkArgument(keyPairExtensionPresent,
+ "Key Pairs are required by options, but the extension is not available! options: %s", templateOptions);
+ KeyPair keyPair = keyPairCache.getUnchecked(ZoneAndName.fromZoneAndName(zone, namingConvention.create()
+ .sharedNameForGroup(group)));
+ keyPairCache.asMap().put(ZoneAndName.fromZoneAndName(zone, keyPair.getName()), keyPair);
+ templateOptions.keyPairName(keyPair.getName());
+ } else if (templateOptions.getKeyPairName() != null) {
+ checkArgument(keyPairExtensionPresent,
+ "Key Pairs are required by options, but the extension is not available! options: %s", templateOptions);
+ if (templateOptions.getLoginPrivateKey() != null) {
+ String pem = templateOptions.getLoginPrivateKey();
+ KeyPair keyPair = KeyPair.builder().name(templateOptions.getKeyPairName())
+ .fingerprint(fingerprintPrivateKey(pem)).privateKey(pem).build();
+ keyPairCache.asMap().put(ZoneAndName.fromZoneAndName(zone, keyPair.getName()), keyPair);
+ }
+ }
+
+ boolean securityGroupExtensionPresent = novaApi.getSecurityGroupExtensionForZone(zone).isPresent();
+ List<Integer> inboundPorts = Ints.asList(templateOptions.getInboundPorts());
+ if (templateOptions.getSecurityGroupNames().isPresent()
+ && templateOptions.getSecurityGroupNames().get().size() > 0) {
+ checkArgument(securityGroupExtensionPresent,
+ "Security groups are required by options, but the extension is not available! options: %s",
+ templateOptions);
+ } else if (securityGroupExtensionPresent) {
+ if (!templateOptions.getSecurityGroupNames().isPresent() && inboundPorts.size() > 0) {
+ String securityGroupName = namingConvention.create().sharedNameForGroup(group);
+ try {
+ securityGroupCache.get(new ZoneSecurityGroupNameAndPorts(zone, securityGroupName, inboundPorts));
+ } catch (ExecutionException e) {
+ throw Throwables.propagate(e.getCause());
+ }
+ templateOptions.securityGroupNames(securityGroupName);
+ }
+ }
+ templateOptions.userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
+
+ return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
+ }
+
+ @Override
+ protected ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group,
+ final String name, Template template) {
+
+ ListenableFuture<AtomicReference<NodeMetadata>> future = super.createNodeInGroupWithNameAndTemplate(group, name, template);
+ NovaTemplateOptions templateOptions = NovaTemplateOptions.class.cast(template.getOptions());
+
+ if (templateOptions.shouldAutoAssignFloatingIp()) {
+ return Futures.transform(future, createAndAddFloatingIpToNode, userExecutor);
+ } else {
+ return future;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java
new file mode 100644
index 0000000..7f31c27
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java
@@ -0,0 +1,159 @@
+/*
+ * 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.openstack.nova.v2_0.config;
+
+import java.beans.ConstructorProperties;
+import java.lang.reflect.Type;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Singleton;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.json.config.GsonModule.DateAdapter;
+import org.jclouds.openstack.nova.v2_0.domain.Address;
+import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.domain.ServerExtendedAttributes;
+import org.jclouds.openstack.nova.v2_0.domain.ServerExtendedStatus;
+import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Sets;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+
+/**
+ * @author Adrian Cole
+ * @author Adam Lowe
+ */
+public class NovaParserModule extends AbstractModule {
+
+ @Provides
+ @Singleton
+ public Map<Type, Object> provideCustomAdapterBindings() {
+ return ImmutableMap.<Type, Object>of(
+ HostResourceUsage.class, new HostResourceUsageAdapter(),
+ ServerWithSecurityGroups.class, new ServerWithSecurityGroupsAdapter(),
+ Server.class, new ServerAdapter()
+ );
+ }
+
+ @Override
+ protected void configure() {
+ bind(DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
+ }
+
+ @Singleton
+ public static class HostResourceUsageAdapter implements JsonSerializer<HostResourceUsage>, JsonDeserializer<HostResourceUsage> {
+ public HostResourceUsage apply(HostResourceUsageView in) {
+ return in.resource.toBuilder().build();
+ }
+
+ @Override
+ public HostResourceUsage deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
+ return apply((HostResourceUsageView) context.deserialize(jsonElement, HostResourceUsageView.class));
+ }
+
+ @Override
+ public JsonElement serialize(HostResourceUsage hostResourceUsage, Type type, JsonSerializationContext context) {
+ return context.serialize(hostResourceUsage);
+ }
+
+ private static class HostResourceUsageView {
+ protected HostResourceUsageInternal resource;
+ }
+
+ private static class HostResourceUsageInternal extends HostResourceUsage {
+
+ @ConstructorProperties({
+ "host", "project", "memory_mb", "cpu", "disk_gb"
+ })
+ protected HostResourceUsageInternal(String host, @Nullable String project, int memoryMb, int cpu, int diskGb) {
+ super(host, project, memoryMb, cpu, diskGb);
+ }
+ }
+ }
+
+ @Singleton
+ public static class ServerWithSecurityGroupsAdapter implements JsonDeserializer<ServerWithSecurityGroups> {
+ @Override
+ public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
+ throws JsonParseException {
+ Server server = context.deserialize(jsonElement, Server.class);
+ ServerWithSecurityGroups.Builder<?> result = ServerWithSecurityGroups.builder().fromServer(server);
+ Set<String> names = Sets.newLinkedHashSet();
+ if (jsonElement.getAsJsonObject().get("security_groups") != null) {
+ JsonArray x = jsonElement.getAsJsonObject().get("security_groups").getAsJsonArray();
+ for (JsonElement y : x) {
+ names.add(y.getAsJsonObject().get("name").getAsString());
+ }
+ result.securityGroupNames(names);
+ }
+ return result.build();
+ }
+ }
+
+ @Singleton
+ public static class ServerAdapter implements JsonDeserializer<Server> {
+ @Override
+ public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
+ throws JsonParseException {
+ Server serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class));
+ Server.Builder<?> result = Server.builder().fromServer(serverBase);
+ ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class);
+ if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) {
+ result.extendedStatus(extendedStatus);
+ }
+ ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class);
+ if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) {
+ result.extendedAttributes(extraAttributes);
+ }
+ return result.build();
+ }
+
+ public Server apply(ServerInternal in) {
+ return in.toBuilder().build();
+ }
+
+ private static class ServerInternal extends Server {
+ @ConstructorProperties({
+ "id", "name", "links", "uuid", "tenant_id", "user_id", "updated", "created", "hostId", "accessIPv4", "accessIPv6", "status", "image", "flavor", "key_name", "config_drive", "addresses", "metadata", "extendedStatus", "extendedAttributes", "OS-DCF:diskConfig"
+ })
+ protected ServerInternal(String id, @Nullable String name, java.util.Set<Link> links, @Nullable String uuid, String tenantId,
+ String userId, Date updated, Date created, @Nullable String hostId, @Nullable String accessIPv4,
+ @Nullable String accessIPv6, Server.Status status, Resource image, Resource flavor, @Nullable String keyName,
+ @Nullable String configDrive, Multimap<String, Address> addresses, Map<String, String> metadata,
+ @Nullable ServerExtendedStatus extendedStatus, @Nullable ServerExtendedAttributes extendedAttributes, @Nullable String diskConfig) {
+ super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java
new file mode 100644
index 0000000..9b55439
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java
@@ -0,0 +1,43 @@
+/*
+ * 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.openstack.nova.v2_0.config;
+
+/**
+ * Configuration properties and constants used in openstack Nova connections.
+ *
+ * @author Adam Lowe
+ */
+public class NovaProperties {
+
+ /**
+ * Eventual consistency delay for retrieving a security group after it is created (in ms)
+ */
+ public static final String TIMEOUT_SECURITYGROUP_PRESENT = "jclouds.openstack-nova.timeout.securitygroup-present";
+
+ /**
+ * Whenever a node is created, automatically create and assign a floating ip address, also
+ * delete when the node is destroyed.
+ */
+ public static final String AUTO_ALLOCATE_FLOATING_IPS = "jclouds.openstack-nova.auto-create-floating-ips";
+
+ /**
+ * Whenever a node is created, automatically generate keypairs for groups, as needed, also
+ * delete the keypair(s) when the last node in the group is destroyed.
+ */
+ public static final String AUTO_GENERATE_KEYPAIRS = "jclouds.openstack-nova.auto-generate-keypairs";
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
new file mode 100644
index 0000000..556ec60
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
@@ -0,0 +1,191 @@
+/*
+ * 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.openstack.nova.v2_0.config;
+import static org.jclouds.reflect.Reflection2.typeToken;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.NovaAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
+import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces;
+import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsApi;
+import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationApi;
+import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi;
+import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
+import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.QuotaApi;
+import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi;
+import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi;
+import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageApi;
+import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeAttachmentApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeAttachmentAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi;
+import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeAsyncApi;
+import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
+import org.jclouds.openstack.nova.v2_0.features.FlavorAsyncApi;
+import org.jclouds.openstack.nova.v2_0.features.ImageApi;
+import org.jclouds.openstack.nova.v2_0.features.ImageAsyncApi;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi;
+import org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler;
+import org.jclouds.openstack.v2_0.domain.Extension;
+import org.jclouds.openstack.v2_0.features.ExtensionApi;
+import org.jclouds.openstack.v2_0.features.ExtensionAsyncApi;
+import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet;
+import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.config.RestClientModule;
+import org.jclouds.rest.functions.ImplicitOptionalConverter;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Provides;
+
+/**
+ * Configures the Nova connection.
+ *
+ * @author Adrian Cole
+ */
+@ConfiguresRestClient
+public class NovaRestClientModule<S extends NovaApi, A extends NovaAsyncApi> extends RestClientModule<S, A> {
+
+ public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
+ .put(ServerApi.class, ServerAsyncApi.class)
+ .put(FlavorApi.class, FlavorAsyncApi.class)
+ .put(ImageApi.class, ImageAsyncApi.class)
+ .put(ExtensionApi.class, ExtensionAsyncApi.class)
+ .put(FloatingIPApi.class, FloatingIPAsyncApi.class)
+ .put(AvailabilityZoneAPI.class, AvailabilityZoneAsyncApi.class)
+ .put(SecurityGroupApi.class, SecurityGroupAsyncApi.class)
+ .put(KeyPairApi.class, KeyPairAsyncApi.class)
+ .put(HostAdministrationApi.class, HostAdministrationAsyncApi.class)
+ .put(SimpleTenantUsageApi.class, SimpleTenantUsageAsyncApi.class)
+ .put(VirtualInterfaceApi.class, VirtualInterfaceAsyncApi.class)
+ .put(ServerWithSecurityGroupsApi.class, ServerWithSecurityGroupsAsyncApi.class)
+ .put(ServerAdminApi.class, ServerAdminAsyncApi.class)
+ .put(HostAggregateApi.class, HostAggregateAsyncApi.class)
+ .put(FlavorExtraSpecsApi.class, FlavorExtraSpecsAsyncApi.class)
+ .put(QuotaApi.class, QuotaAsyncApi.class)
+ .put(QuotaClassApi.class, QuotaClassAsyncApi.class)
+ .put(VolumeApi.class, VolumeAsyncApi.class)
+ .put(VolumeAttachmentApi.class, VolumeAttachmentAsyncApi.class)
+ .put(VolumeTypeApi.class, VolumeTypeAsyncApi.class)
+ .build();
+
+ @SuppressWarnings("unchecked")
+ public NovaRestClientModule() {
+ super(TypeToken.class.cast(typeToken(NovaApi.class)), TypeToken.class.cast(typeToken(NovaAsyncApi.class)), DELEGATE_MAP);
+ }
+
+ protected NovaRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
+ Map<Class<?>, Class<?>> sync2Async) {
+ super(syncClientType, asyncClientType, sync2Async);
+ }
+
+ @Override
+ protected void configure() {
+ bind(ImplicitOptionalConverter.class).to(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class);
+ super.configure();
+ }
+
+ @Provides
+ @Singleton
+ public Multimap<URI, URI> aliases() {
+ return ImmutableMultimap.<URI, URI>builder()
+ .put(URI.create(ExtensionNamespaces.SECURITY_GROUPS),
+ URI.create("http://docs.openstack.org/compute/ext/securitygroups/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.FLOATING_IPS),
+ URI.create("http://docs.openstack.org/compute/ext/floating_ips/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.KEYPAIRS),
+ URI.create("http://docs.openstack.org/compute/ext/keypairs/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.SIMPLE_TENANT_USAGE),
+ URI.create("http://docs.openstack.org/compute/ext/os-simple-tenant-usage/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.HOSTS),
+ URI.create("http://docs.openstack.org/compute/ext/hosts/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.VOLUMES),
+ URI.create("http://docs.openstack.org/compute/ext/volumes/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.VIRTUAL_INTERFACES),
+ URI.create("http://docs.openstack.org/compute/ext/virtual_interfaces/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.CREATESERVEREXT),
+ URI.create("http://docs.openstack.org/compute/ext/createserverext/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.ADMIN_ACTIONS),
+ URI.create("http://docs.openstack.org/compute/ext/admin-actions/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.AGGREGATES),
+ URI.create("http://docs.openstack.org/compute/ext/aggregates/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.FLAVOR_EXTRA_SPECS),
+ URI.create("http://docs.openstack.org/compute/ext/flavor_extra_specs/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.QUOTAS),
+ URI.create("http://docs.openstack.org/compute/ext/quotas-sets/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.QUOTA_CLASSES),
+ URI.create("http://docs.openstack.org/compute/ext/quota-classes-sets/api/v1.1"))
+ .put(URI.create(ExtensionNamespaces.VOLUME_TYPES),
+ URI.create("http://docs.openstack.org/compute/ext/volume_types/api/v1.1"))
+ .build();
+ }
+
+ @Provides
+ @Singleton
+ public LoadingCache<String, Set<? extends Extension>> provideExtensionsByZone(final Provider<NovaApi> novaApi) {
+ return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
+ .build(new CacheLoader<String, Set<? extends Extension>>() {
+ @Override
+ public Set<? extends Extension> load(String key) throws Exception {
+ return novaApi.get().getExtensionApiForZone(key).list();
+ }
+ });
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(NovaErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(NovaErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(NovaErrorHandler.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Address.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Address.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Address.java
new file mode 100644
index 0000000..38c744d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Address.java
@@ -0,0 +1,138 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * IP address
+ *
+ * @author AdrianCole
+*/
+public class Address {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromAddress(this);
+ }
+
+ public static Address createV4(String addr) {
+ return builder().version(4).addr(addr).build();
+ }
+
+ public static Address createV6(String addr) {
+ return builder().version(6).addr(addr).build();
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String addr;
+ protected int version;
+
+ /**
+ * @see Address#getAddr()
+ */
+ public T addr(String addr) {
+ this.addr = addr;
+ return self();
+ }
+
+ /**
+ * @see Address#getVersion()
+ */
+ public T version(int version) {
+ this.version = version;
+ return self();
+ }
+
+ public Address build() {
+ return new Address(addr, version);
+ }
+
+ public T fromAddress(Address in) {
+ return this
+ .addr(in.getAddr())
+ .version(in.getVersion());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String addr;
+ private final int version;
+
+ @ConstructorProperties({
+ "addr", "version"
+ })
+ protected Address(String addr, int version) {
+ this.addr = checkNotNull(addr, "addr");
+ this.version = version;
+ }
+
+ /**
+ * @return the ip address
+ */
+ public String getAddr() {
+ return this.addr;
+ }
+
+ /**
+ * @return the IP version, ex. 4
+ */
+ public int getVersion() {
+ return this.version;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(addr, version);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Address that = Address.class.cast(obj);
+ return Objects.equal(this.addr, that.addr)
+ && Objects.equal(this.version, that.version);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("addr", addr).add("version", version);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/BackupType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/BackupType.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/BackupType.java
new file mode 100644
index 0000000..97460d8
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/BackupType.java
@@ -0,0 +1,41 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * @author Adam Lowe
+ */
+public enum BackupType {
+ DAILY, WEEKLY;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static BackupType fromValue(String backupType) {
+ return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(backupType, "backupType")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Flavor.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Flavor.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Flavor.java
new file mode 100644
index 0000000..c353ab0
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Flavor.java
@@ -0,0 +1,211 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+
+/**
+ * A flavor is an available hardware configuration for a server. Each flavor has
+ * a unique combination of disk space and memory capacity.
+ *
+ * @author Jeremy Daggett, Ilja Bobkevic
+ * @see <a href=
+ "http://docs.openstack.org/api/openstack-compute/2/content/List_Flavors-d1e4188.html"
+ />
+*/
+public class Flavor extends Resource {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromFlavor(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Resource.Builder<T> {
+ protected int ram;
+ protected int disk;
+ protected int vcpus;
+ protected String swap;
+ protected Double rxtxFactor;
+ protected Integer ephemeral;
+
+ /**
+ * @see Flavor#getRam()
+ */
+ public T ram(int ram) {
+ this.ram = ram;
+ return self();
+ }
+
+ /**
+ * @see Flavor#getDisk()
+ */
+ public T disk(int disk) {
+ this.disk = disk;
+ return self();
+ }
+
+ /**
+ * @see Flavor#getVcpus()
+ */
+ public T vcpus(int vcpus) {
+ this.vcpus = vcpus;
+ return self();
+ }
+
+ /**
+ * @see Flavor#getSwap()
+ */
+ public T swap(String swap) {
+ this.swap = swap;
+ return self();
+ }
+
+ /**
+ * @see Flavor#getRxtxFactor()
+ */
+ public T rxtxFactor(Double rxtxFactor) {
+ this.rxtxFactor = rxtxFactor;
+ return self();
+ }
+
+ /**
+ * @see Flavor#getEphemeral()
+ */
+ public T ephemeral(Integer ephemeral) {
+ this.ephemeral = ephemeral;
+ return self();
+ }
+
+ public Flavor build() {
+ return new Flavor(id, name, links, ram, disk, vcpus, swap, rxtxFactor, ephemeral);
+ }
+
+ public T fromFlavor(Flavor in) {
+ return super.fromResource(in)
+ .ram(in.getRam())
+ .disk(in.getDisk())
+ .vcpus(in.getVcpus())
+ .swap(in.getSwap().orNull())
+ .rxtxFactor(in.getRxtxFactor().orNull())
+ .ephemeral(in.getEphemeral().orNull());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final int ram;
+ private final int disk;
+ private final int vcpus;
+ private final Optional<String> swap;
+ @Named("rxtx_factor")
+ private final Optional<Double> rxtxFactor;
+ @Named("OS-FLV-EXT-DATA:ephemeral")
+ private final Optional<Integer> ephemeral;
+
+ @ConstructorProperties({
+ "id", "name", "links", "ram", "disk", "vcpus", "swap", "rxtx_factor", "OS-FLV-EXT-DATA:ephemeral"
+ })
+ protected Flavor(String id, String name, java.util.Set<Link> links, int ram, int disk, int vcpus,
+ @Nullable String swap, @Nullable Double rxtxFactor, @Nullable Integer ephemeral) {
+ super(id, checkNotNull(name, "name"), links);
+ checkArgument(ram > 0, "Value of ram has to greater than 0");
+ checkArgument(vcpus > 0, "Value of vcpus has to greater than 0");
+ this.ram = ram;
+ this.disk = disk;
+ this.vcpus = vcpus;
+ this.swap = Optional.fromNullable(swap);
+ this.rxtxFactor = Optional.fromNullable(rxtxFactor);
+ this.ephemeral = Optional.fromNullable(ephemeral);
+ }
+
+ public int getRam() {
+ return this.ram;
+ }
+
+ public int getDisk() {
+ return this.disk;
+ }
+
+ public int getVcpus() {
+ return this.vcpus;
+ }
+
+ public Optional<String> getSwap() {
+ return this.swap;
+ }
+
+ public Optional<Double> getRxtxFactor() {
+ return this.rxtxFactor;
+ }
+
+ /**
+ * Retrieves ephemeral disk space in GB
+ * <p/>
+ * NOTE: This field is only present if the Flavor Extra Data extension is installed (alias "OS-FLV-EXT-DATA").
+ *
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#FLAVOR_EXTRA_DATA
+ */
+ public Optional<Integer> getEphemeral() {
+ return this.ephemeral;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ram, disk, vcpus, swap, rxtxFactor, ephemeral);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Flavor that = Flavor.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.ram, that.ram)
+ && Objects.equal(this.disk, that.disk)
+ && Objects.equal(this.vcpus, that.vcpus)
+ && Objects.equal(this.swap, that.swap)
+ && Objects.equal(this.rxtxFactor, that.rxtxFactor)
+ && Objects.equal(this.ephemeral, that.ephemeral);
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("ram", ram).add("disk", disk).add("vcpus", vcpus).add("swap", swap).add("rxtxFactor", rxtxFactor).add("ephemeral", ephemeral);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/FloatingIP.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/FloatingIP.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/FloatingIP.java
new file mode 100644
index 0000000..203b2da
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/FloatingIP.java
@@ -0,0 +1,173 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * A Floating IP is an IP address that can be created and associated with a
+ * Server instance. Floating IPs can also be disassociated and deleted from a
+ * Server instance.
+ *
+ * @author Jeremy Daggett
+ * @author chamerling
+*/
+public class FloatingIP implements Comparable<FloatingIP> {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromFloatingIP(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String ip;
+ protected String fixedIp;
+ protected String instanceId;
+
+ /**
+ * @see FloatingIP#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see FloatingIP#getIp()
+ */
+ public T ip(String ip) {
+ this.ip = ip;
+ return self();
+ }
+
+ /**
+ * @see FloatingIP#getFixedIp()
+ */
+ public T fixedIp(String fixedIp) {
+ this.fixedIp = fixedIp;
+ return self();
+ }
+
+ /**
+ * @see FloatingIP#getInstanceId()
+ */
+ public T instanceId(String instanceId) {
+ this.instanceId = instanceId;
+ return self();
+ }
+
+ public FloatingIP build() {
+ return new FloatingIP(id, ip, fixedIp, instanceId);
+ }
+
+ public T fromFloatingIP(FloatingIP in) {
+ return this
+ .id(in.getId())
+ .ip(in.getIp())
+ .fixedIp(in.getFixedIp())
+ .instanceId(in.getInstanceId());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final String ip;
+ @Named("fixed_ip")
+ private final String fixedIp;
+ @Named("instance_id")
+ private final String instanceId;
+
+ @ConstructorProperties({
+ "id", "ip", "fixed_ip", "instance_id"
+ })
+ protected FloatingIP(String id, String ip, @Nullable String fixedIp, @Nullable String instanceId) {
+ this.id = checkNotNull(id, "id");
+ this.ip = checkNotNull(ip, "ip");
+ this.fixedIp = fixedIp;
+ this.instanceId = instanceId;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getIp() {
+ return this.ip;
+ }
+
+ @Nullable
+ public String getFixedIp() {
+ return this.fixedIp;
+ }
+
+ @Nullable
+ public String getInstanceId() {
+ return this.instanceId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, ip, fixedIp, instanceId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ FloatingIP that = FloatingIP.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.ip, that.ip)
+ && Objects.equal(this.fixedIp, that.fixedIp)
+ && Objects.equal(this.instanceId, that.instanceId);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("ip", ip).add("fixedIp", fixedIp).add("instanceId", instanceId);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ @Override
+ public int compareTo(FloatingIP o) {
+ return this.id.compareTo(o.getId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Host.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Host.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Host.java
new file mode 100644
index 0000000..72df77d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Host.java
@@ -0,0 +1,127 @@
+/*
+ * 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.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Class Host
+*/
+public class Host {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromHost(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected String service;
+
+ /**
+ * @see Host#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see Host#getService()
+ */
+ public T service(String service) {
+ this.service = service;
+ return self();
+ }
+
+ public Host build() {
+ return new Host(name, service);
+ }
+
+ public T fromHost(Host in) {
+ return this
+ .name(in.getName())
+ .service(in.getService());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("host_name")
+ private final String name;
+ private final String service;
+
+ @ConstructorProperties({
+ "host_name", "service"
+ })
+ protected Host(@Nullable String name, @Nullable String service) {
+ this.name = name;
+ this.service = service;
+ }
+
+ @Nullable
+ public String getName() {
+ return this.name;
+ }
+
+ @Nullable
+ public String getService() {
+ return this.service;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, service);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Host that = Host.class.cast(obj);
+ return Objects.equal(this.name, that.name)
+ && Objects.equal(this.service, that.service);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("name", name).add("service", service);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
[18/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java
new file mode 100755
index 0000000..869530b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java
@@ -0,0 +1,136 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.Capacity;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code VDCHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class VDCHandlerTest {
+ public void testVCloud1_0() {
+ InputStream is = getClass().getResourceAsStream("/vdc-1.0.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
+ assertEquals(result.getName(), "Jclouds-Commit-compG1xstorA01");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vdc+xml");
+ assertEquals(result.getStatus(), VDCStatus.READY);
+ assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assertEquals(result.getAllocationModel(), AllocationModel.ALLOCATION_POOL);
+ assertEquals(result.getStorageCapacity(), new Capacity("MB", 1024000, 1024000, 0, 0));
+ assertEquals(result.getCpuCapacity(), new Capacity("MHz", 20000, 20000, 0, 0));
+ assertEquals(result.getMemoryCapacity(), new Capacity("MB", 30720, 30720, 0, 0));
+ assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> of());
+ assertEquals(result.getAvailableNetworks(), ImmutableMap.of("isolation01", new ReferenceTypeImpl("isolation01",
+ "application/vnd.vmware.vcloud.network+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644")), "internet01",
+ new ReferenceTypeImpl("internet01", "application/vnd.vmware.vcloud.network+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723"))));
+ assertEquals(result.getNicQuota(), 0);
+ assertEquals(result.getNetworkQuota(), 100);
+ assertEquals(result.getVmQuota(), 50);
+ assert result.isEnabled();
+ }
+
+ public void testTerremark() {
+ InputStream is = getClass().getResourceAsStream("/vdc.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
+ assertEquals(result.getName(), "Miami Environment 1");
+ assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 100, 0, 8, 0));
+ assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 5000, 0, 0, 0));
+ assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 2^20", 10240, 0, 0, 0));
+ assertEquals(result.getVmQuota(), 0);
+ assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> of("adriantest",
+ new ReferenceTypeImpl("adriantest", VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124")), "centos-53",
+ new ReferenceTypeImpl("centos-53", VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120"))));
+ assertEquals(result.getAvailableNetworks(), ImmutableMap.of("10.114.34.128/26", new ReferenceTypeImpl(
+ "10.114.34.128/26", "application/vnd.vmware.vcloud.network+xml", URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"))));
+ }
+
+ public void testHostingDotCom() {
+ InputStream is = getClass().getResourceAsStream("/vdc-hosting.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
+ assertEquals(result.getName(), "vDC Name");
+ assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"));
+ assertEquals(result.getDescription(), "vDC Name");
+ assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 0, 0, 40960, 0));
+ assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 0, 0, 2400, 0));
+ assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 10^9", 0, 0, 2, 0));
+ assertEquals(result.getVmQuota(), 0);
+ assertEquals(result.getResourceEntities(), new ImmutableMap.Builder<String, ReferenceType>().put(
+ "Plesk (Linux) 64-bit Template",
+ new ReferenceTypeImpl("Plesk (Linux) 64-bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"))).put(
+
+ "Windows 2008 Datacenter 64 Bit Template",
+ new ReferenceTypeImpl("Windows 2008 Datacenter 64 Bit Template",
+ "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"))).put(
+ "Cent OS 64 Bit Template",
+ new ReferenceTypeImpl("Cent OS 64 Bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"))).put(
+ "cPanel (Linux) 64 Bit Template",
+ new ReferenceTypeImpl("cPanel (Linux) 64 Bit Template",
+ "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"))).put(
+ "188849-1",
+ new ReferenceTypeImpl("188849-1", "application/vnd.vmware.vcloud.vApp+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1"))).put(
+ "188849-2",
+ new ReferenceTypeImpl("188849-2", "application/vnd.vmware.vcloud.vApp+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-2"))).build());
+
+ assertEquals(result.getAvailableNetworks(), ImmutableMap.<String, ReferenceType> of());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java
new file mode 100755
index 0000000..2faa656
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.vcloud.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.xml.ovf.VCloudOperatingSystemSectionHandlerTest;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+import org.jclouds.vcloud.xml.ovf.VCloudVirtualHardwareSectionHandlerTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code VmHandler}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class VmHandlerTest {
+ public void testVCloud1_0() {
+ InputStream is = getClass().getResourceAsStream("/vm-rhel-off-static.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule() {
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ }
+ });
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ Vm result = factory.create(injector.getInstance(VmHandler.class)).parse(is);
+ checkVm(result);
+ }
+
+ static void checkVm(Vm result) {
+ assertEquals(result.getName(), "RHEL5");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vm+xml");
+ assertEquals(result.getStatus(), Status.OFF);
+ assertEquals(result.getParent(), new ReferenceTypeImpl(null, VCloudMediaType.VAPP_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assertEquals(result.getVAppScopedLocalId(), "10_rhel_template");
+ VCloudVirtualHardwareSectionHandlerTest.checkHardware(result.getVirtualHardwareSection());
+ VCloudOperatingSystemSectionHandlerTest.checkOs(result.getOperatingSystemSection());
+ NetworkConnectionSectionHandlerTest.checkNetworkConnectionSection(result.getNetworkConnectionSection());
+ GuestCustomizationSectionHandlerTest.checkGuestCustomization(result.getGuestCustomizationSection());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemSectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemSectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemSectionHandlerTest.java
new file mode 100755
index 0000000..a5604ff
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemSectionHandlerTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.vcloud.xml.ovf;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.UnknownHostException;
+
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code VCloudOperatingSystemSectionHandler}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudOperatingSystemSectionHandlerTest")
+public class VCloudOperatingSystemSectionHandlerTest extends BaseHandlerTest {
+
+ public void testDefault() throws UnknownHostException {
+ InputStream is = getClass().getResourceAsStream("/os.xml");
+
+ VCloudOperatingSystemSection result = factory.create(injector.getInstance(VCloudOperatingSystemHandler.class)).parse(is);
+
+ checkOs(result);
+
+ }
+
+ @Test(enabled = false)
+ public static void checkOs(VCloudOperatingSystemSection result) {
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"));
+ assertEquals(result.getDescription(), "Red Hat Enterprise Linux 5 (64-bit)");
+ assertEquals(result.getEdit(), new ReferenceTypeImpl(null,
+ "application/vnd.vmware.vcloud.operatingSystemSection+xml",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/")));
+ assertEquals(result.getId(), Integer.valueOf(80));
+ assertEquals(result.getVmwOsType(), "rhel5_64Guest");
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.operatingSystemSection+xml");
+ assertEquals(result.getInfo(), "Specifies the operating system installed");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudVirtualHardwareSectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudVirtualHardwareSectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudVirtualHardwareSectionHandlerTest.java
new file mode 100755
index 0000000..65f4560
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudVirtualHardwareSectionHandlerTest.java
@@ -0,0 +1,153 @@
+/*
+ * 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.vcloud.xml.ovf;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.UnknownHostException;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
+import org.jclouds.cim.VirtualSystemSettingData;
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.ovf.EditableResourceAllocationSettingData;
+import org.jclouds.vcloud.domain.ovf.VCloudHardDisk;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkAdapter;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+import org.jclouds.vcloud.xml.VCloudVirtualHardwareHandler;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+
+/**
+ * Tests behavior of {@code VCloudVirtualHardwareSectionHandler}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudVirtualHardwareSectionHandlerTest")
+public class VCloudVirtualHardwareSectionHandlerTest extends BaseHandlerTest {
+ @BeforeTest
+ @Override
+ protected void setUpInjector() {
+ injector = Guice.createInjector(new SaxParserModule() {
+ public void configure() {
+ super.configure();
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ }
+ });
+ factory = injector.getInstance(ParseSax.Factory.class);
+ assert factory != null;
+ }
+
+ public void testDefault() throws UnknownHostException {
+ InputStream is = getClass().getResourceAsStream("/virtualhardwaresection.xml");
+
+ VCloudVirtualHardwareSection result = factory.create(injector.getInstance(VCloudVirtualHardwareHandler.class))
+ .parse(is);
+
+ checkHardware(result);
+
+ }
+
+ @Test(enabled = false)
+ public static void checkHardware(VCloudVirtualHardwareSection result) {
+ VirtualSystemSettingData system = VirtualSystemSettingData.builder().instanceID("0").elementName(
+ "Virtual Hardware Family").virtualSystemIdentifier("RHEL5").virtualSystemType("vmx-07").build();
+
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.virtualHardwareSection+xml");
+ assertEquals(result.getSystem().toString(), system.toString());
+ assertEquals(result.getInfo(), "Virtual hardware requirements");
+
+ assertEquals(Iterables.get(result.getItems(), 0).toString(), VCloudNetworkAdapter.builder()
+ .instanceID("1").elementName("Network adapter 0").description("PCNet32 ethernet adapter").resourceType(
+ ResourceType.ETHERNET_ADAPTER).resourceSubType("PCNet32").automaticAllocation(true).connection(
+ "internet01").address("00:50:56:01:01:f2").addressOnParent("0").ipAddress("174.47.101.164")
+ .primaryNetworkConnection(true).ipAddressingMode("POOL").build().toString());
+
+ assertEquals(Iterables.get(result.getItems(), 1).toString(), ResourceAllocationSettingData
+ .builder().instanceID("2").elementName("SCSI Controller 0").description("SCSI Controller").resourceType(
+ ResourceType.PARALLEL_SCSI_HBA).resourceSubType("lsilogic").address("0").build().toString());
+
+ assertEquals(Iterables.get(result.getItems(), 2).toString(), VCloudHardDisk.builder().instanceID(
+ "2000").elementName("Hard disk 1").description("Hard disk").resourceType(ResourceType.DISK_DRIVE)
+ .addressOnParent("0").parent("2").capacity(30720).busType(6).busSubType("lsilogic").build().toString());
+
+ assertEquals(Iterables.get(result.getItems(), 3).toString(), ResourceAllocationSettingData
+ .builder().instanceID("3").elementName("IDE Controller 0").description("IDE Controller").resourceType(
+ ResourceType.IDE_CONTROLLER).address("0").build().toString());
+
+ assertEquals(Iterables.get(result.getItems(), 4).toString(), ResourceAllocationSettingData
+ .builder().instanceID("3002").elementName("CD/DVD Drive 1").description("CD/DVD Drive").resourceType(
+ ResourceType.CD_DRIVE).addressOnParent("0").automaticAllocation(false).parent("3").build()
+ .toString());
+
+ assertEquals(Iterables.get(result.getItems(), 5).toString(), ResourceAllocationSettingData
+ .builder().instanceID("8000").elementName("Floppy Drive 1").description("Floppy Drive").resourceType(
+ ResourceType.FLOPPY_DRIVE).addressOnParent("0").automaticAllocation(false).build().toString());
+
+ assertEquals(
+ Iterables.get(result.getItems(), 6).toString(),
+ EditableResourceAllocationSettingData
+ .builder()
+ .instanceID("4")
+ .elementName("1 virtual CPU(s)")
+ .description("Number of Virtual CPUs")
+ .resourceType(ResourceType.PROCESSOR)
+ .virtualQuantity(1l)
+ .allocationUnits("hertz * 10^6")
+ .reservation(0l)
+ .weight(0)
+ .edit(
+ new ReferenceTypeImpl(
+ null,
+ "application/vnd.vmware.vcloud.rasdItem+xml",
+ URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"),"edit"))
+ .build().toString());
+
+ assertEquals(
+ Iterables.get(result.getItems(), 7).toString(),
+ EditableResourceAllocationSettingData
+ .builder()
+ .instanceID("5")
+ .elementName("384 MB of memory")
+ .description("Memory Size")
+ .resourceType(ResourceType.MEMORY)
+ .virtualQuantity(384l)
+ .allocationUnits("byte * 2^20")
+ .reservation(0l)
+ .weight(0)
+ .edit(
+ new ReferenceTypeImpl(
+ null,
+ "application/vnd.vmware.vcloud.rasdItem+xml",
+ URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"),"edit"))
+ .build().toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/captureVApp-default.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/captureVApp-default.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/captureVApp-default.xml
new file mode 100755
index 0000000..0570872
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/captureVApp-default.xml
@@ -0,0 +1 @@
+<CaptureVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="my-template" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/4181" type="application/vnd.vmware.vcloud.vApp+xml"/></CaptureVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/captureVApp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/captureVApp.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/captureVApp.xml
new file mode 100755
index 0000000..35e62d0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/captureVApp.xml
@@ -0,0 +1 @@
+<CaptureVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="my-template" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vApp Template</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/201" type="application/vnd.vmware.vcloud.vApp+xml"/></CaptureVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog-blank.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog-blank.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog-blank.xml
new file mode 100755
index 0000000..6bc4038
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog-blank.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Catalog xmlns="http://www.vmware.com/vcloud/v1" name="Jclouds-private" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcenterprise.bluelock.com/api/v1.0/org/9566014"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081/catalogItems"/>
+ <CatalogItems/>
+ <IsPublished>false</IsPublished>
+</Catalog>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog-hosting.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog-hosting.xml
new file mode 100755
index 0000000..be510a9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog-hosting.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Catalog href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1"
+ name="HMSCatalog" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/catalog.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Description>HMS Shared Catalog</Description>
+
+ <Link rel="add"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1/catalogItems"
+ type="application/vnd.vmware.vcloud.catalogItem+xml" />
+
+ <CatalogItems>
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1"
+ name="Plesk (Linux) 64-bit Template" />
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"
+ name="Windows 2008 Datacenter 64 Bit Template" />
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/3"
+ name="Cent OS 64 Bit Template" />
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/4"
+ name="cPanel (Linux) 64 Bit Template" />
+ </CatalogItems>
+</Catalog>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog.xml
new file mode 100755
index 0000000..f2d5eaa
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog.xml
@@ -0,0 +1,27 @@
+<Catalog href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog" type="application/vnd.vmware.vcloud.catalog+xml" name="Miami Environment 1" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <CatalogItems>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/5" type="application/vnd.vmware.vcloud.catalogItem+xml" name="CentOS 5.3 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/6" type="application/vnd.vmware.vcloud.catalogItem+xml" name="CentOS 5.3 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/7" type="application/vnd.vmware.vcloud.catalogItem+xml" name="RHEL 5.3 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/8" type="application/vnd.vmware.vcloud.catalogItem+xml" name="RHEL 5.3 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/11" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu JeOS 9.04 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/12" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu JeOS 9.04 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/9" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu Server 9.04 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/10" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu Server 9.04 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/1" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Enterprise R2 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/2" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Enterprise R2 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/3" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Standard R2 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/4" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Standard R2 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/23" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/13" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Enterprise (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/15" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Enterprise (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/16" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Enterprise R2 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/17" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Standard (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/18" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Standard (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/19" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Standard R2 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/14" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Standard w.SQL 2008 Web (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/20" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Web Server 2008 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/21" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Web Server 2008 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Web Server 2008 R2 (64-bit)"/>
+ </CatalogItems>
+</Catalog>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog1.0-vcd15.xml
new file mode 100755
index 0000000..0208e59
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalog1.0-vcd15.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Catalog xmlns="http://www.vmware.com/vcloud/v1" name="jclouds" type="application/vnd.vmware.vcloud.catalog+xml" href="https://zone.myvcloud.com/api/v1.0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658/catalogItems"/>
+ <CatalogItems>
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="UbuntuServer-x64-2GB" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c"/>
+ </CatalogItems>
+ <IsPublished>false</IsPublished>
+</Catalog>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-carrenza-with-default-namespace.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-carrenza-with-default-namespace.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-carrenza-with-default-namespace.xml
new file mode 100755
index 0000000..88fec20
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-carrenza-with-default-namespace.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CatalogItem xmlns="http://www.vmware.com/vcloud/v1" name="ubuntu10.10x64" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://myvdc.carrenza.net/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://myvdc.carrenza.net/api/v1.0/catalog/5d2c147a-d26d-487a-9a05-577ee175186b"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"/>
+ <Link rel="remove" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"/>
+ <Description> </Description>
+ <Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10.10x64" href="https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834"/>
+</CatalogItem>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-carrenza-with-vcloud-namespace.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-carrenza-with-vcloud-namespace.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-carrenza-with-vcloud-namespace.xml
new file mode 100755
index 0000000..917c143
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-carrenza-with-vcloud-namespace.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vcloud:CatalogItem xmlns:vcloud="http://www.vmware.com/vcloud/v1" name="ubuntu10.10x64" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://myvdc.carrenza.net/api/v1.0/schema/master.xsd">
+ <vcloud:Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://myvdc.carrenza.net/api/v1.0/catalog/5d2c147a-d26d-487a-9a05-577ee175186b"/>
+ <vcloud:Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"/>
+ <vcloud:Link rel="remove" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"/>
+ <vcloud:Description> </vcloud:Description>
+ <vcloud:Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10.10x64" href="https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834"/>
+</vcloud:CatalogItem>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-hosting.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-hosting.xml
new file mode 100755
index 0000000..6f88d04
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-hosting.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CatalogItem
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"
+ name="Windows 2008 Datacenter 64 Bit"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 catalogItem.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Description>Windows 2008 Datacenter 64 Bit</Description>
+ <Entity href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ name="Windows 2008 Datacenter 64 Bit" />
+ <Property key="Foo">Bar</Property>
+ <Property key="Hello">World</Property>
+</CatalogItem>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-terremark.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-terremark.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-terremark.xml
new file mode 100755
index 0000000..feb8b82
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem-terremark.xml
@@ -0,0 +1,16 @@
+<CatalogItem
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22"
+ type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Web Server 2008 R2 (64-bit)"
+ xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Link rel="down"
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22/options/compute"
+ type="application/xml" name="Compute Options" />
+ <Link rel="down"
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22/options/customization"
+ type="application/xml" name="Customization Options" />
+ <Entity
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vAppTemplate/22"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows Web Server 2008 R2 (64-bit)" />
+ <Property key="LicensingCost">0</Property>
+</CatalogItem>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem1.0-vcd15.xml
new file mode 100755
index 0000000..b344071
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/catalogItem1.0-vcd15.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CatalogItem xmlns="http://www.vmware.com/vcloud/v1" name="UbuntuServer-x64-2GB" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://zone.myvcloud.com/api/v1.0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c"/>
+ <Link rel="remove" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c"/>
+ <Description> </Description>
+ <Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="UbuntuServer-x64-2GB" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+</CatalogItem>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVApp-default.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVApp-default.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVApp-default.xml
new file mode 100755
index 0000000..0e8ba8d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVApp-default.xml
@@ -0,0 +1 @@
+<CloneVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" deploy="false" name="my-vapp" powerOn="false" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/4181" type="application/vnd.vmware.vcloud.vApp+xml"/></CloneVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVApp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVApp.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVApp.xml
new file mode 100755
index 0000000..b6cd733
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVApp.xml
@@ -0,0 +1 @@
+<CloneVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" deploy="true" name="new-linux-server" powerOn="true" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vApp</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/201" type="application/vnd.vmware.vcloud.vApp+xml"/></CloneVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVAppTemplate-default.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVAppTemplate-default.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVAppTemplate-default.xml
new file mode 100755
index 0000000..00b11e7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVAppTemplate-default.xml
@@ -0,0 +1 @@
+<CloneVAppTemplateParams xmlns="http://vcloud.safesecureweb.com/ns/vcloud.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="my-vapptemplate" xsi:schemaLocation="http://vcloud.safesecureweb.com/ns/vcloud.xsd http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181" type="application/vnd.vmware.vcloud.vAppTemplate+xml"/></CloneVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVAppTemplate.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVAppTemplate.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVAppTemplate.xml
new file mode 100755
index 0000000..e612b98
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/copyVAppTemplate.xml
@@ -0,0 +1 @@
+<CloneVAppTemplateParams xmlns="http://vcloud.safesecureweb.com/ns/vcloud.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="new-linux-server" xsi:schemaLocation="http://vcloud.safesecureweb.com/ns/vcloud.xsd http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vAppTemplate</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201" type="application/vnd.vmware.vcloud.vAppTemplate+xml"/></CloneVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/cpuItem.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/cpuItem.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/cpuItem.xml
new file mode 100755
index 0000000..d5e437b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/cpuItem.xml
@@ -0,0 +1 @@
+<Item xmlns="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"><rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits><rasd:Description>Number of Virtual CPUs</rasd:Description><rasd:ElementName>2 virtual CPU(s)</rasd:ElementName><rasd:InstanceID>4</rasd:InstanceID><rasd:ResourceType>3</rasd:ResourceType><rasd:VirtualQuantity>2</rasd:VirtualQuantity><rasd:Weight>0</rasd:Weight></Item>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/guestCustomization.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/guestCustomization.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/guestCustomization.xml
new file mode 100755
index 0000000..644720f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/guestCustomization.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<GuestCustomizationSection
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>2087535248</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>cat > /root/foo.txt<<EOF
+I '"love"' {asc|!}*&
+EOF
+</CustomizationScript>
+ <ComputerName>RHEL5</ComputerName>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/" />
+</GuestCustomizationSection>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/guestCustomizationSection.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/guestCustomizationSection.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/guestCustomizationSection.xml
new file mode 100755
index 0000000..2fadb53
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/guestCustomizationSection.xml
@@ -0,0 +1,3 @@
+<GuestCustomizationSection xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" href="http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection" ovf:required="false" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"><ovf:Info>Specifies Guest OS Customization Settings</ovf:Info><CustomizationScript>cat > /tmp/foo.txt<<EOF
+I love candy
+EOF</CustomizationScript></GuestCustomizationSection>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiatedvapp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiatedvapp.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiatedvapp.xml
new file mode 100755
index 0000000..9d98c2d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiatedvapp.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VApp xmlns="http://www.vmware.com/vcloud/v1" deployed="false" status="0" name="vcds-a47" type="application/vnd.vmware.vcloud.vApp+xml" href="https://zone01.bluelock.com/api/v1.0/vApp/vapp-dba20113-1a4a-4ec9-a5ad-52dc69ee0825" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://zone01.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://zone01.bluelock.com/api/v1.0/vApp/vapp-dba20113-1a4a-4ec9-a5ad-52dc69ee0825/controlAccess/"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://zone01.bluelock.com/api/v1.0/vdc/9db4ee77-33e7-4b83-96be-eee9925eaa9b"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://zone01.bluelock.com/api/v1.0/vApp/vapp-dba20113-1a4a-4ec9-a5ad-52dc69ee0825/owner"/>
+ <Description>OS-Ubuntu10.04_x64</Description>
+ <Tasks>
+ <Task status="running" startTime="2012-07-11T20:37:49.521-04:00" operation="Creating Virtual Application vcds-a47(dba20113-1a4a-4ec9-a5ad-52dc69ee0825)" expiryTime="2012-08-25T20:37:49.521-04:00" type="application/vnd.vmware.vcloud.task+xml" href="https://zone01.bluelock.com/api/v1.0/task/fee48ffc-8ba2-452e-a57f-ada0cd2eda31">
+ <Link rel="task:cancel" href="https://zone01.bluelock.com/api/v1.0/task/fee48ffc-8ba2-452e-a57f-ada0cd2eda31/action/cancel"/>
+ <Owner type="application/vnd.vmware.vcloud.vApp+xml" name="vcds-a47" href="https://zone01.bluelock.com/api/v1.0/vApp/vapp-dba20113-1a4a-4ec9-a5ad-52dc69ee0825"/>
+ </Task>
+ </Tasks>
+</VApp>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams-description.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams-description.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams-description.xml
new file mode 100755
index 0000000..6728290
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams-description.xml
@@ -0,0 +1 @@
+<InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" deploy="true" name="my-vapp" powerOn="true"><Description>my foo</Description><InstantiationParams><NetworkConfigSection><ovf:Info>Configuration parameters for logical networks</ovf:Info><NetworkConfig networkName="vAppNet-vApp Internal"><Configuration><ParentNetwork href="https://vcenterprise.bluelock.com/api/v1.0/network/1990"/><FenceMode>bridged</FenceMode></Configuration></NetworkConfig></NetworkConfigSection></InstantiationParams><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"/><AllEULAsAccepted>true</AllEULAsAccepted></InstantiateVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams-network.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams-network.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams-network.xml
new file mode 100755
index 0000000..e3bcb58
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams-network.xml
@@ -0,0 +1 @@
+<InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" deploy="true" name="my-vapp" powerOn="true"><InstantiationParams><NetworkConfigSection><ovf:Info>Configuration parameters for logical networks</ovf:Info><NetworkConfig networkName="aloha"><Configuration><ParentNetwork href="https://vcenterprise.bluelock.com/api/v1.0/network/1991"/><FenceMode>natRouted</FenceMode></Configuration></NetworkConfig></NetworkConfigSection></InstantiationParams><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"/><AllEULAsAccepted>true</AllEULAsAccepted></InstantiateVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams.xml
new file mode 100755
index 0000000..9df9961
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/instantiationparams.xml
@@ -0,0 +1 @@
+<InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" deploy="true" name="my-vapp" powerOn="true"><InstantiationParams><NetworkConfigSection><ovf:Info>Configuration parameters for logical networks</ovf:Info><NetworkConfig networkName="vAppNet-vApp Internal"><Configuration><ParentNetwork href="https://vcenterprise.bluelock.com/api/v1.0/network/1990"/><FenceMode>bridged</FenceMode></Configuration></NetworkConfig></NetworkConfigSection></InstantiationParams><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"/><AllEULAsAccepted>true</AllEULAsAccepted></InstantiateVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/log4j.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/log4j.xml
new file mode 100755
index 0000000..63810d3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/log4j.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+ <!--
+ For more configuration infromation and examples see the Apache
+ Log4j website: http://logging.apache.org/log4j/
+ -->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
+ debug="false">
+
+ <!-- A time/date based rolling appender -->
+ <appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="target/test-data/jclouds-wire.log" />
+ <param name="Append" value="true" />
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd" />
+
+ <param name="Threshold" value="TRACE" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
+
+ <!--
+ The full pattern: Date MS Priority [Category]
+ (Thread:NDC) Message\n <param name="ConversionPattern"
+ value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="target/test-data/jclouds.log" />
+ <param name="Append" value="true" />
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd" />
+
+ <param name="Threshold" value="TRACE" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
+
+ <!--
+ The full pattern: Date MS Priority [Category]
+ (Thread:NDC) Message\n <param name="ConversionPattern"
+ value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A time/date based rolling appender -->
+ <appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="target/test-data/jclouds-compute.log" />
+ <param name="Append" value="true" />
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd" />
+
+ <param name="Threshold" value="TRACE" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
+
+ <!--
+ The full pattern: Date MS Priority [Category]
+ (Thread:NDC) Message\n <param name="ConversionPattern"
+ value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A time/date based rolling appender -->
+ <appender name="SSHFILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="target/test-data/jclouds-ssh.log" />
+ <param name="Append" value="true" />
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd" />
+
+ <param name="Threshold" value="TRACE" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
+
+ <!--
+ The full pattern: Date MS Priority [Category]
+ (Thread:NDC) Message\n <param name="ConversionPattern"
+ value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="COMPUTEFILE" />
+ </appender>
+
+ <appender name="ASYNCSSH" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="SSHFILE" />
+ </appender>
+
+ <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="FILE" />
+ </appender>
+
+ <appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="WIREFILE" />
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jclouds">
+ <priority value="DEBUG" />
+ <appender-ref ref="ASYNC" />
+ </category>
+
+ <category name="jclouds.headers">
+ <priority value="DEBUG" />
+ <appender-ref ref="ASYNCWIRE" />
+ </category>
+
+ <category name="jclouds.ssh">
+ <priority value="DEBUG" />
+ <appender-ref ref="ASYNCSSH" />
+ </category>
+
+ <category name="jclouds.wire">
+ <priority value="DEBUG" />
+ <appender-ref ref="ASYNCWIRE" />
+ </category>
+
+ <category name="jclouds.compute">
+ <priority value="TRACE" />
+ <appender-ref ref="ASYNCCOMPUTE" />
+ </category>
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <priority value="WARN" />
+ </root>
+
+</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/memoryItem.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/memoryItem.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/memoryItem.xml
new file mode 100755
index 0000000..df35b83
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/memoryItem.xml
@@ -0,0 +1 @@
+<Item xmlns="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"><rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits><rasd:Description>Memory Size</rasd:Description><rasd:ElementName>512 MB of memory</rasd:ElementName><rasd:InstanceID>5</rasd:InstanceID><rasd:Reservation>0</rasd:Reservation><rasd:ResourceType>4</rasd:ResourceType><rasd:VirtualQuantity>512</rasd:VirtualQuantity><rasd:Weight>0</rasd:Weight></Item>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/moveVApp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/moveVApp.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/moveVApp.xml
new file mode 100755
index 0000000..919d136
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/moveVApp.xml
@@ -0,0 +1 @@
+<CloneVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" deploy="true" name="new-linux-server" powerOn="true" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vApp</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/201" type="application/vnd.vmware.vcloud.vApp+xml"/><IsSourceDelete>true</IsSourceDelete></CloneVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/moveVAppTemplate.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/moveVAppTemplate.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/moveVAppTemplate.xml
new file mode 100755
index 0000000..2f72f2b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/moveVAppTemplate.xml
@@ -0,0 +1 @@
+<CloneVAppTemplateParams xmlns="http://vcloud.safesecureweb.com/ns/vcloud.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="new-linux-server" xsi:schemaLocation="http://vcloud.safesecureweb.com/ns/vcloud.xsd http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vAppTemplate</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201" type="application/vnd.vmware.vcloud.vAppTemplate+xml"/><IsSourceDelete>true</IsSourceDelete></CloneVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/networkconnection.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/networkconnection.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/networkconnection.xml
new file mode 100755
index 0000000..5400fc7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/networkconnection.xml
@@ -0,0 +1,7 @@
+<NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.164</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f2</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+</NetworkConnection>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/networkconnectionsection.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/networkconnectionsection.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/networkconnectionsection.xml
new file mode 100755
index 0000000..9550ef6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/networkconnectionsection.xml
@@ -0,0 +1,18 @@
+<NetworkConnectionSection
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.164</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f2</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/" />
+</NetworkConnectionSection>
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-1.0.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-1.0.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-1.0.xml
new file mode 100755
index 0000000..af9803f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-1.0.xml
@@ -0,0 +1,24 @@
+<Org name="ExampleOrg" type="application/vnd.vmware.vcloud.org+xml"
+ href="http://vcloud.example.com/api/v1.0/org/5" >
+ <Link type="application/vnd.vmware.vcloud.catalog+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/catalog/32" name="Main Catalog" />
+ <Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/catalog/32/controlAccess" />
+ <Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="controlAccess"
+ href="http://vcloud.example.com/api/v1.0/catalog/32/action/controlAccess" />
+ <Link type="application/vnd.vmware.vcloud.catalog+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/catalog/37" name="Shared Catalog" />
+ <Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/catalog/37/controlAccess" />
+ <Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="controlAccess"
+ href="http://vcloud.example.com/api/v1.0/catalog/37/action/controlAccess" />
+ <Link type="application/vnd.vmware.vcloud.vdc+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/vdc/5" name="ExampleVdc01" />
+ <Link type="application/vnd.vmware.vcloud.tasksList+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/tasksList/5" />
+ <Link type="application/vnd.vmware.vcloud.network+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/network/14" name="TestNetwork" />
+ <Link type="application/vnd.vmware.vcloud.network+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/network/54" name="ProductionNetwork" />
+ <Description>Example Corp's Primary Organization.</Description>
+</Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-hosting.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-hosting.xml
new file mode 100755
index 0000000..3bd9842
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-hosting.xml
@@ -0,0 +1,12 @@
+<Org href="https://vcloud.safesecureweb.com/api/v0.8/org/188849"
+ name="Customer 188849" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/organization.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Link rel="down" href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1"
+ type="application/vnd.vmware.vcloud.catalog+xml" name="HMS Shared Catalog" />
+ <Link rel="down"
+ href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"
+ type="application/vnd.vmware.vcloud.vdc+xml" name="188849 Virtual DataCenter" />
+ <Link rel="down"
+ href="https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"
+ type="application/vnd.vmware.vcloud.tasksList+xml" name="188849 Task List" />
+</Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-savvis.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-savvis.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-savvis.xml
new file mode 100755
index 0000000..c2517c7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org-savvis.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vApp:Org xmlns:vApp="http://www.vmware.com/vcloud/v0.8"
+ xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ name="607968.0">
+ <vApp:Link
+ href="https://api.symphonyVPDC.savvis.net/rest/api/v0.8/org/607968.0/vdc/2826"
+ name="GravDataCenter1(Saved)" rel="down"
+ type="application/vnd.vmware.vcloud.vdc+xml" />
+ <vApp:Description>Gravitant Inc</vApp:Description>
+</vApp:Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org.xml
new file mode 100755
index 0000000..1728721
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org.xml
@@ -0,0 +1,5 @@
+<Org href="https://services.vcloudexpress.terremark.com/api/v0.8/org/48" name="adrian@jclouds.org" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32" type="application/vnd.vmware.vcloud.vdc+xml" name="Miami Environment 1"/>
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog" type="application/vnd.vmware.vcloud.catalog+xml" name="Miami Environment 1 Catalog"/>
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/32" type="application/vnd.vmware.vcloud.tasksList+xml" name="Miami Environment 1 Tasks List"/>
+</Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org1.0-vcd15.xml
new file mode 100755
index 0000000..d0ca5b7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/org1.0-vcd15.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Org xmlns="http://www.vmware.com/vcloud/v1" name="jclouds" type="application/vnd.vmware.vcloud.org+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml" name="orgVDC-jclouds-Tier1-PAYG" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.tasksList+xml" href="https://zone.myvcloud.com/api/v1.0/tasksList/c076f90a-397a-49fa-89b8-b294c1599cd0"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="jclouds" href="https://zone.myvcloud.com/api/v1.0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658/action/controlAccess"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.network+xml" name="orgNet-jclouds-External" href="https://zone.myvcloud.com/api/v1.0/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1"/>
+ <Description>Customer jclouds</Description>
+ <FullName>jclouds</FullName>
+</Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgList1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgList1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgList1.0-vcd15.xml
new file mode 100755
index 0000000..40f3cbe
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgList1.0-vcd15.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<OrgList xmlns="http://www.vmware.com/vcloud/v1" type="application/vnd.vmware.vcloud.orgList+xml" href="https://zone.myvcloud.com/api/v1.0/org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Org type="application/vnd.vmware.vcloud.org+xml" name="jclouds" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0"/>
+</OrgList>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orglist-savvis.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orglist-savvis.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orglist-savvis.xml
new file mode 100755
index 0000000..4de503b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orglist-savvis.xml
@@ -0,0 +1,3 @@
+<vApp:OrgList xmlns:vApp="http://www.vmware.com/vcloud/v0.8">
+<vApp:Org name="SAVVISStation Integration Testing" type="application/vnd.vmware.vcloud.org+xml" href="https://api.sandbox.symphonyvpdc.savvis.net/rest/api/v0.8/org/100000.0"/>
+</vApp:OrgList>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orglist.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orglist.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orglist.xml
new file mode 100755
index 0000000..e6117b3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orglist.xml
@@ -0,0 +1,3 @@
+<OrgList xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<Org href="https://services.vcloudexpress.terremark.com/api/v0.8/org/48" type="application/vnd.vmware.vcloud.org+xml" name="adrian@jclouds.org"/>
+</OrgList>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgnetwork-bridged.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgnetwork-bridged.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgnetwork-bridged.xml
new file mode 100755
index 0000000..cb2a0d3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgnetwork-bridged.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1" name="internet01" type="application/vnd.vmware.vcloud.network+xml" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcenterprise.bluelock.com/api/v1.0/org/9566014"/>
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>174.47.101.161</Gateway>
+ <Netmask>255.255.255.224</Netmask>
+ <Dns1>24.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>174.47.101.164</StartAddress>
+ <EndAddress>174.47.101.190</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <FenceMode>bridged</FenceMode>
+ </Configuration>
+</OrgNetwork>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgnetwork-isolated.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgnetwork-isolated.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgnetwork-isolated.xml
new file mode 100755
index 0000000..ac3a66a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/orgnetwork-isolated.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1" name="isolation01" type="application/vnd.vmware.vcloud.network+xml" href="https://vcenterprise.bluelock.com/api/v1.0/network/990419644" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcenterprise.bluelock.com/api/v1.0/org/9566014"/>
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>192.168.15.1</Gateway>
+ <Netmask>255.255.255.0</Netmask>
+ <Dns1>23.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>192.168.15.100</StartAddress>
+ <EndAddress>192.168.15.199</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>192.168.15.2</StartAddress>
+ <EndAddress>192.168.15.99</EndAddress>
+ </IpRange>
+ </DhcpService>
+ </Features>
+ </Configuration>
+</OrgNetwork>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/os.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/os.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/os.xml
new file mode 100755
index 0000000..3196a27
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/os.xml
@@ -0,0 +1,11 @@
+<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"
+ vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/" />
+</ovf:OperatingSystemSection>
\ No newline at end of file
[13/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
deleted file mode 100644
index b03727e..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import java.io.Closeable;
-import java.util.Set;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.Zone;
-import org.jclouds.location.functions.ZoneToEndpoint;
-import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
-import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsApi;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
-import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationApi;
-import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi;
-import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
-import org.jclouds.openstack.nova.v2_0.extensions.QuotaApi;
-import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeAttachmentApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi;
-import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
-import org.jclouds.openstack.nova.v2_0.features.ImageApi;
-import org.jclouds.openstack.nova.v2_0.features.ServerApi;
-import org.jclouds.openstack.v2_0.features.ExtensionApi;
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.EndpointParam;
-
-import com.google.common.base.Optional;
-import com.google.inject.Provides;
-
-/**
- * Provides synchronous access to Nova.
- * <p/>
- *
- * @see NovaAsyncApi
- * @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
- * />
- * @author Adrian Cole
- */
-public interface NovaApi extends Closeable {
- /**
- *
- * @return the Zone codes configured
- */
- @Provides
- @Zone
- Set<String> getConfiguredZones();
-
- /**
- * Provides synchronous access to availability zone features
- */
- @Delegate
- AvailabilityZoneAPI getAvailabilityZoneApi(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Server features.
- */
- @Delegate
- ServerApi getServerApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Flavor features.
- */
- @Delegate
- FlavorApi getFlavorApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Extension features.
- */
- @Delegate
- ExtensionApi getExtensionApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Image features.
- */
- @Delegate
- ImageApi getImageApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Floating IP features.
- */
- @Delegate
- Optional<? extends FloatingIPApi> getFloatingIPExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Security Group features.
- */
- @Delegate
- Optional<? extends SecurityGroupApi> getSecurityGroupExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Key Pair features.
- */
- @Delegate
- Optional<? extends KeyPairApi> getKeyPairExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Host Administration features.
- */
- @Delegate
- Optional<? extends HostAdministrationApi> getHostAdministrationExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Simple Tenant Usage features.
- */
- @Delegate
- Optional<? extends SimpleTenantUsageApi> getSimpleTenantUsageExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Virtual Interface features.
- */
- @Delegate
- Optional<? extends VirtualInterfaceApi> getVirtualInterfaceExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Server Extra Data features.
- */
- @Delegate
- Optional<? extends ServerWithSecurityGroupsApi> getServerWithSecurityGroupsExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Server Admin Actions features.
- */
- @Delegate
- Optional<? extends ServerAdminApi> getServerAdminExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Aggregate features.
- */
- @Delegate
- Optional<? extends HostAggregateApi> getHostAggregateExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Flavor extra specs features.
- */
- @Delegate
- Optional<? extends FlavorExtraSpecsApi> getFlavorExtraSpecsExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Quota features.
- */
- @Delegate
- Optional<? extends QuotaApi> getQuotaExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Quota Classes features.
- */
- @Delegate
- Optional<? extends QuotaClassApi> getQuotaClassExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Volume features.
- */
- @Delegate
- Optional<? extends VolumeApi> getVolumeExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Volume Attachment features.
- */
- @Delegate
- Optional<? extends VolumeAttachmentApi> getVolumeAttachmentExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides synchronous access to Volume Type features.
- */
- @Delegate
- Optional<? extends VolumeTypeApi> getVolumeTypeExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java
deleted file mode 100644
index ff87858..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
-import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS;
-import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS;
-import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.TIMEOUT_SECURITYGROUP_PRESENT;
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
-import org.jclouds.openstack.keystone.v2_0.config.MappedAuthenticationApiModule;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
-import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextModule;
-import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
-import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Module;
-
-/**
- * Implementation of {@link ApiMetadata} for Nova 2.0 API
- *
- * @author Adrian Cole
- */
-public class NovaApiMetadata extends BaseRestApiMetadata {
-
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaApi.class)} as
- * {@link NovaAsyncApi} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<NovaApi, NovaAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<NovaApi, NovaAsyncApi>>() {
- private static final long serialVersionUID = 1L;
- };
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- public NovaApiMetadata() {
- this(new Builder());
- }
-
- protected NovaApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
- // auth fail can happen while cloud-init applies keypair updates
- properties.setProperty("jclouds.ssh.max-retries", "7");
- properties.setProperty("jclouds.ssh.retry-auth", "true");
- properties.setProperty(SERVICE_TYPE, ServiceType.COMPUTE);
- properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS);
- properties.setProperty(AUTO_ALLOCATE_FLOATING_IPS, "false");
- properties.setProperty(AUTO_GENERATE_KEYPAIRS, "false");
- properties.setProperty(TIMEOUT_SECURITYGROUP_PRESENT, "500");
- // Keystone 1.1 expires tokens after 24 hours and allows renewal 1 hour
- // before expiry by default. We choose a value less than the latter
- // since the former persists between jclouds invocations.
- properties.setProperty(PROPERTY_SESSION_INTERVAL, 30 * 60 + "");
- return properties;
- }
-
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
-
- @SuppressWarnings("deprecation")
- protected Builder() {
- super(NovaApi.class, NovaAsyncApi.class);
- id("openstack-nova")
- .name("OpenStack Nova Diablo+ API")
- .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant")
- .credentialName("${password}")
- .endpointName("KeyStone base url ending in /v2.0/")
- .documentation(URI.create("http://api.openstack.org/"))
- .version("1.1")
- .defaultEndpoint("http://localhost:5000/v2.0/")
- .defaultProperties(NovaApiMetadata.defaultProperties())
- .view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
- .add(MappedAuthenticationApiModule.class)
- .add(KeystoneAuthenticationModule.class)
- .add(ZoneModule.class)
- .add(NovaParserModule.class)
- .add(NovaRestClientModule.class)
- .add(NovaComputeServiceContextModule.class).build());
- }
-
- @Override
- public NovaApiMetadata build() {
- return new NovaApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
deleted file mode 100644
index 9abea53..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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.openstack.nova.v2_0;
-
-import java.io.Closeable;
-import java.util.Set;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.Zone;
-import org.jclouds.location.functions.ZoneToEndpoint;
-import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
-import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeAttachmentAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeAsyncApi;
-import org.jclouds.openstack.nova.v2_0.features.FlavorAsyncApi;
-import org.jclouds.openstack.nova.v2_0.features.ImageAsyncApi;
-import org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi;
-import org.jclouds.openstack.v2_0.features.ExtensionAsyncApi;
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.EndpointParam;
-
-import com.google.common.base.Optional;
-import com.google.inject.Provides;
-
-/**
- * Provides asynchronous access to Nova via their REST API.
- * <p/>
- *
- * @see NovaApi
- * @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
- * />
- * @author Adrian Cole
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaApi.class)} as
- * {@link NovaAsyncApi} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-public interface NovaAsyncApi extends Closeable {
-
- /**
- *
- * @return the Zone codes configured
- */
- @Provides
- @Zone
- Set<String> getConfiguredZones();
-
- /**
- * Provides asynchronous access to availability zone features
- */
- @Delegate
- AvailabilityZoneAPI getAvailabilityZoneApi(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Server features.
- */
- @Delegate
- ServerAsyncApi getServerApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Flavor features.
- */
- @Delegate
- FlavorAsyncApi getFlavorApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Extension features.
- */
- @Delegate
- ExtensionAsyncApi getExtensionApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Image features.
- */
- @Delegate
- ImageAsyncApi getImageApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Floating IP features.
- */
- @Delegate
- Optional<? extends FloatingIPAsyncApi> getFloatingIPExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Security Group features.
- */
- @Delegate
- Optional<? extends SecurityGroupAsyncApi> getSecurityGroupExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Key Pair features.
- */
- @Delegate
- Optional<? extends KeyPairAsyncApi> getKeyPairExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Host Administration features.
- */
- @Delegate
- Optional<? extends HostAdministrationAsyncApi> getHostAdministrationExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Simple Tenant Usage features.
- */
- @Delegate
- Optional<? extends SimpleTenantUsageAsyncApi> getSimpleTenantUsageExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Virtual Interface features.
- */
- @Delegate
- Optional<? extends VirtualInterfaceAsyncApi> getVirtualInterfaceExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
-
- /**
- * Provides asynchronous access to Server Extra Data features.
- */
- @Delegate
- Optional<? extends ServerWithSecurityGroupsAsyncApi> getServerWithSecurityGroupsExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Server Admin Actions features.
- */
- @Delegate
- Optional<? extends ServerAdminAsyncApi> getServerAdminExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to HostAggregate features.
- */
- @Delegate
- Optional<? extends HostAggregateAsyncApi> getHostAggregateExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Flavor extra specs features.
- */
- @Delegate
- Optional<? extends FlavorExtraSpecsAsyncApi> getFlavorExtraSpecsExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Quota features.
- */
- @Delegate
- Optional<? extends QuotaAsyncApi> getQuotaExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Quota Classes features.
- */
- @Delegate
- Optional<? extends QuotaClassAsyncApi> getQuotaClassExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Volume features.
- */
- @Delegate
- Optional<? extends VolumeAsyncApi> getVolumeExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Volume features.
- */
- @Delegate
- Optional<? extends VolumeAttachmentAsyncApi> getVolumeAttachmentExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides asynchronous access to Volume Type features.
- */
- @Delegate
- Optional<? extends VolumeTypeAsyncApi> getVolumeTypeExtensionForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindKeyPairToJsonPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindKeyPairToJsonPayload.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindKeyPairToJsonPayload.java
deleted file mode 100644
index 882eac6..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindKeyPairToJsonPayload.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.binders;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.json.Json;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSortedMap;
-
-/**
- *
- * @author Adrian Cole
- */
-@Singleton
-public class BindKeyPairToJsonPayload extends BindToJsonPayload {
-
- @Inject
- public BindKeyPairToJsonPayload(Json jsonBinder) {
- super(jsonBinder);
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- return bindToRequest(request, (Object) ImmutableMap.of("keypair", ImmutableSortedMap.copyOf(postParams)));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindMetadataToJsonPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindMetadataToJsonPayload.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindMetadataToJsonPayload.java
deleted file mode 100644
index 3cf29d7..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindMetadataToJsonPayload.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.binders;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.json.Json;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.collect.ImmutableMap;
-
-/**
- *
- * @author Adrian Cole
- */
-@Singleton
-public class BindMetadataToJsonPayload extends BindToJsonPayload {
-
- @Inject
- public BindMetadataToJsonPayload(Json jsonBinder) {
- super(jsonBinder);
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- return bindToRequest(request,
- (Object) ImmutableMap.of("metadata", ImmutableMap.of(postParams.get("key"), postParams.get("value"))));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindSecurityGroupRuleToJsonPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindSecurityGroupRuleToJsonPayload.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindSecurityGroupRuleToJsonPayload.java
deleted file mode 100644
index cdd3df5..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/binders/BindSecurityGroupRuleToJsonPayload.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.instanceOf;
-import static com.google.common.collect.Iterables.find;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.json.Json;
-import org.jclouds.openstack.nova.v2_0.domain.Ingress;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@Singleton
-public class BindSecurityGroupRuleToJsonPayload extends BindToJsonPayload implements MapBinder {
- @Inject
- public BindSecurityGroupRuleToJsonPayload(Json jsonBinder) {
- super(jsonBinder);
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
- throw new IllegalStateException("BindCredentialsToJsonPayload needs parameters");
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- Builder<String, Object> payload = ImmutableMap.builder();
- payload.putAll(postParams);
- checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
- "this binder is only valid for GeneratedHttpRequests!");
- GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
-
- Ingress ingress = Ingress.class.cast(find(gRequest.getInvocation().getArgs(), instanceOf(Ingress.class)));
- payload.put("ip_protocol", ingress.getIpProtocol().toString());
- payload.put("from_port", ingress.getFromPort() + "");
- payload.put("to_port", ingress.getToPort() + "");
-
- return super.bindToRequest(request, ImmutableMap.of("security_group_rule", payload.build()));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java
deleted file mode 100644
index 7a10942..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
-import static org.jclouds.openstack.nova.v2_0.predicates.KeyPairPredicates.nameMatches;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.callables.RunScriptOnNode;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.TemplateBuilder;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.compute.extensions.SecurityGroupExtension;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.internal.BaseComputeService;
-import org.jclouds.compute.internal.PersistNodeCredentials;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
-import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
-import org.jclouds.compute.strategy.DestroyNodeStrategy;
-import org.jclouds.compute.strategy.GetImageStrategy;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.compute.strategy.InitializeRunScriptOnNodeOrPlaceInBadMap;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.compute.strategy.RebootNodeStrategy;
-import org.jclouds.compute.strategy.ResumeNodeStrategy;
-import org.jclouds.compute.strategy.SuspendNodeStrategy;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.Location;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
-import org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates;
-import org.jclouds.scriptbuilder.functions.InitAdminAccess;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class NovaComputeService extends BaseComputeService {
- protected final NovaApi novaApi;
- protected final LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap;
- protected final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
- protected final Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByZoneId;
- protected final GroupNamingConvention.Factory namingConvention;
-
- @Inject
- protected NovaComputeService(ComputeServiceContext context, Map<String, Credentials> credentialStore,
- @Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> sizes,
- @Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy,
- GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
- CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy,
- DestroyNodeStrategy destroyNodeStrategy, ResumeNodeStrategy startNodeStrategy,
- SuspendNodeStrategy stopNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
- @Named("DEFAULT") Provider<TemplateOptions> templateOptionsProvider,
- @Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
- @Named(TIMEOUT_NODE_TERMINATED) Predicate<AtomicReference<NodeMetadata>> nodeTerminated,
- @Named(TIMEOUT_NODE_SUSPENDED) Predicate<AtomicReference<NodeMetadata>> nodeSuspended,
- InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
- RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
- PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, NovaApi novaApi,
- LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap,
- LoadingCache<ZoneAndName, KeyPair> keyPairCache,
- Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByZoneId,
- GroupNamingConvention.Factory namingConvention, Optional<ImageExtension> imageExtension,
- Optional<SecurityGroupExtension> securityGroupExtension) {
- super(context, credentialStore, images, sizes, locations, listNodesStrategy, getImageStrategy,
- getNodeMetadataStrategy, runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy,
- startNodeStrategy, stopNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
- nodeTerminated, nodeSuspended, initScriptRunnerFactory, initAdminAccess, runScriptOnNodeFactory,
- persistNodeCredentials, timeouts, userExecutor, imageExtension, securityGroupExtension);
- this.novaApi = checkNotNull(novaApi, "novaApi");
- this.securityGroupMap = checkNotNull(securityGroupMap, "securityGroupMap");
- this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
- this.orphanedGroupsByZoneId = checkNotNull(orphanedGroupsByZoneId, "orphanedGroupsByZoneId");
- this.namingConvention = checkNotNull(namingConvention, "namingConvention");
- }
-
- @Override
- protected void cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes) {
- Multimap<String, String> zoneToZoneAndGroupNames = orphanedGroupsByZoneId.apply(deadNodes);
- for (Map.Entry<String, Collection<String>> entry : zoneToZoneAndGroupNames.asMap().entrySet()) {
- cleanOrphanedGroupsInZone(ImmutableSet.copyOf(entry.getValue()), entry.getKey());
- }
- }
-
- protected void cleanOrphanedGroupsInZone(Set<String> groups, String zoneId) {
- cleanupOrphanedSecurityGroupsInZone(groups, zoneId);
- cleanupOrphanedKeyPairsInZone(groups, zoneId);
- }
-
- private void cleanupOrphanedSecurityGroupsInZone(Set<String> groups, String zoneId) {
- Optional<? extends SecurityGroupApi> securityGroupApi = novaApi.getSecurityGroupExtensionForZone(zoneId);
- if (securityGroupApi.isPresent()) {
- for (String group : groups) {
- for (SecurityGroup securityGroup : Iterables.filter(securityGroupApi.get().list(),
- SecurityGroupPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
- ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, securityGroup.getName());
- logger.debug(">> deleting securityGroup(%s)", zoneAndName);
- securityGroupApi.get().delete(securityGroup.getId());
- // TODO: test this clear happens
- securityGroupMap.invalidate(zoneAndName);
- logger.debug("<< deleted securityGroup(%s)", zoneAndName);
- }
- }
- }
- }
-
- private void cleanupOrphanedKeyPairsInZone(Set<String> groups, String zoneId) {
- Optional<? extends KeyPairApi> keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId);
- if (keyPairApi.isPresent()) {
- for (String group : groups) {
- for (KeyPair pair : keyPairApi.get().list().filter(nameMatches(namingConvention.create().containsGroup(group)))) {
- ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName());
- logger.debug(">> deleting keypair(%s)", zoneAndName);
- keyPairApi.get().delete(pair.getName());
- // TODO: test this clear happens
- keyPairCache.invalidate(zoneAndName);
- logger.debug("<< deleted keypair(%s)", zoneAndName);
- }
- keyPairCache.invalidate(ZoneAndName.fromZoneAndName(zoneId,
- namingConvention.create().sharedNameForGroup(group)));
- }
- }
- }
-
- /**
- * returns template options, except of type {@link NovaTemplateOptions}.
- */
- @Override
- public NovaTemplateOptions templateOptions() {
- return NovaTemplateOptions.class.cast(super.templateOptions());
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java
deleted file mode 100644
index 0e24996..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.Iterables.contains;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.location.Zone;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.compute.functions.RemoveFloatingIpFromNodeAndDeallocate;
-import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
-import org.jclouds.openstack.nova.v2_0.domain.Flavor;
-import org.jclouds.openstack.nova.v2_0.domain.Image;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.domain.RebootType;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.ServerCreated;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.FlavorInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
-import org.jclouds.openstack.nova.v2_0.predicates.ImagePredicates;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
-
-/**
- * The adapter used by the NovaComputeServiceContextModule to interface the nova-specific domain
- * model to the computeService generic domain model.
- *
- * @author Matt Stephenson, Adrian Cole
- */
-public class NovaComputeServiceAdapter implements
- ComputeServiceAdapter<ServerInZone, FlavorInZone, ImageInZone, Location> {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- protected final NovaApi novaApi;
- protected final Supplier<Set<String>> zoneIds;
- protected final RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate;
- protected final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
-
- @Inject
- public NovaComputeServiceAdapter(NovaApi novaApi, @Zone Supplier<Set<String>> zoneIds,
- RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate,
- LoadingCache<ZoneAndName, KeyPair> keyPairCache) {
- this.novaApi = checkNotNull(novaApi, "novaApi");
- this.zoneIds = checkNotNull(zoneIds, "zoneIds");
- this.removeFloatingIpFromNodeAndDeallocate = checkNotNull(removeFloatingIpFromNodeAndDeallocate,
- "removeFloatingIpFromNodeAndDeallocate");
- this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
- }
-
- /**
- * Note that we do not validate extensions here, on basis that
- * {@link ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet} has already
- * done so.
- */
- @Override
- public NodeAndInitialCredentials<ServerInZone> createNodeWithGroupEncodedIntoName(String group, String name,
- Template template) {
-
- LoginCredentials.Builder credentialsBuilder = LoginCredentials.builder();
- NovaTemplateOptions templateOptions = template.getOptions().as(NovaTemplateOptions.class);
-
- CreateServerOptions options = new CreateServerOptions();
- options.metadata(metadataAndTagsAsCommaDelimitedValue(template.getOptions()));
- if (templateOptions.getSecurityGroupNames().isPresent())
- options.securityGroupNames(templateOptions.getSecurityGroupNames().get());
- options.userData(templateOptions.getUserData());
- options.diskConfig(templateOptions.getDiskConfig());
- options.configDrive(templateOptions.getConfigDrive());
- options.availabilityZone(templateOptions.getAvailabilityZone());
-
- if (templateOptions.getNovaNetworks() != null) {
- options.novaNetworks(templateOptions.getNovaNetworks());
- }
- if (templateOptions.getNetworks() != null) {
- options.networks(templateOptions.getNetworks());
- }
-
- Optional<String> privateKey = Optional.absent();
- if (templateOptions.getKeyPairName() != null) {
- options.keyPairName(templateOptions.getKeyPairName());
- KeyPair keyPair = keyPairCache.getIfPresent(ZoneAndName.fromZoneAndName(template.getLocation().getId(), templateOptions.getKeyPairName()));
- if (keyPair != null && keyPair.getPrivateKey() != null) {
- privateKey = Optional.of(keyPair.getPrivateKey());
- credentialsBuilder.privateKey(privateKey.get());
- }
- }
-
- String zoneId = template.getLocation().getId();
- String imageId = template.getImage().getProviderId();
- String flavorId = template.getHardware().getProviderId();
-
- logger.debug(">> creating new server zone(%s) name(%s) image(%s) flavor(%s) options(%s)", zoneId, name, imageId, flavorId, options);
- ServerCreated lightweightServer = novaApi.getServerApiForZone(zoneId).create(name, imageId, flavorId, options);
- Server server = novaApi.getServerApiForZone(zoneId).get(lightweightServer.getId());
-
- logger.trace("<< server(%s)", server.getId());
-
- ServerInZone serverInZone = new ServerInZone(server, zoneId);
- if (!privateKey.isPresent() && lightweightServer.getAdminPass().isPresent())
- credentialsBuilder.password(lightweightServer.getAdminPass().get());
- return new NodeAndInitialCredentials<ServerInZone>(serverInZone, serverInZone.slashEncode(), credentialsBuilder
- .build());
- }
-
- @Override
- public Iterable<FlavorInZone> listHardwareProfiles() {
- Builder<FlavorInZone> builder = ImmutableSet.builder();
- for (final String zoneId : zoneIds.get()) {
- builder.addAll(transform(novaApi.getFlavorApiForZone(zoneId).listInDetail().concat(),
- new Function<Flavor, FlavorInZone>() {
-
- @Override
- public FlavorInZone apply(Flavor arg0) {
- return new FlavorInZone(arg0, zoneId);
- }
-
- }));
- }
- return builder.build();
- }
-
- @Override
- public Iterable<ImageInZone> listImages() {
- Builder<ImageInZone> builder = ImmutableSet.builder();
- Set<String> zones = zoneIds.get();
- checkState(zones.size() > 0, "no zones found in supplier %s", zoneIds);
- for (final String zoneId : zones) {
- Set<? extends Image> images = novaApi.getImageApiForZone(zoneId).listInDetail().concat().toSet();
- if (images.size() == 0) {
- logger.debug("no images found in zone %s", zoneId);
- continue;
- }
- Iterable<? extends Image> active = filter(images, ImagePredicates.statusEquals(Image.Status.ACTIVE));
- if (images.size() == 0) {
- logger.debug("no images with status active in zone %s; non-active: %s", zoneId,
- transform(active, new Function<Image, String>() {
-
- @Override
- public String apply(Image input) {
- return Objects.toStringHelper("").add("id", input.getId()).add("status", input.getStatus())
- .toString();
- }
-
- }));
- continue;
- }
- builder.addAll(transform(active, new Function<Image, ImageInZone>() {
-
- @Override
- public ImageInZone apply(Image arg0) {
- return new ImageInZone(arg0, zoneId);
- }
-
- }));
- }
- return builder.build();
- }
-
- @Override
- public Iterable<ServerInZone> listNodes() {
- Builder<ServerInZone> builder = ImmutableSet.builder();
- for (final String zoneId : zoneIds.get()) {
- builder.addAll(novaApi.getServerApiForZone(zoneId).listInDetail().concat()
- .transform(new Function<Server, ServerInZone>() {
-
- @Override
- public ServerInZone apply(Server arg0) {
- return new ServerInZone(arg0, zoneId);
- }
-
- }));
- }
- return builder.build();
- }
-
- @Override
- public Iterable<ServerInZone> listNodesByIds(final Iterable<String> ids) {
- return filter(listNodes(), new Predicate<ServerInZone>() {
-
- @Override
- public boolean apply(ServerInZone server) {
- return contains(ids, server.slashEncode());
- }
- });
- }
-
- @Override
- public Iterable<Location> listLocations() {
- // locations provided by keystone
- return ImmutableSet.of();
- }
-
- @Override
- public ServerInZone getNode(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
- return server == null ? null : new ServerInZone(server, zoneAndId.getZone());
- }
-
- @Override
- public ImageInZone getImage(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- Image image = novaApi.getImageApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
- return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
- }
-
- @Override
- public void destroyNode(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- if (novaApi.getFloatingIPExtensionForZone(zoneAndId.getZone()).isPresent()) {
- try {
- removeFloatingIpFromNodeAndDeallocate.apply(zoneAndId);
- } catch (RuntimeException e) {
- logger.warn(e, "<< error removing and deallocating ip from node(%s): %s", id, e.getMessage());
- }
- }
- novaApi.getServerApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
- }
-
- @Override
- public void rebootNode(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- novaApi.getServerApiForZone(zoneAndId.getZone()).reboot(zoneAndId.getId(), RebootType.HARD);
- }
-
- @Override
- public void resumeNode(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
- novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().resume(zoneAndId.getId());
- }
- throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
- }
-
- @Override
- public void suspendNode(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
- novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().suspend(zoneAndId.getId());
- }
- throw new UnsupportedOperationException("suspend requires installation of the Admin Actions extension");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java
deleted file mode 100644
index 311d4ab..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.config;
-
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS;
-import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS;
-import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.TIMEOUT_SECURITYGROUP_PRESENT;
-import static org.jclouds.util.Predicates2.retry;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.compute.extensions.SecurityGroupExtension;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.functions.IdentityFunction;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.openstack.nova.v2_0.compute.NovaComputeService;
-import org.jclouds.openstack.nova.v2_0.compute.NovaComputeServiceAdapter;
-import org.jclouds.openstack.nova.v2_0.compute.extensions.NovaImageExtension;
-import org.jclouds.openstack.nova.v2_0.compute.extensions.NovaSecurityGroupExtension;
-import org.jclouds.openstack.nova.v2_0.compute.functions.CreateSecurityGroupIfNeeded;
-import org.jclouds.openstack.nova.v2_0.compute.functions.FlavorInZoneToHardware;
-import org.jclouds.openstack.nova.v2_0.compute.functions.ImageInZoneToImage;
-import org.jclouds.openstack.nova.v2_0.compute.functions.ImageToOperatingSystem;
-import org.jclouds.openstack.nova.v2_0.compute.functions.NovaSecurityGroupInZoneToSecurityGroup;
-import org.jclouds.openstack.nova.v2_0.compute.functions.NovaSecurityGroupToSecurityGroup;
-import org.jclouds.openstack.nova.v2_0.compute.functions.OrphanedGroupsByZoneId;
-import org.jclouds.openstack.nova.v2_0.compute.functions.SecurityGroupRuleToIpPermission;
-import org.jclouds.openstack.nova.v2_0.compute.functions.ServerInZoneToNodeMetadata;
-import org.jclouds.openstack.nova.v2_0.compute.loaders.CreateUniqueKeyPair;
-import org.jclouds.openstack.nova.v2_0.compute.loaders.FindSecurityGroupOrCreate;
-import org.jclouds.openstack.nova.v2_0.compute.loaders.LoadFloatingIpsForInstance;
-import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
-import org.jclouds.openstack.nova.v2_0.compute.strategy.ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.FlavorInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ServerInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
-import org.jclouds.openstack.nova.v2_0.predicates.FindSecurityGroupWithNameAndReturnTrue;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.Provides;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-/**
- * Module for building a compute service context for Nova
- *
- * @author Matt Stephenson
- */
-public class NovaComputeServiceContextModule extends
- ComputeServiceAdapterContextModule<ServerInZone, FlavorInZone, ImageInZone, Location> {
-
- @SuppressWarnings("unchecked")
- @Override
- protected void configure() {
- super.configure();
- bind(new TypeLiteral<ComputeServiceAdapter<ServerInZone, FlavorInZone, ImageInZone, Location>>() {
- }).to(NovaComputeServiceAdapter.class);
-
- bind(ComputeService.class).to(NovaComputeService.class);
-
- bind(new TypeLiteral<Function<ServerInZone, NodeMetadata>>() {
- }).to(ServerInZoneToNodeMetadata.class);
-
- bind(new TypeLiteral<Function<SecurityGroupRule, IpPermission>>() {
- }).to(SecurityGroupRuleToIpPermission.class);
-
- bind(new TypeLiteral<Function<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup, SecurityGroup>>() {
- }).to(NovaSecurityGroupToSecurityGroup.class);
-
- bind(new TypeLiteral<Function<SecurityGroupInZone, SecurityGroup>>() {
- }).to(NovaSecurityGroupInZoneToSecurityGroup.class);
-
- bind(new TypeLiteral<Function<Set<? extends NodeMetadata>, Multimap<String, String>>>() {
- }).to(OrphanedGroupsByZoneId.class);
-
- bind(new TypeLiteral<Function<ImageInZone, Image>>() {
- }).to(ImageInZoneToImage.class);
- bind(new TypeLiteral<Function<org.jclouds.openstack.nova.v2_0.domain.Image, OperatingSystem>>() {
- }).to(ImageToOperatingSystem.class);
-
- bind(new TypeLiteral<Function<FlavorInZone, Hardware>>() {
- }).to(FlavorInZoneToHardware.class);
-
- // we aren't converting location from a provider-specific type
- bind(new TypeLiteral<Function<Location, Location>>() {
- }).to(Class.class.cast(IdentityFunction.class));
-
- bind(TemplateOptions.class).to(NovaTemplateOptions.class);
-
- bind(new TypeLiteral<CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>>>() {
- }).annotatedWith(Names.named("FLOATINGIP")).to(LoadFloatingIpsForInstance.class);
-
- bind(new TypeLiteral<Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>>() {
- }).to(CreateSecurityGroupIfNeeded.class);
-
- bind(new TypeLiteral<CacheLoader<ZoneAndName, SecurityGroupInZone>>() {
- }).to(FindSecurityGroupOrCreate.class);
-
- bind(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class).to(
- ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
-
- bind(new TypeLiteral<CacheLoader<ZoneAndName, KeyPair>>() {
- }).to(CreateUniqueKeyPair.class);
-
- bind(new TypeLiteral<ImageExtension>() {
- }).to(NovaImageExtension.class);
-
- bind(new TypeLiteral<SecurityGroupExtension>() {
- }).to(NovaSecurityGroupExtension.class);
- }
-
- @Override
- protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
- return options.as(NovaTemplateOptions.class)
- .autoAssignFloatingIp(injector.getInstance(
- Key.get(boolean.class, Names.named(AUTO_ALLOCATE_FLOATING_IPS))))
- .generateKeyPair(injector.getInstance(
- Key.get(boolean.class, Names.named(AUTO_GENERATE_KEYPAIRS))));
- }
-
- @Provides
- @Singleton
- @Named("FLOATINGIP")
- protected LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> instanceToFloatingIps(
- @Named("FLOATINGIP") CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>> in) {
- return CacheBuilder.newBuilder().build(in);
- }
-
- @Provides
- @Singleton
- protected LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap(
- CacheLoader<ZoneAndName, SecurityGroupInZone> in) {
- return CacheBuilder.newBuilder().build(in);
- }
-
- @Override
- protected Map<OsFamily, LoginCredentials> osFamilyToCredentials(Injector injector) {
- return ImmutableMap.of(OsFamily.WINDOWS, LoginCredentials.builder().user("Administrator").build(),
- OsFamily.UBUNTU, LoginCredentials.builder().user("ubuntu").build());
- }
-
- @Provides
- @Singleton
- @Named("SECURITYGROUP_PRESENT")
- protected Predicate<AtomicReference<ZoneAndName>> securityGroupEventualConsistencyDelay(
- FindSecurityGroupWithNameAndReturnTrue in,
- @Named(TIMEOUT_SECURITYGROUP_PRESENT) long msDelay) {
- return retry(in, msDelay, 100l, MILLISECONDS);
- }
-
- @Provides
- @Singleton
- protected LoadingCache<ZoneAndName, KeyPair> keyPairMap(
- CacheLoader<ZoneAndName, KeyPair> in) {
- return CacheBuilder.newBuilder().build(in);
- }
-
- @Provides
- @Singleton
- protected Supplier<Map<String, Location>> createLocationIndexedById(
- @Memoized Supplier<Set<? extends Location>> locations) {
- return Suppliers.compose(new Function<Set<? extends Location>, Map<String, Location>>() {
-
- @SuppressWarnings("unchecked")
- @Override
- public Map<String, Location> apply(Set<? extends Location> arg0) {
- // TODO: find a nice way to get rid of this cast.
- Iterable<Location> locations = (Iterable<Location>) arg0;
- return Maps.uniqueIndex(locations, new Function<Location, String>() {
-
- @Override
- public String apply(Location arg0) {
- return arg0.getId();
- }
-
- });
- }
- }, locations);
-
- }
-
- @VisibleForTesting
- public static final Map<Server.Status, NodeMetadata.Status> toPortableNodeStatus = ImmutableMap
- .<Server.Status, NodeMetadata.Status> builder().put(Server.Status.ACTIVE, NodeMetadata.Status.RUNNING)//
- .put(Server.Status.SUSPENDED, NodeMetadata.Status.SUSPENDED)//
- .put(Server.Status.DELETED, NodeMetadata.Status.TERMINATED)//
- .put(Server.Status.PAUSED, NodeMetadata.Status.SUSPENDED)//
- .put(Server.Status.RESIZE, NodeMetadata.Status.PENDING)//
- .put(Server.Status.VERIFY_RESIZE, NodeMetadata.Status.PENDING)//
- .put(Server.Status.REVERT_RESIZE, NodeMetadata.Status.PENDING)//
- .put(Server.Status.BUILD, NodeMetadata.Status.PENDING)//
- .put(Server.Status.PASSWORD, NodeMetadata.Status.PENDING)//
- .put(Server.Status.REBUILD, NodeMetadata.Status.PENDING)//
- .put(Server.Status.ERROR, NodeMetadata.Status.ERROR)//
- .put(Server.Status.REBOOT, NodeMetadata.Status.PENDING)//
- .put(Server.Status.HARD_REBOOT, NodeMetadata.Status.PENDING)//
- .put(Server.Status.UNKNOWN, NodeMetadata.Status.UNRECOGNIZED)//
- .put(Server.Status.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED).build();
-
- @Singleton
- @Provides
- protected Map<Server.Status, NodeMetadata.Status> toPortableNodeStatus() {
- return toPortableNodeStatus;
- }
-
- @VisibleForTesting
- public static final Map<org.jclouds.openstack.nova.v2_0.domain.Image.Status, Image.Status> toPortableImageStatus = ImmutableMap
- .<org.jclouds.openstack.nova.v2_0.domain.Image.Status, Image.Status> builder()
- .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.ACTIVE, Image.Status.AVAILABLE)
- .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.SAVING, Image.Status.PENDING)
- .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.DELETED, Image.Status.DELETED)
- .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.ERROR, Image.Status.ERROR)
- .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.UNKNOWN, Image.Status.UNRECOGNIZED)
- .put(org.jclouds.openstack.nova.v2_0.domain.Image.Status.UNRECOGNIZED, Image.Status.UNRECOGNIZED).build();
-
- @Singleton
- @Provides
- protected Map<org.jclouds.openstack.nova.v2_0.domain.Image.Status, Image.Status> toPortableImageStatus() {
- return toPortableImageStatus;
- }
-
- @Override
- protected Optional<ImageExtension> provideImageExtension(Injector i) {
- return Optional.of(i.getInstance(ImageExtension.class));
- }
-
- @Override
- protected Optional<SecurityGroupExtension> provideSecurityGroupExtension(Injector i) {
- return Optional.of(i.getInstance(SecurityGroupExtension.class));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtension.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtension.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtension.java
deleted file mode 100644
index f8fd4d9..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaImageExtension.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.extensions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.Iterables.find;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_IMAGE_AVAILABLE;
-import static org.jclouds.location.predicates.LocationPredicates.idEquals;
-
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.CloneImageTemplate;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.ImageTemplate;
-import org.jclouds.compute.domain.ImageTemplateBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.Atomics;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.UncheckedTimeoutException;
-
-/**
- * Nova implementation of {@link ImageExtension}
- *
- * @author David Alves
- *
- */
-@Singleton
-public class NovaImageExtension implements ImageExtension {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final NovaApi novaApi;
- private final ListeningExecutorService userExecutor;
- private final Supplier<Set<? extends Location>> locations;
- private final Predicate<AtomicReference<Image>> imageAvailablePredicate;
-
- @Inject
- public NovaImageExtension(NovaApi novaApi, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- @Memoized Supplier<Set<? extends Location>> locations,
- @Named(TIMEOUT_IMAGE_AVAILABLE) Predicate<AtomicReference<Image>> imageAvailablePredicate) {
- this.novaApi = checkNotNull(novaApi, "novaApi");
- this.userExecutor = checkNotNull(userExecutor, "userExecutor");
- this.locations = checkNotNull(locations, "locations");
- this.imageAvailablePredicate = checkNotNull(imageAvailablePredicate, "imageAvailablePredicate");
- }
-
- @Override
- public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
- if (server == null)
- throw new NoSuchElementException("Cannot find server with id: " + zoneAndId);
- CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
- return template;
- }
-
- @Override
- public ListenableFuture<Image> createImage(ImageTemplate template) {
- checkState(template instanceof CloneImageTemplate,
- " openstack-nova only supports creating images through cloning.");
- CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
- ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());
-
- String newImageId = novaApi.getServerApiForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
- cloneTemplate.getName(), sourceImageZoneAndId.getId());
-
- final ZoneAndId targetImageZoneAndId = ZoneAndId.fromZoneAndId(sourceImageZoneAndId.getZone(), newImageId);
-
- logger.info(">> Registered new Image %s, waiting for it to become available.", newImageId);
-
- final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
- .location(find(locations.get(), idEquals(targetImageZoneAndId.getZone())))
- .id(targetImageZoneAndId.slashEncode())
- .providerId(targetImageZoneAndId.getId())
- .description(cloneTemplate.getName())
- .operatingSystem(OperatingSystem.builder().description(cloneTemplate.getName()).build())
- .status(Image.Status.PENDING).build());
-
- return userExecutor.submit(new Callable<Image>() {
- @Override
- public Image call() throws Exception {
- if (imageAvailablePredicate.apply(image))
- return image.get();
- // TODO: get rid of the expectation that the image will be available, as it is very brittle
- throw new UncheckedTimeoutException("Image was not created within the time limit: " + image.get());
- }
- });
- }
-
- @Override
- public boolean deleteImage(String id) {
- ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
- try {
- this.novaApi.getImageApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
-}
[14/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/versions-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/versions-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/versions-vcd15.xml
new file mode 100755
index 0000000..ed24d3a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/versions-vcd15.xml
@@ -0,0 +1,906 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SupportedVersions xmlns="http://www.vmware.com/vcloud/versions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/versions https://zone.myvcloud.com/api/versions/schema/versions.xsd">
+ <VersionInfo>
+ <Version>1.0</Version>
+ <LoginUrl>https://zone.myvcloud.com/api/v1.0/login</LoginUrl>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.customizationSection+xml</MediaType>
+ <ComplexTypeName>CustomizationSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.catalogItem+xml</MediaType>
+ <ComplexTypeName>CatalogItemType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkConnectionSection+xml</MediaType>
+ <ComplexTypeName>NetworkConnectionSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.owner+xml</MediaType>
+ <ComplexTypeName>OwnerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.licensingReportList+xml</MediaType>
+ <ComplexTypeName>LicensingReportListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.group+xml</MediaType>
+ <ComplexTypeName>GroupType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vdc+xml</MediaType>
+ <ComplexTypeName>AdminVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.licensingReport+xml</MediaType>
+ <ComplexTypeName>LicensingReportType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmAsVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>ImportVmAsVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwVimServerReferences+xml</MediaType>
+ <ComplexTypeName>VMWVimServerReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vm+xml</MediaType>
+ <ComplexTypeName>VmType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>UploadVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.composeVAppParams+xml</MediaType>
+ <ComplexTypeName>ComposeVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.orgList+xml</MediaType>
+ <ComplexTypeName>OrgListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneMediaParams+xml</MediaType>
+ <ComplexTypeName>CloneMediaParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vmPendingQuestion+xml</MediaType>
+ <ComplexTypeName>VmPendingQuestionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwHostReferences+xml</MediaType>
+ <ComplexTypeName>VMWHostReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.undeployVAppParams+xml</MediaType>
+ <ComplexTypeName>UndeployVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.leaseSettingsSection+xml</MediaType>
+ <ComplexTypeName>LeaseSettingsSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.network+xml</MediaType>
+ <ComplexTypeName>OrgNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.deployVAppParams+xml</MediaType>
+ <ComplexTypeName>DeployVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>CloneVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.media+xml</MediaType>
+ <ComplexTypeName>MediaType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwprovidervdc+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vAppTemplate+xml</MediaType>
+ <ComplexTypeName>VAppTemplateType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.org+xml</MediaType>
+ <ComplexTypeName>OrgType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vApp+xml</MediaType>
+ <ComplexTypeName>VAppType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.catalog+xml</MediaType>
+ <ComplexTypeName>CatalogType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwNetworkPool+xml</MediaType>
+ <ComplexTypeName>VMWNetworkPoolType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.tasksList+xml</MediaType>
+ <ComplexTypeName>TasksListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vdcReferences+xml</MediaType>
+ <ComplexTypeName>VdcReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.screenTicket+xml</MediaType>
+ <ComplexTypeName>ScreenTicketType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.prepareHostParams+xml</MediaType>
+ <ComplexTypeName>PrepareHostParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vcloud+xml</MediaType>
+ <ComplexTypeName>VCloudType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.publishCatalogParams+xml</MediaType>
+ <ComplexTypeName>PublishCatalogParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkConfigSection+xml</MediaType>
+ <ComplexTypeName>NetworkConfigSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.resourcePoolList+xml</MediaType>
+ <ComplexTypeName>ResourcePoolListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.right+xml</MediaType>
+ <ComplexTypeName>RightType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwExtension+xml</MediaType>
+ <ComplexTypeName>VMWExtensionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmAsVAppParams+xml</MediaType>
+ <ComplexTypeName>ImportVmAsVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwvirtualcenter+xml</MediaType>
+ <ComplexTypeName>VimServerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmsObjectRefsList+xml</MediaType>
+ <ComplexTypeName>VmObjectRefsListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.controlAccess+xml</MediaType>
+ <ComplexTypeName>ControlAccessParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vdc+xml</MediaType>
+ <ComplexTypeName>VdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.role+xml</MediaType>
+ <ComplexTypeName>RoleType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneVAppParams+xml</MediaType>
+ <ComplexTypeName>CloneVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.host+xml</MediaType>
+ <ComplexTypeName>HostType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organization+xml</MediaType>
+ <ComplexTypeName>AdminOrgType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.providervdc+xml</MediaType>
+ <ComplexTypeName>ProviderVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.user+xml</MediaType>
+ <ComplexTypeName>UserType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwProviderVdcReferences+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml</MediaType>
+ <ComplexTypeName>MediaInsertOrEjectParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>InstantiateVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.rasdItemsList+xml</MediaType>
+ <ComplexTypeName>RasdItemsListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.task+xml</MediaType>
+ <ComplexTypeName>TaskType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwNetworkPoolReferences+xml</MediaType>
+ <ComplexTypeName>VMWNetworkPoolReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.guestCustomizationSection+xml</MediaType>
+ <ComplexTypeName>GuestCustomizationSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.recomposeVAppParams+xml</MediaType>
+ <ComplexTypeName>RecomposeVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importMediaParams+xml</MediaType>
+ <ComplexTypeName>ImportMediaParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwExternalNetworkReferences+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwexternalnet+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.captureVAppParams+xml</MediaType>
+ <ComplexTypeName>CaptureVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vmPendingAnswer+xml</MediaType>
+ <ComplexTypeName>VmQuestionAnswerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.registerVimServerParams+xml</MediaType>
+ <ComplexTypeName>RegisterVimServerParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.rasdItem+xml</MediaType>
+ <ComplexTypeName>RASD_Type</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.startupSection+xml</MediaType>
+ <ComplexTypeName>StartupSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.virtualHardwareSection+xml</MediaType>
+ <ComplexTypeName>VirtualHardwareSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.operatingSystemSection+xml</MediaType>
+ <ComplexTypeName>OperatingSystemSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkSection+xml</MediaType>
+ <ComplexTypeName>NetworkSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ </VersionInfo>
+ <VersionInfo>
+ <Version>1.5</Version>
+ <LoginUrl>https://zone.myvcloud.com/api/sessions</LoginUrl>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>InstantiateVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwProviderVdcReferences+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.customizationSection+xml</MediaType>
+ <ComplexTypeName>CustomizationSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.prepareHostParams+xml</MediaType>
+ <ComplexTypeName>PrepareHostParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.relocateVmParams+xml</MediaType>
+ <ComplexTypeName>RelocateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.org+xml</MediaType>
+ <ComplexTypeName>OrgType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwExternalNetworkReferences+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkConnectionSection+xml</MediaType>
+ <ComplexTypeName>NetworkConnectionSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.host+xml</MediaType>
+ <ComplexTypeName>HostType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.catalogItem+xml</MediaType>
+ <ComplexTypeName>CatalogItemType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.owner+xml</MediaType>
+ <ComplexTypeName>OwnerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vdc+xml</MediaType>
+ <ComplexTypeName>VdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vdc+xml</MediaType>
+ <ComplexTypeName>AdminVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.catalog+xml</MediaType>
+ <ComplexTypeName>AdminCatalogType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.recomposeVAppParams+xml</MediaType>
+ <ComplexTypeName>RecomposeVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmIntoExistingVAppParams+xml</MediaType>
+ <ComplexTypeName>ImportVmIntoExistingVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskExtensionRequestUpdateProgressOperationParams+xml</MediaType>
+ <ComplexTypeName>TaskExtensionRequestUpdateProgressParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.catalog+xml</MediaType>
+ <ComplexTypeName>CatalogType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>CloneVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.providervdc+xml</MediaType>
+ <ComplexTypeName>ProviderVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmsObjectRefsList+xml</MediaType>
+ <ComplexTypeName>VmObjectRefsListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.undeployVAppParams+xml</MediaType>
+ <ComplexTypeName>UndeployVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vdcReferences+xml</MediaType>
+ <ComplexTypeName>VdcReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.systemPasswordPolicySettings+xml</MediaType>
+ <ComplexTypeName>SystemPasswordPolicySettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vApp+xml</MediaType>
+ <ComplexTypeName>VAppType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskExtensionRequest+xml</MediaType>
+ <ComplexTypeName>TaskExtensionRequestType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vimServerNetworks+xml</MediaType>
+ <ComplexTypeName>VimObjectRefListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwprovidervdc+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.orgSettings+xml</MediaType>
+ <ComplexTypeName>OrgSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.captureVAppParams+xml</MediaType>
+ <ComplexTypeName>CaptureVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.screenTicket+xml</MediaType>
+ <ComplexTypeName>ScreenTicketType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.runtimeInfoSection+xml</MediaType>
+ <ComplexTypeName>RuntimeInfoSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.tasksList+xml</MediaType>
+ <ComplexTypeName>TasksListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.amqpSettingsTest+xml</MediaType>
+ <ComplexTypeName>AmqpSettingsTestType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.extensionSettings+xml</MediaType>
+ <ComplexTypeName>TaskExtensionSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmAsVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>ImportVmAsVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organizationGeneralSettings+xml</MediaType>
+ <ComplexTypeName>OrgGeneralSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.registerVimServerParams+xml</MediaType>
+ <ComplexTypeName>RegisterVimServerParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.network+xml</MediaType>
+ <ComplexTypeName>OrgNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>UploadVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.datastore+xml</MediaType>
+ <ComplexTypeName>DatastoreType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.metadata+xml</MediaType>
+ <ComplexTypeName>MetadataType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.licensingReportList+xml</MediaType>
+ <ComplexTypeName>LicensingReportListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwNetworkPool+xml</MediaType>
+ <ComplexTypeName>VMWNetworkPoolType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.systemSettings+xml</MediaType>
+ <ComplexTypeName>SystemSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwHostReferences+xml</MediaType>
+ <ComplexTypeName>VMWHostReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskExtensionRequestOperationParams+xml</MediaType>
+ <ComplexTypeName>TaskExtensionRequestOperationParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.metadata.value+xml</MediaType>
+ <ComplexTypeName>MetadataValueType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskOperationList+xml</MediaType>
+ <ComplexTypeName>TaskOperationListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.media+xml</MediaType>
+ <ComplexTypeName>MediaType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.productSections+xml</MediaType>
+ <ComplexTypeName>ProductSectionListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.amqpSettings+xml</MediaType>
+ <ComplexTypeName>AmqpSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vAppTemplate+xml</MediaType>
+ <ComplexTypeName>VAppTemplateType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.deployVAppParams+xml</MediaType>
+ <ComplexTypeName>DeployVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmIntoExistingVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>ImportVmIntoExistingVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.resourcePoolList+xml</MediaType>
+ <ComplexTypeName>ResourcePoolListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkConfigSection+xml</MediaType>
+ <ComplexTypeName>NetworkConfigSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.OrganizationVdcResourcePoolSet+xml</MediaType>
+ <ComplexTypeName>OrganizationResourcePoolSetType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organizationPasswordPolicySettings+xml</MediaType>
+ <ComplexTypeName>OrgPasswordPolicySettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.publishCatalogParams+xml</MediaType>
+ <ComplexTypeName>PublishCatalogParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwExtension+xml</MediaType>
+ <ComplexTypeName>VMWExtensionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml</MediaType>
+ <ComplexTypeName>MediaInsertOrEjectParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vmPendingQuestion+xml</MediaType>
+ <ComplexTypeName>VmPendingQuestionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.notificationsSettings+xml</MediaType>
+ <ComplexTypeName>NotificationsSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.ldapUserSettings+xml</MediaType>
+ <ComplexTypeName>LdapUserAttributesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.right+xml</MediaType>
+ <ComplexTypeName>RightType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.ldapSettings+xml</MediaType>
+ <ComplexTypeName>LdapSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organization+xml</MediaType>
+ <ComplexTypeName>AdminOrgType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.orgList+xml</MediaType>
+ <ComplexTypeName>OrgListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml</MediaType>
+ <ComplexTypeName>OrgVAppTemplateLeaseSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwVimServerReferences+xml</MediaType>
+ <ComplexTypeName>VMWVimServerReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwexternalnet+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.entity+xml</MediaType>
+ <ComplexTypeName>EntityType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneMediaParams+xml</MediaType>
+ <ComplexTypeName>CloneMediaParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.licensingReport+xml</MediaType>
+ <ComplexTypeName>LicensingReportType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importMediaParams+xml</MediaType>
+ <ComplexTypeName>ImportMediaParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.resourcePoolSetUpdateParams+xml</MediaType>
+ <ComplexTypeName>UpdateResourcePoolSetParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskExtensionRequestList+xml</MediaType>
+ <ComplexTypeName>ReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vmPendingAnswer+xml</MediaType>
+ <ComplexTypeName>VmQuestionAnswerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.rasdItemsList+xml</MediaType>
+ <ComplexTypeName>RasdItemsListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.generalSettings+xml</MediaType>
+ <ComplexTypeName>GeneralSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwNetworkPoolReferences+xml</MediaType>
+ <ComplexTypeName>VMWNetworkPoolReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.group+xml</MediaType>
+ <ComplexTypeName>GroupType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.controlAccess+xml</MediaType>
+ <ComplexTypeName>ControlAccessParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.ldapGroupSettings+xml</MediaType>
+ <ComplexTypeName>LdapGroupAttributesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.user+xml</MediaType>
+ <ComplexTypeName>UserType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vcloud+xml</MediaType>
+ <ComplexTypeName>VCloudType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.uberAdminSettings+xml</MediaType>
+ <ComplexTypeName>UberAdminSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwvirtualcenter+xml</MediaType>
+ <ComplexTypeName>VimServerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.leaseSettingsSection+xml</MediaType>
+ <ComplexTypeName>LeaseSettingsSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.composeVAppParams+xml</MediaType>
+ <ComplexTypeName>ComposeVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organizationEmailSettings+xml</MediaType>
+ <ComplexTypeName>OrgEmailSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vm+xml</MediaType>
+ <ComplexTypeName>VmType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwProviderVdcResourcePoolSet+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcResourcePoolSetType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneVAppParams+xml</MediaType>
+ <ComplexTypeName>CloneVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.guestCustomizationSection+xml</MediaType>
+ <ComplexTypeName>GuestCustomizationSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.task+xml</MediaType>
+ <ComplexTypeName>TaskType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.session+xml</MediaType>
+ <ComplexTypeName>SessionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vAppLeaseSettings+xml</MediaType>
+ <ComplexTypeName>OrgLeaseSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmAsVAppParams+xml</MediaType>
+ <ComplexTypeName>ImportVmAsVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.role+xml</MediaType>
+ <ComplexTypeName>RoleType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.rasdItem+xml</MediaType>
+ <ComplexTypeName>RASD_Type</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.startupSection+xml</MediaType>
+ <ComplexTypeName>StartupSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.virtualHardwareSection+xml</MediaType>
+ <ComplexTypeName>VirtualHardwareSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.operatingSystemSection+xml</MediaType>
+ <ComplexTypeName>OperatingSystemSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkSection+xml</MediaType>
+ <ComplexTypeName>NetworkSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vAppNetwork+xml</MediaType>
+ <ComplexTypeName>VAppNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.network+xml</MediaType>
+ <ComplexTypeName>NetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.orgNetwork+xml</MediaType>
+ <ComplexTypeName>OrgNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwexternalnet+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ </VersionInfo>
+</SupportedVersions>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/versions.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/versions.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/versions.xml
new file mode 100755
index 0000000..4651754
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/versions.xml
@@ -0,0 +1,7 @@
+<SupportedVersions xmlns="http://www.vmware.com/vcloud/versions"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <VersionInfo>
+ <Version>0.8</Version>
+ <LoginUrl>https://services.vcloudexpress.terremark.com/api/v0.8/login</LoginUrl>
+ </VersionInfo>
+</SupportedVersions>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/virtualhardwaresection.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/virtualhardwaresection.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/virtualhardwaresection.xml
new file mode 100755
index 0000000..24a0dd6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/virtualhardwaresection.xml
@@ -0,0 +1,118 @@
+
+<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"
+ vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>RHEL5</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:01:f2</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="174.47.101.164"
+ vcloud:primaryNetworkConnection="true"
+ vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="30720"
+ vcloud:busType="6" vcloud:busSubType="lsilogic" />
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>384 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>384</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ </ovf:Item>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/media" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+</ovf:VirtualHardwareSection>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vm-rhel-off-static.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vm-rhel-off-static.xml b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vm-rhel-off-static.xml
new file mode 100755
index 0000000..1df38a3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/resources/vm-rhel-off-static.xml
@@ -0,0 +1,197 @@
+<Vm xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ deployed="false" status="8" name="RHEL5"
+ type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="power:powerOn"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/power/action/powerOn" />
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/action/deploy" />
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
+ <Link rel="remove"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
+ <Link rel="screen:thumbnail"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen" />
+ <Link rel="screen:acquireTicket"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen/action/acquireTicket" />
+ <Link rel="media:insertMedia"
+ type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/insertMedia" />
+ <Link rel="media:ejectMedia"
+ type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/ejectMedia" />
+ <Description />
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"
+ vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>RHEL5</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:01:f2</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="174.47.101.164"
+ vcloud:primaryNetworkConnection="true"
+ vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="30720"
+ vcloud:busType="6" vcloud:busSubType="lsilogic" />
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>384 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>384</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ </ovf:Item>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/media" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"
+ vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/" />
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.164</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f2</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/" />
+ </NetworkConnectionSection>
+ <GuestCustomizationSection
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>2087535248</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>cat > /root/foo.txt<<EOF
+I '"love"' {asc|!}*&
+EOF
+</CustomizationScript>
+ <ComputerName>RHEL5</ComputerName>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/" />
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>10_rhel_template</VAppScopedLocalId>
+</Vm>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/README.txt
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/README.txt b/dependencies/jclouds/openstack-nova/1.7.1-stratos/README.txt
deleted file mode 100755
index 7162c0f..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/README.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# The jclouds API for OpenStack Nova
-#
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/pom.xml b/dependencies/jclouds/openstack-nova/1.7.1-stratos/pom.xml
deleted file mode 100644
index e022595..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/pom.xml
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-project</artifactId>
- <version>1.7.1</version>
- </parent>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>openstack-nova</artifactId>
- <version>1.7.1-stratos</version>
- <name>jclouds openstack-nova api</name>
- <description>jclouds components to access an implementation of OpenStack Nova</description>
- <packaging>bundle</packaging>
-
- <properties>
- <jclouds.version>1.7.1</jclouds.version>
- <!-- keystone endpoint -->
- <test.openstack-nova.endpoint>http://localhost:5000/v2.0/</test.openstack-nova.endpoint>
- <!-- keystone version -->
- <test.openstack-nova.api-version>1.1</test.openstack-nova.api-version>
- <test.openstack-nova.build-version />
- <test.openstack-nova.identity>FIXME_IDENTITY</test.openstack-nova.identity>
- <test.openstack-nova.credential>FIXME_CREDENTIALS</test.openstack-nova.credential>
- <test.openstack-nova.template />
- <test.jclouds.openstack-nova.auto-allocate-floating-ips>false</test.jclouds.openstack-nova.auto-allocate-floating-ips>
- <test.jclouds.keystone.credential-type>passwordCredentials</test.jclouds.keystone.credential-type>
-
- <jclouds.osgi.export>org.jclouds.openstack.nova.v2_0*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>
- org.jclouds.compute.internal;version="${jclouds.version}",
- org.jclouds.rest.internal;version="${jclouds.version}",
- org.jclouds*;version="${jclouds.version}",
- *
- </jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>openstack-keystone</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${jclouds.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>openstack-keystone</artifactId>
- <version>${jclouds.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${jclouds.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${jclouds.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-slf4j</artifactId>
- <version>${jclouds.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <test.openstack-nova.endpoint>${test.openstack-nova.endpoint}</test.openstack-nova.endpoint>
- <test.openstack-nova.api-version>${test.openstack-nova.api-version}</test.openstack-nova.api-version>
- <test.openstack-nova.build-version>${test.openstack-nova.build-version}</test.openstack-nova.build-version>
- <test.openstack-nova.identity>${test.openstack-nova.identity}</test.openstack-nova.identity>
- <test.openstack-nova.credential>${test.openstack-nova.credential}</test.openstack-nova.credential>
- <test.openstack-nova.template>${test.openstack-nova.template}</test.openstack-nova.template>
- <test.jclouds.openstack-nova.auto-allocate-floating-ips>${test.jclouds.openstack-nova.auto-allocate-floating-ips}</test.jclouds.openstack-nova.auto-allocate-floating-ips>
- <test.jclouds.keystone.credential-type>${test.jclouds.keystone.credential-type}</test.jclouds.keystone.credential-type>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-
-</project>
[11/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java
deleted file mode 100644
index b85dfd4..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java
+++ /dev/null
@@ -1,649 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.options;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Strings.emptyToNull;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Set;
-
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.openstack.nova.v2_0.domain.Network;
-import org.jclouds.openstack.nova.v2_0.options.CreateServerOptions;
-import org.jclouds.scriptbuilder.domain.Statement;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Contains options supported in the {@code ComputeService#runNode} operation on the
- * "openstack-nova" provider. <h2>Usage</h2> The recommended way to instantiate a
- * NovaTemplateOptions object is to statically import NovaTemplateOptions.* and invoke a static
- * creation method followed by an instance mutator (if needed):
- * <p/>
- * <code>
- * import static org.jclouds.aws.ec2.compute.options.NovaTemplateOptions.Builder.*;
- * <p/>
- * ComputeService api = // get connection
- * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
- * Set<? extends NodeMetadata> set = api.createNodesInGroup(tag, 2, templateBuilder.build());
- * <code>
- *
- * @author Adam Lowe
- */
-public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
- @Override
- public NovaTemplateOptions clone() {
- NovaTemplateOptions options = new NovaTemplateOptions();
- copyTo(options);
- return options;
- }
-
- @Override
- public void copyTo(TemplateOptions to) {
- super.copyTo(to);
- if (to instanceof NovaTemplateOptions) {
- NovaTemplateOptions eTo = NovaTemplateOptions.class.cast(to);
- eTo.autoAssignFloatingIp(shouldAutoAssignFloatingIp());
- if (getSecurityGroupNames().isPresent())
- eTo.securityGroupNames(getSecurityGroupNames().get());
- eTo.generateKeyPair(shouldGenerateKeyPair());
- eTo.keyPairName(getKeyPairName());
- eTo.availabilityZone(getAvailabilityZone());
- if (getUserData() != null) {
- eTo.userData(getUserData());
- }
- if (getDiskConfig() != null) {
- eTo.diskConfig(getDiskConfig());
- }
-
- eTo.configDrive(getConfigDrive());
- eTo.novaNetworks(getNovaNetworks());
- }
- }
-
- protected boolean autoAssignFloatingIp = false;
- protected Optional<Set<String>> securityGroupNames = Optional.absent();
- protected boolean generateKeyPair = false;
- protected String keyPairName;
- protected byte[] userData;
- protected String diskConfig;
- protected boolean configDrive;
- protected String availabilityZone;
- protected Set<Network> novaNetworks;
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- NovaTemplateOptions that = NovaTemplateOptions.class.cast(o);
- return super.equals(that) && equal(this.autoAssignFloatingIp, that.autoAssignFloatingIp)
- && equal(this.securityGroupNames, that.securityGroupNames)
- && equal(this.generateKeyPair, that.generateKeyPair)
- && equal(this.keyPairName, that.keyPairName)
- && Arrays.equals(this.userData, that.userData)
- && equal(this.diskConfig, that.diskConfig)
- && equal(this.configDrive, that.configDrive)
- && equal(this.availabilityZone, that.availabilityZone)
- && equal(this.novaNetworks, that.novaNetworks);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), autoAssignFloatingIp, securityGroupNames, generateKeyPair, keyPairName, userData, diskConfig, configDrive,availabilityZone, novaNetworks);
- }
-
- @Override
- public ToStringHelper string() {
- ToStringHelper toString = super.string();
- if (!autoAssignFloatingIp)
- toString.add("autoAssignFloatingIp", autoAssignFloatingIp);
- if (securityGroupNames.isPresent())
- toString.add("securityGroupNames", securityGroupNames.get());
- if (generateKeyPair)
- toString.add("generateKeyPair", generateKeyPair);
- toString.add("keyPairName", keyPairName);
- toString.add("userData", userData);
- toString.add("diskConfig", diskConfig);
- toString.add("configDrive", configDrive);
- toString.add("availabilityZone", availabilityZone);
- toString.add("novaNetworks", novaNetworks);
- return toString;
- }
-
- public static final NovaTemplateOptions NONE = new NovaTemplateOptions();
-
- /**
- * @see #shouldAutoAssignFloatingIp()
- */
- public NovaTemplateOptions autoAssignFloatingIp(boolean enable) {
- this.autoAssignFloatingIp = enable;
- return this;
- }
-
- /**
- * @see #shouldGenerateKeyPair()
- */
- public NovaTemplateOptions generateKeyPair(boolean enable) {
- this.generateKeyPair = enable;
- return this;
- }
-
- /**
- * @see #shouldGenerateKeyPair()
- */
- public NovaTemplateOptions keyPairName(String keyPairName) {
- this.keyPairName = keyPairName;
- return this;
- }
-
- /**
- * set availability zone
- */
- public NovaTemplateOptions availabilityZone(String zone) {
- this.availabilityZone = zone;
- return this;
- }
-
-
- /**
- *
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
- */
- public NovaTemplateOptions securityGroupNames(String... securityGroupNames) {
- return securityGroupNames(ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames")));
- }
-
- /**
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
- */
- public NovaTemplateOptions securityGroupNames(Iterable<String> securityGroupNames) {
- for (String groupName : checkNotNull(securityGroupNames, "securityGroupNames"))
- checkNotNull(emptyToNull(groupName), "all security groups must be non-empty");
- this.securityGroupNames = Optional.<Set<String>> of(ImmutableSet.copyOf(securityGroupNames));
- return this;
- }
-
- /**
- * <h3>Note</h3>
- *
- * This requires that {@link NovaApi#getExtensionForZone(String)} to return
- * {@link Optional#isPresent present}
- *
- * @return true if auto assignment of a floating ip to each vm is enabled
- */
- public boolean shouldAutoAssignFloatingIp() {
- return autoAssignFloatingIp;
- }
-
- /**
- * Specifies the keypair used to run instances with
- * @return the keypair to be used
- */
- public String getKeyPairName() {
- return keyPairName;
- }
-
- /**
- * Specifies the availability zone used to run instances with
- * @return the availability zone to be used
- */
- public String getAvailabilityZone() {
- return availabilityZone;
- }
-
-
- /**
- * <h3>Note</h3>
- *
- * This requires that {@link NovaApi#getKeyPairExtensionForZone(String)} to return
- * {@link Optional#isPresent present}
- *
- * @return true if auto generation of keypairs is enabled
- */
- public boolean shouldGenerateKeyPair() {
- return generateKeyPair;
- }
-
- /**
- * if unset, generate a default group prefixed with {@link jclouds#} according
- * to {@link #getInboundPorts()}
- *
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
- */
- public Optional<Set<String>> getSecurityGroupNames() {
- return securityGroupNames;
- }
-
- public byte[] getUserData() {
- return userData;
- }
-
- /**
- * @see CreateServerOptions#getDiskConfig()
- */
- public String getDiskConfig() {
- return diskConfig;
- }
-
- /**
- * @see CreateServerOptions#getConfigDrive()
- */
- public boolean getConfigDrive() {
- return configDrive;
- }
-
- /**
- * @see CreateServerOptions#getNetworks()
- */
- public Set<Network> getNovaNetworks() {
- return novaNetworks;
- }
-
- public static class Builder {
-
- /**
- * @see NovaTemplateOptions#shouldAutoAssignFloatingIp()
- */
- public static NovaTemplateOptions autoAssignFloatingIp(boolean enable) {
- return new NovaTemplateOptions().autoAssignFloatingIp(enable);
- }
-
- /**
- * @see NovaTemplateOptions#shouldGenerateKeyPair()
- */
- public static NovaTemplateOptions generateKeyPair(boolean enable) {
- return new NovaTemplateOptions().generateKeyPair(enable);
- }
-
- /**
- * @see NovaTemplateOptions#getKeyPairName()
- */
- public static NovaTemplateOptions keyPairName(String keyPairName) {
- return new NovaTemplateOptions().keyPairName(keyPairName);
- }
-
- /**
- * @see NovaTemplateOptions#getAvailabilityZone()
- */
- public static NovaTemplateOptions availabilityZone(String zone) {
- return new NovaTemplateOptions().availabilityZone(zone);
- }
-
- /**
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
- */
- public static NovaTemplateOptions securityGroupNames(String... groupNames) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.securityGroupNames(groupNames));
- }
-
- /**
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getSecurityGroupNames
- */
- public static NovaTemplateOptions securityGroupNames(Iterable<String> groupNames) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.securityGroupNames(groupNames));
- }
-
- // methods that only facilitate returning the correct object type
-
- /**
- * @see TemplateOptions#inboundPorts
- */
- public static NovaTemplateOptions inboundPorts(int... ports) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.inboundPorts(ports));
- }
-
- /**
- * @see TemplateOptions#port
- */
- public static NovaTemplateOptions blockOnPort(int port, int seconds) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.blockOnPort(port, seconds));
- }
-
- /**
- * @see TemplateOptions#installPrivateKey
- */
- public static NovaTemplateOptions installPrivateKey(String rsaKey) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.installPrivateKey(rsaKey));
- }
-
- /**
- * @see TemplateOptions#authorizePublicKey
- */
- public static NovaTemplateOptions authorizePublicKey(String rsaKey) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
- }
-
- /**
- * @see TemplateOptions#userMetadata
- */
- public static NovaTemplateOptions userMetadata(Map<String, String> userMetadata) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.userMetadata(userMetadata));
- }
-
- /**
- * @see TemplateOptions#nodeNames(Iterable)
- */
- public static NovaTemplateOptions nodeNames(Iterable<String> nodeNames) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.nodeNames(nodeNames));
- }
-
- /**
- * @see TemplateOptions#networks(Iterable)
- */
- public static NovaTemplateOptions networks(Iterable<String> networks) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.networks(networks));
- }
-
- /**
- * @see TemplateOptions#overrideLoginUser
- */
- public static NovaTemplateOptions overrideLoginUser(String user) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return options.overrideLoginUser(user);
- }
-
- /**
- * @see TemplateOptions#overrideLoginPassword
- */
- public static NovaTemplateOptions overrideLoginPassword(String password) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return options.overrideLoginPassword(password);
- }
-
- /**
- * @see TemplateOptions#overrideLoginPrivateKey
- */
- public static NovaTemplateOptions overrideLoginPrivateKey(String privateKey) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return options.overrideLoginPrivateKey(privateKey);
- }
-
- /**
- * @see TemplateOptions#overrideAuthenticateSudo
- */
- public static NovaTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return options.overrideAuthenticateSudo(authenticateSudo);
- }
-
- /**
- * @see TemplateOptions#overrideLoginCredentials
- */
- public static NovaTemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return options.overrideLoginCredentials(credentials);
- }
-
- /**
- * @see TemplateOptions#blockUntilRunning
- */
- public static NovaTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return options.blockUntilRunning(blockUntilRunning);
- }
-
- /**
- * @see NovaTemplateOptions#userData
- */
- public static NovaTemplateOptions userData(byte[] userData) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.userData(userData));
- }
-
- /**
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getDiskConfig()
- */
- public static NovaTemplateOptions diskConfig(String diskConfig) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.diskConfig(diskConfig));
- }
-
- /**
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getConfigDrive()
- */
- public static NovaTemplateOptions configDrive(boolean configDrive) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.configDrive(configDrive));
- }
-
- /**
- * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getNetworks()
- */
- public static NovaTemplateOptions novaNetworks(Set<Network> novaNetworks) {
- NovaTemplateOptions options = new NovaTemplateOptions();
- return NovaTemplateOptions.class.cast(options.novaNetworks(novaNetworks));
- }
- }
-
- // methods that only facilitate returning the correct object type
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions blockOnPort(int port, int seconds) {
- return NovaTemplateOptions.class.cast(super.blockOnPort(port, seconds));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions inboundPorts(int... ports) {
- return NovaTemplateOptions.class.cast(super.inboundPorts(ports));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions authorizePublicKey(String publicKey) {
- return NovaTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions installPrivateKey(String privateKey) {
- return NovaTemplateOptions.class.cast(super.installPrivateKey(privateKey));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
- return NovaTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions dontAuthorizePublicKey() {
- return NovaTemplateOptions.class.cast(super.dontAuthorizePublicKey());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions nameTask(String name) {
- return NovaTemplateOptions.class.cast(super.nameTask(name));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions runAsRoot(boolean runAsRoot) {
- return NovaTemplateOptions.class.cast(super.runAsRoot(runAsRoot));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions runScript(Statement script) {
- return NovaTemplateOptions.class.cast(super.runScript(script));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
- return NovaTemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions overrideLoginPassword(String password) {
- return NovaTemplateOptions.class.cast(super.overrideLoginPassword(password));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions overrideLoginPrivateKey(String privateKey) {
- return NovaTemplateOptions.class.cast(super.overrideLoginPrivateKey(privateKey));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions overrideLoginUser(String loginUser) {
- return NovaTemplateOptions.class.cast(super.overrideLoginUser(loginUser));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
- return NovaTemplateOptions.class.cast(super.overrideAuthenticateSudo(authenticateSudo));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions userMetadata(Map<String, String> userMetadata) {
- return NovaTemplateOptions.class.cast(super.userMetadata(userMetadata));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions userMetadata(String key, String value) {
- return NovaTemplateOptions.class.cast(super.userMetadata(key, value));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public NovaTemplateOptions nodeNames(Iterable<String> nodeNames) {
- return NovaTemplateOptions.class.cast(super.nodeNames(nodeNames));
- }
-
- /**
- * <br>Ensures NovaTemplateOptions can work with networks specified as Strings.
- * Also provides for compatibility with the abstraction layer.
- */
- @Override
- public NovaTemplateOptions networks(Iterable<String> networks) {
- return NovaTemplateOptions.class.cast(super.networks(networks));
- }
-
- /**
- * <br>Ensures NovaTemplateOptions can work with networks specified as Strings.
- * Also provides for compatibility with the abstraction layer.
- */
- @Override
- public NovaTemplateOptions networks(String... networks) {
- return NovaTemplateOptions.class.cast(super.networks(networks));
- }
-
- /**
- * User data as bytes (not base64-encoded)
- */
- public NovaTemplateOptions userData(byte[] userData) {
- // This limit may not be needed for nova
- checkArgument(checkNotNull(userData, "userData").length <= 16 * 1024,
- "userData cannot be larger than 16kb");
- this.userData = userData;
- return this;
- }
-
- /**
- * @see CreateServerOptions#getDiskConfig()
- */
- public NovaTemplateOptions diskConfig(String diskConfig) {
- this.diskConfig = diskConfig;
- return this;
- }
-
- /**
- * OpenStack can be configured to write metadata to a special configuration drive that will be
- * attached to the instance when it boots. The instance can retrieve any information that would
- * normally be available through the metadata service by mounting this disk and reading files from it.
- * To enable the config drive, set this parameter to "true".
- * This has to be enabled for user data cases.
- * @see CreateServerOptions#getConfigDrive()
- */
- public NovaTemplateOptions configDrive(boolean configDrive) {
- this.configDrive = configDrive;
- return this;
- }
-
- /**
- * @param novaNetworks The list of network declarations.
- * Nova-specific network declarations allow for specifying network UUIDs, port UUIDs, and fixed IPs.
- * Unline {@link #networks(Iterable)} this supports setting additional network parameters and not just network UUIDs.
- * @see CreateServerOptions#getNetworks()
- */
- public NovaTemplateOptions novaNetworks(Set<Network> novaNetworks) {
- this.novaNetworks = novaNetworks;
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
deleted file mode 100644
index 680a82c..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.and;
-import static com.google.common.collect.Iterables.all;
-import static org.jclouds.compute.predicates.NodePredicates.TERMINATED;
-import static org.jclouds.compute.predicates.NodePredicates.inGroup;
-import static org.jclouds.compute.predicates.NodePredicates.locationId;
-import static org.jclouds.compute.predicates.NodePredicates.parentLocationId;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.ComputeMetadata;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-/**
- * @author Adrian Cole
- */
-public class AllNodesInGroupTerminated implements Predicate<ZoneAndName> {
- private final ComputeService computeService;
-
-
- //TODO: TESTME
- @Inject
- public AllNodesInGroupTerminated(ComputeService computeService) {
- this.computeService = checkNotNull(computeService, "computeService");
- }
-
- @Override
- public boolean apply(ZoneAndName input) {
- // new nodes can have the zone as their location, existing nodes, the parent is the
- // location
- return all(computeService.listNodesDetailsMatching(Predicates.<ComputeMetadata> or(locationId(input.getZone()),
- parentLocationId(input.getZone()))), and(inGroup(input.getName()), TERMINATED));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/strategy/ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/strategy/ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/strategy/ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
deleted file mode 100644
index e3ea4cc..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/compute/strategy/ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.ssh.SshKeys.fingerprintPrivateKey;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.compute.config.CustomizationResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.compute.functions.AllocateAndAddFloatingIpToNode;
-import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
-import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
-import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
-
-import com.google.common.base.Throwables;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.Multimap;
-import com.google.common.primitives.Ints;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- *
- * @author Adrian Cole
- */
-@Singleton
-public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet extends
- CreateNodesWithGroupEncodedIntoNameThenAddToSet {
-
- private final AllocateAndAddFloatingIpToNode createAndAddFloatingIpToNode;
- private final LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupCache;
- private final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
- private final NovaApi novaApi;
-
- @Inject
- protected ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(
- CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
- ListNodesStrategy listNodesStrategy,
- GroupNamingConvention.Factory namingConvention,
- CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- AllocateAndAddFloatingIpToNode createAndAddFloatingIpToNode,
- LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupCache,
- LoadingCache<ZoneAndName, KeyPair> keyPairCache, NovaApi novaApi) {
- super(addNodeWithTagStrategy, listNodesStrategy, namingConvention, userExecutor,
- customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
- this.securityGroupCache = checkNotNull(securityGroupCache, "securityGroupCache");
- this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
- this.createAndAddFloatingIpToNode = checkNotNull(createAndAddFloatingIpToNode,
- "createAndAddFloatingIpToNode");
- this.novaApi = checkNotNull(novaApi, "novaApi");
- }
-
- @Override
- public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
- Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
-
- Template mutableTemplate = template.clone();
-
- NovaTemplateOptions templateOptions = NovaTemplateOptions.class.cast(mutableTemplate.getOptions());
-
- assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
-
- String zone = mutableTemplate.getLocation().getId();
-
- if (templateOptions.shouldAutoAssignFloatingIp()) {
- checkArgument(novaApi.getFloatingIPExtensionForZone(zone).isPresent(),
- "Floating IPs are required by options, but the extension is not available! options: %s",
- templateOptions);
- }
-
- boolean keyPairExtensionPresent = novaApi.getKeyPairExtensionForZone(zone).isPresent();
- if (templateOptions.shouldGenerateKeyPair()) {
- checkArgument(keyPairExtensionPresent,
- "Key Pairs are required by options, but the extension is not available! options: %s", templateOptions);
- KeyPair keyPair = keyPairCache.getUnchecked(ZoneAndName.fromZoneAndName(zone, namingConvention.create()
- .sharedNameForGroup(group)));
- keyPairCache.asMap().put(ZoneAndName.fromZoneAndName(zone, keyPair.getName()), keyPair);
- templateOptions.keyPairName(keyPair.getName());
- } else if (templateOptions.getKeyPairName() != null) {
- checkArgument(keyPairExtensionPresent,
- "Key Pairs are required by options, but the extension is not available! options: %s", templateOptions);
- if (templateOptions.getLoginPrivateKey() != null) {
- String pem = templateOptions.getLoginPrivateKey();
- KeyPair keyPair = KeyPair.builder().name(templateOptions.getKeyPairName())
- .fingerprint(fingerprintPrivateKey(pem)).privateKey(pem).build();
- keyPairCache.asMap().put(ZoneAndName.fromZoneAndName(zone, keyPair.getName()), keyPair);
- }
- }
-
- boolean securityGroupExtensionPresent = novaApi.getSecurityGroupExtensionForZone(zone).isPresent();
- List<Integer> inboundPorts = Ints.asList(templateOptions.getInboundPorts());
- if (templateOptions.getSecurityGroupNames().isPresent()
- && templateOptions.getSecurityGroupNames().get().size() > 0) {
- checkArgument(securityGroupExtensionPresent,
- "Security groups are required by options, but the extension is not available! options: %s",
- templateOptions);
- } else if (securityGroupExtensionPresent) {
- if (!templateOptions.getSecurityGroupNames().isPresent() && inboundPorts.size() > 0) {
- String securityGroupName = namingConvention.create().sharedNameForGroup(group);
- try {
- securityGroupCache.get(new ZoneSecurityGroupNameAndPorts(zone, securityGroupName, inboundPorts));
- } catch (ExecutionException e) {
- throw Throwables.propagate(e.getCause());
- }
- templateOptions.securityGroupNames(securityGroupName);
- }
- }
- templateOptions.userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
-
- return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
- }
-
- @Override
- protected ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group,
- final String name, Template template) {
-
- ListenableFuture<AtomicReference<NodeMetadata>> future = super.createNodeInGroupWithNameAndTemplate(group, name, template);
- NovaTemplateOptions templateOptions = NovaTemplateOptions.class.cast(template.getOptions());
-
- if (templateOptions.shouldAutoAssignFloatingIp()) {
- return Futures.transform(future, createAndAddFloatingIpToNode, userExecutor);
- } else {
- return future;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java
deleted file mode 100644
index 7f31c27..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.config;
-
-import java.beans.ConstructorProperties;
-import java.lang.reflect.Type;
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Singleton;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.openstack.nova.v2_0.domain.Address;
-import org.jclouds.openstack.nova.v2_0.domain.HostResourceUsage;
-import org.jclouds.openstack.nova.v2_0.domain.Server;
-import org.jclouds.openstack.nova.v2_0.domain.ServerExtendedAttributes;
-import org.jclouds.openstack.nova.v2_0.domain.ServerExtendedStatus;
-import org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParseException;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-
-/**
- * @author Adrian Cole
- * @author Adam Lowe
- */
-public class NovaParserModule extends AbstractModule {
-
- @Provides
- @Singleton
- public Map<Type, Object> provideCustomAdapterBindings() {
- return ImmutableMap.<Type, Object>of(
- HostResourceUsage.class, new HostResourceUsageAdapter(),
- ServerWithSecurityGroups.class, new ServerWithSecurityGroupsAdapter(),
- Server.class, new ServerAdapter()
- );
- }
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
- }
-
- @Singleton
- public static class HostResourceUsageAdapter implements JsonSerializer<HostResourceUsage>, JsonDeserializer<HostResourceUsage> {
- public HostResourceUsage apply(HostResourceUsageView in) {
- return in.resource.toBuilder().build();
- }
-
- @Override
- public HostResourceUsage deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
- return apply((HostResourceUsageView) context.deserialize(jsonElement, HostResourceUsageView.class));
- }
-
- @Override
- public JsonElement serialize(HostResourceUsage hostResourceUsage, Type type, JsonSerializationContext context) {
- return context.serialize(hostResourceUsage);
- }
-
- private static class HostResourceUsageView {
- protected HostResourceUsageInternal resource;
- }
-
- private static class HostResourceUsageInternal extends HostResourceUsage {
-
- @ConstructorProperties({
- "host", "project", "memory_mb", "cpu", "disk_gb"
- })
- protected HostResourceUsageInternal(String host, @Nullable String project, int memoryMb, int cpu, int diskGb) {
- super(host, project, memoryMb, cpu, diskGb);
- }
- }
- }
-
- @Singleton
- public static class ServerWithSecurityGroupsAdapter implements JsonDeserializer<ServerWithSecurityGroups> {
- @Override
- public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
- throws JsonParseException {
- Server server = context.deserialize(jsonElement, Server.class);
- ServerWithSecurityGroups.Builder<?> result = ServerWithSecurityGroups.builder().fromServer(server);
- Set<String> names = Sets.newLinkedHashSet();
- if (jsonElement.getAsJsonObject().get("security_groups") != null) {
- JsonArray x = jsonElement.getAsJsonObject().get("security_groups").getAsJsonArray();
- for (JsonElement y : x) {
- names.add(y.getAsJsonObject().get("name").getAsString());
- }
- result.securityGroupNames(names);
- }
- return result.build();
- }
- }
-
- @Singleton
- public static class ServerAdapter implements JsonDeserializer<Server> {
- @Override
- public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
- throws JsonParseException {
- Server serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class));
- Server.Builder<?> result = Server.builder().fromServer(serverBase);
- ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class);
- if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) {
- result.extendedStatus(extendedStatus);
- }
- ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class);
- if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) {
- result.extendedAttributes(extraAttributes);
- }
- return result.build();
- }
-
- public Server apply(ServerInternal in) {
- return in.toBuilder().build();
- }
-
- private static class ServerInternal extends Server {
- @ConstructorProperties({
- "id", "name", "links", "uuid", "tenant_id", "user_id", "updated", "created", "hostId", "accessIPv4", "accessIPv6", "status", "image", "flavor", "key_name", "config_drive", "addresses", "metadata", "extendedStatus", "extendedAttributes", "OS-DCF:diskConfig"
- })
- protected ServerInternal(String id, @Nullable String name, java.util.Set<Link> links, @Nullable String uuid, String tenantId,
- String userId, Date updated, Date created, @Nullable String hostId, @Nullable String accessIPv4,
- @Nullable String accessIPv6, Server.Status status, Resource image, Resource flavor, @Nullable String keyName,
- @Nullable String configDrive, Multimap<String, Address> addresses, Map<String, String> metadata,
- @Nullable ServerExtendedStatus extendedStatus, @Nullable ServerExtendedAttributes extendedAttributes, @Nullable String diskConfig) {
- super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java
deleted file mode 100644
index 9b55439..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.config;
-
-/**
- * Configuration properties and constants used in openstack Nova connections.
- *
- * @author Adam Lowe
- */
-public class NovaProperties {
-
- /**
- * Eventual consistency delay for retrieving a security group after it is created (in ms)
- */
- public static final String TIMEOUT_SECURITYGROUP_PRESENT = "jclouds.openstack-nova.timeout.securitygroup-present";
-
- /**
- * Whenever a node is created, automatically create and assign a floating ip address, also
- * delete when the node is destroyed.
- */
- public static final String AUTO_ALLOCATE_FLOATING_IPS = "jclouds.openstack-nova.auto-create-floating-ips";
-
- /**
- * Whenever a node is created, automatically generate keypairs for groups, as needed, also
- * delete the keypair(s) when the last node in the group is destroyed.
- */
- public static final String AUTO_GENERATE_KEYPAIRS = "jclouds.openstack-nova.auto-generate-keypairs";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
deleted file mode 100644
index 556ec60..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.config;
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.openstack.nova.v2_0.NovaApi;
-import org.jclouds.openstack.nova.v2_0.NovaAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
-import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces;
-import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsApi;
-import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationApi;
-import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi;
-import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
-import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.QuotaApi;
-import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi;
-import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi;
-import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageApi;
-import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeAttachmentApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeAttachmentAsyncApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi;
-import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeAsyncApi;
-import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
-import org.jclouds.openstack.nova.v2_0.features.FlavorAsyncApi;
-import org.jclouds.openstack.nova.v2_0.features.ImageApi;
-import org.jclouds.openstack.nova.v2_0.features.ImageAsyncApi;
-import org.jclouds.openstack.nova.v2_0.features.ServerApi;
-import org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi;
-import org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler;
-import org.jclouds.openstack.v2_0.domain.Extension;
-import org.jclouds.openstack.v2_0.features.ExtensionApi;
-import org.jclouds.openstack.v2_0.features.ExtensionAsyncApi;
-import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-import org.jclouds.rest.functions.ImplicitOptionalConverter;
-
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Provides;
-
-/**
- * Configures the Nova connection.
- *
- * @author Adrian Cole
- */
-@ConfiguresRestClient
-public class NovaRestClientModule<S extends NovaApi, A extends NovaAsyncApi> extends RestClientModule<S, A> {
-
- public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
- .put(ServerApi.class, ServerAsyncApi.class)
- .put(FlavorApi.class, FlavorAsyncApi.class)
- .put(ImageApi.class, ImageAsyncApi.class)
- .put(ExtensionApi.class, ExtensionAsyncApi.class)
- .put(FloatingIPApi.class, FloatingIPAsyncApi.class)
- .put(AvailabilityZoneAPI.class, AvailabilityZoneAsyncApi.class)
- .put(SecurityGroupApi.class, SecurityGroupAsyncApi.class)
- .put(KeyPairApi.class, KeyPairAsyncApi.class)
- .put(HostAdministrationApi.class, HostAdministrationAsyncApi.class)
- .put(SimpleTenantUsageApi.class, SimpleTenantUsageAsyncApi.class)
- .put(VirtualInterfaceApi.class, VirtualInterfaceAsyncApi.class)
- .put(ServerWithSecurityGroupsApi.class, ServerWithSecurityGroupsAsyncApi.class)
- .put(ServerAdminApi.class, ServerAdminAsyncApi.class)
- .put(HostAggregateApi.class, HostAggregateAsyncApi.class)
- .put(FlavorExtraSpecsApi.class, FlavorExtraSpecsAsyncApi.class)
- .put(QuotaApi.class, QuotaAsyncApi.class)
- .put(QuotaClassApi.class, QuotaClassAsyncApi.class)
- .put(VolumeApi.class, VolumeAsyncApi.class)
- .put(VolumeAttachmentApi.class, VolumeAttachmentAsyncApi.class)
- .put(VolumeTypeApi.class, VolumeTypeAsyncApi.class)
- .build();
-
- @SuppressWarnings("unchecked")
- public NovaRestClientModule() {
- super(TypeToken.class.cast(typeToken(NovaApi.class)), TypeToken.class.cast(typeToken(NovaAsyncApi.class)), DELEGATE_MAP);
- }
-
- protected NovaRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
- Map<Class<?>, Class<?>> sync2Async) {
- super(syncClientType, asyncClientType, sync2Async);
- }
-
- @Override
- protected void configure() {
- bind(ImplicitOptionalConverter.class).to(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class);
- super.configure();
- }
-
- @Provides
- @Singleton
- public Multimap<URI, URI> aliases() {
- return ImmutableMultimap.<URI, URI>builder()
- .put(URI.create(ExtensionNamespaces.SECURITY_GROUPS),
- URI.create("http://docs.openstack.org/compute/ext/securitygroups/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.FLOATING_IPS),
- URI.create("http://docs.openstack.org/compute/ext/floating_ips/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.KEYPAIRS),
- URI.create("http://docs.openstack.org/compute/ext/keypairs/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.SIMPLE_TENANT_USAGE),
- URI.create("http://docs.openstack.org/compute/ext/os-simple-tenant-usage/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.HOSTS),
- URI.create("http://docs.openstack.org/compute/ext/hosts/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.VOLUMES),
- URI.create("http://docs.openstack.org/compute/ext/volumes/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.VIRTUAL_INTERFACES),
- URI.create("http://docs.openstack.org/compute/ext/virtual_interfaces/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.CREATESERVEREXT),
- URI.create("http://docs.openstack.org/compute/ext/createserverext/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.ADMIN_ACTIONS),
- URI.create("http://docs.openstack.org/compute/ext/admin-actions/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.AGGREGATES),
- URI.create("http://docs.openstack.org/compute/ext/aggregates/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.FLAVOR_EXTRA_SPECS),
- URI.create("http://docs.openstack.org/compute/ext/flavor_extra_specs/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.QUOTAS),
- URI.create("http://docs.openstack.org/compute/ext/quotas-sets/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.QUOTA_CLASSES),
- URI.create("http://docs.openstack.org/compute/ext/quota-classes-sets/api/v1.1"))
- .put(URI.create(ExtensionNamespaces.VOLUME_TYPES),
- URI.create("http://docs.openstack.org/compute/ext/volume_types/api/v1.1"))
- .build();
- }
-
- @Provides
- @Singleton
- public LoadingCache<String, Set<? extends Extension>> provideExtensionsByZone(final Provider<NovaApi> novaApi) {
- return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
- .build(new CacheLoader<String, Set<? extends Extension>>() {
- @Override
- public Set<? extends Extension> load(String key) throws Exception {
- return novaApi.get().getExtensionApiForZone(key).list();
- }
- });
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(NovaErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(NovaErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(NovaErrorHandler.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Address.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Address.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Address.java
deleted file mode 100644
index 38c744d..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Address.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * IP address
- *
- * @author AdrianCole
-*/
-public class Address {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromAddress(this);
- }
-
- public static Address createV4(String addr) {
- return builder().version(4).addr(addr).build();
- }
-
- public static Address createV6(String addr) {
- return builder().version(6).addr(addr).build();
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String addr;
- protected int version;
-
- /**
- * @see Address#getAddr()
- */
- public T addr(String addr) {
- this.addr = addr;
- return self();
- }
-
- /**
- * @see Address#getVersion()
- */
- public T version(int version) {
- this.version = version;
- return self();
- }
-
- public Address build() {
- return new Address(addr, version);
- }
-
- public T fromAddress(Address in) {
- return this
- .addr(in.getAddr())
- .version(in.getVersion());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String addr;
- private final int version;
-
- @ConstructorProperties({
- "addr", "version"
- })
- protected Address(String addr, int version) {
- this.addr = checkNotNull(addr, "addr");
- this.version = version;
- }
-
- /**
- * @return the ip address
- */
- public String getAddr() {
- return this.addr;
- }
-
- /**
- * @return the IP version, ex. 4
- */
- public int getVersion() {
- return this.version;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(addr, version);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Address that = Address.class.cast(obj);
- return Objects.equal(this.addr, that.addr)
- && Objects.equal(this.version, that.version);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("addr", addr).add("version", version);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/BackupType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/BackupType.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/BackupType.java
deleted file mode 100644
index 97460d8..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/BackupType.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.CaseFormat;
-
-/**
- * @author Adam Lowe
- */
-public enum BackupType {
- DAILY, WEEKLY;
-
- public String value() {
- return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
- }
-
- @Override
- public String toString() {
- return value();
- }
-
- public static BackupType fromValue(String backupType) {
- return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(backupType, "backupType")));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Flavor.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Flavor.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Flavor.java
deleted file mode 100644
index c353ab0..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Flavor.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Resource;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-
-/**
- * A flavor is an available hardware configuration for a server. Each flavor has
- * a unique combination of disk space and memory capacity.
- *
- * @author Jeremy Daggett, Ilja Bobkevic
- * @see <a href=
- "http://docs.openstack.org/api/openstack-compute/2/content/List_Flavors-d1e4188.html"
- />
-*/
-public class Flavor extends Resource {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromFlavor(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Resource.Builder<T> {
- protected int ram;
- protected int disk;
- protected int vcpus;
- protected String swap;
- protected Double rxtxFactor;
- protected Integer ephemeral;
-
- /**
- * @see Flavor#getRam()
- */
- public T ram(int ram) {
- this.ram = ram;
- return self();
- }
-
- /**
- * @see Flavor#getDisk()
- */
- public T disk(int disk) {
- this.disk = disk;
- return self();
- }
-
- /**
- * @see Flavor#getVcpus()
- */
- public T vcpus(int vcpus) {
- this.vcpus = vcpus;
- return self();
- }
-
- /**
- * @see Flavor#getSwap()
- */
- public T swap(String swap) {
- this.swap = swap;
- return self();
- }
-
- /**
- * @see Flavor#getRxtxFactor()
- */
- public T rxtxFactor(Double rxtxFactor) {
- this.rxtxFactor = rxtxFactor;
- return self();
- }
-
- /**
- * @see Flavor#getEphemeral()
- */
- public T ephemeral(Integer ephemeral) {
- this.ephemeral = ephemeral;
- return self();
- }
-
- public Flavor build() {
- return new Flavor(id, name, links, ram, disk, vcpus, swap, rxtxFactor, ephemeral);
- }
-
- public T fromFlavor(Flavor in) {
- return super.fromResource(in)
- .ram(in.getRam())
- .disk(in.getDisk())
- .vcpus(in.getVcpus())
- .swap(in.getSwap().orNull())
- .rxtxFactor(in.getRxtxFactor().orNull())
- .ephemeral(in.getEphemeral().orNull());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final int ram;
- private final int disk;
- private final int vcpus;
- private final Optional<String> swap;
- @Named("rxtx_factor")
- private final Optional<Double> rxtxFactor;
- @Named("OS-FLV-EXT-DATA:ephemeral")
- private final Optional<Integer> ephemeral;
-
- @ConstructorProperties({
- "id", "name", "links", "ram", "disk", "vcpus", "swap", "rxtx_factor", "OS-FLV-EXT-DATA:ephemeral"
- })
- protected Flavor(String id, String name, java.util.Set<Link> links, int ram, int disk, int vcpus,
- @Nullable String swap, @Nullable Double rxtxFactor, @Nullable Integer ephemeral) {
- super(id, checkNotNull(name, "name"), links);
- checkArgument(ram > 0, "Value of ram has to greater than 0");
- checkArgument(vcpus > 0, "Value of vcpus has to greater than 0");
- this.ram = ram;
- this.disk = disk;
- this.vcpus = vcpus;
- this.swap = Optional.fromNullable(swap);
- this.rxtxFactor = Optional.fromNullable(rxtxFactor);
- this.ephemeral = Optional.fromNullable(ephemeral);
- }
-
- public int getRam() {
- return this.ram;
- }
-
- public int getDisk() {
- return this.disk;
- }
-
- public int getVcpus() {
- return this.vcpus;
- }
-
- public Optional<String> getSwap() {
- return this.swap;
- }
-
- public Optional<Double> getRxtxFactor() {
- return this.rxtxFactor;
- }
-
- /**
- * Retrieves ephemeral disk space in GB
- * <p/>
- * NOTE: This field is only present if the Flavor Extra Data extension is installed (alias "OS-FLV-EXT-DATA").
- *
- * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
- * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#FLAVOR_EXTRA_DATA
- */
- public Optional<Integer> getEphemeral() {
- return this.ephemeral;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(ram, disk, vcpus, swap, rxtxFactor, ephemeral);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Flavor that = Flavor.class.cast(obj);
- return super.equals(that) && Objects.equal(this.ram, that.ram)
- && Objects.equal(this.disk, that.disk)
- && Objects.equal(this.vcpus, that.vcpus)
- && Objects.equal(this.swap, that.swap)
- && Objects.equal(this.rxtxFactor, that.rxtxFactor)
- && Objects.equal(this.ephemeral, that.ephemeral);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("ram", ram).add("disk", disk).add("vcpus", vcpus).add("swap", swap).add("rxtxFactor", rxtxFactor).add("ephemeral", ephemeral);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/FloatingIP.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/FloatingIP.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/FloatingIP.java
deleted file mode 100644
index 203b2da..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/FloatingIP.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * A Floating IP is an IP address that can be created and associated with a
- * Server instance. Floating IPs can also be disassociated and deleted from a
- * Server instance.
- *
- * @author Jeremy Daggett
- * @author chamerling
-*/
-public class FloatingIP implements Comparable<FloatingIP> {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromFloatingIP(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
- protected String ip;
- protected String fixedIp;
- protected String instanceId;
-
- /**
- * @see FloatingIP#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see FloatingIP#getIp()
- */
- public T ip(String ip) {
- this.ip = ip;
- return self();
- }
-
- /**
- * @see FloatingIP#getFixedIp()
- */
- public T fixedIp(String fixedIp) {
- this.fixedIp = fixedIp;
- return self();
- }
-
- /**
- * @see FloatingIP#getInstanceId()
- */
- public T instanceId(String instanceId) {
- this.instanceId = instanceId;
- return self();
- }
-
- public FloatingIP build() {
- return new FloatingIP(id, ip, fixedIp, instanceId);
- }
-
- public T fromFloatingIP(FloatingIP in) {
- return this
- .id(in.getId())
- .ip(in.getIp())
- .fixedIp(in.getFixedIp())
- .instanceId(in.getInstanceId());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
- private final String ip;
- @Named("fixed_ip")
- private final String fixedIp;
- @Named("instance_id")
- private final String instanceId;
-
- @ConstructorProperties({
- "id", "ip", "fixed_ip", "instance_id"
- })
- protected FloatingIP(String id, String ip, @Nullable String fixedIp, @Nullable String instanceId) {
- this.id = checkNotNull(id, "id");
- this.ip = checkNotNull(ip, "ip");
- this.fixedIp = fixedIp;
- this.instanceId = instanceId;
- }
-
- public String getId() {
- return this.id;
- }
-
- public String getIp() {
- return this.ip;
- }
-
- @Nullable
- public String getFixedIp() {
- return this.fixedIp;
- }
-
- @Nullable
- public String getInstanceId() {
- return this.instanceId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, ip, fixedIp, instanceId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- FloatingIP that = FloatingIP.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.ip, that.ip)
- && Objects.equal(this.fixedIp, that.fixedIp)
- && Objects.equal(this.instanceId, that.instanceId);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("ip", ip).add("fixedIp", fixedIp).add("instanceId", instanceId);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- @Override
- public int compareTo(FloatingIP o) {
- return this.id.compareTo(o.getId());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Host.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Host.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Host.java
deleted file mode 100644
index 72df77d..0000000
--- a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Host.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.openstack.nova.v2_0.domain;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Class Host
-*/
-public class Host {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromHost(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String name;
- protected String service;
-
- /**
- * @see Host#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see Host#getService()
- */
- public T service(String service) {
- this.service = service;
- return self();
- }
-
- public Host build() {
- return new Host(name, service);
- }
-
- public T fromHost(Host in) {
- return this
- .name(in.getName())
- .service(in.getService());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("host_name")
- private final String name;
- private final String service;
-
- @ConstructorProperties({
- "host_name", "service"
- })
- protected Host(@Nullable String name, @Nullable String service) {
- this.name = name;
- this.service = service;
- }
-
- @Nullable
- public String getName() {
- return this.name;
- }
-
- @Nullable
- public String getService() {
- return this.service;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name, service);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Host that = Host.class.cast(obj);
- return Objects.equal(this.name, that.name)
- && Objects.equal(this.service, that.service);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("name", name).add("service", service);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
[21/52] [partial] Moving jclouds dependencies to accurate parent
directories
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
new file mode 100755
index 0000000..19a3ef7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
@@ -0,0 +1,197 @@
+/*
+ * 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.vcloud.compute.options;
+
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.blockOnPort;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.customizationScript;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.description;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.inboundPorts;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.ipAddressAllocationMode;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.parentNetwork;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.testng.annotations.Test;
+
+/**
+ * Tests possible uses of VCloudTemplateOptions and
+ * VCloudTemplateOptions.Builder.*
+ *
+ * @author Adrian Cole
+ */
+public class VCloudTemplateOptionsTest {
+ @Test
+ public void testipAddressAllocationMode() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.ipAddressAllocationMode(IpAddressAllocationMode.NONE);
+ assertEquals(options.getIpAddressAllocationMode(), IpAddressAllocationMode.NONE);
+ }
+
+ @Test
+ public void testipAddressAllocationModeStatic() {
+ VCloudTemplateOptions options = ipAddressAllocationMode(IpAddressAllocationMode.NONE);
+ assertEquals(options.getIpAddressAllocationMode(), IpAddressAllocationMode.NONE);
+ }
+
+ public void testAs() {
+ TemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.as(VCloudTemplateOptions.class), options);
+ }
+
+ @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "customizationScript must be defined")
+ public void testcustomizationScriptBadFormat() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.customizationScript("");
+ }
+
+ @Test
+ public void testcustomizationScript() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.customizationScript("mykeypair");
+ assertEquals(options.getCustomizationScript(), "mykeypair");
+ }
+
+ @Test
+ public void testcustomizationScriptStatic() {
+ VCloudTemplateOptions options = customizationScript("mykeypair");
+ assertEquals(options.getCustomizationScript(), "mykeypair");
+ }
+
+ @Test
+ public void testNullparentNetwork() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getParentNetwork(), null);
+ }
+
+ @Test
+ public void testparentNetwork() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.parentNetwork(URI.create("https://network"));
+ assertEquals(options.getParentNetwork(), URI.create("https://network"));
+ }
+
+ @Test
+ public void testparentNetworkStatic() {
+ VCloudTemplateOptions options = parentNetwork(URI.create("https://network"));
+ assertEquals(options.getParentNetwork(), URI.create("https://network"));
+ }
+
+ @Test
+ public void testdescription() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.description("mykeypair");
+ assertEquals(options.getDescription(), "mykeypair");
+ }
+
+ @Test
+ public void testdescriptionStatic() {
+ VCloudTemplateOptions options = description("mykeypair");
+ assertEquals(options.getDescription(), "mykeypair");
+ }
+
+ @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "customizationScript must be defined")
+ public void testcustomizationScriptNPE() {
+ customizationScript(null);
+ }
+
+ @Test
+ public void testinstallPrivateKey() throws IOException {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
+ assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
+ }
+
+ @Test
+ public void testNullinstallPrivateKey() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getPrivateKey(), null);
+ }
+
+ @Test
+ public void testauthorizePublicKey() throws IOException {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.authorizePublicKey("ssh-rsa");
+ assertEquals(options.getPublicKey(), "ssh-rsa");
+ }
+
+ @Test
+ public void testNullauthorizePublicKey() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getPublicKey(), null);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testblockOnPortBadFormat() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.blockOnPort(-1, -1);
+ }
+
+ @Test
+ public void testblockOnPort() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.blockOnPort(22, 30);
+ assertEquals(options.getPort(), 22);
+ assertEquals(options.getSeconds(), 30);
+
+ }
+
+ @Test
+ public void testNullblockOnPort() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getPort(), -1);
+ assertEquals(options.getSeconds(), -1);
+ }
+
+ @Test
+ public void testblockOnPortStatic() {
+ VCloudTemplateOptions options = blockOnPort(22, 30);
+ assertEquals(options.getPort(), 22);
+ assertEquals(options.getSeconds(), 30);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testinboundPortsBadFormat() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.inboundPorts(-1, -1);
+ }
+
+ @Test
+ public void testinboundPorts() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.inboundPorts(22, 30);
+ assertEquals(options.getInboundPorts()[0], 22);
+ assertEquals(options.getInboundPorts()[1], 30);
+
+ }
+
+ @Test
+ public void testDefaultOpen22() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getInboundPorts()[0], 22);
+ }
+
+ @Test
+ public void testinboundPortsStatic() {
+ VCloudTemplateOptions options = inboundPorts(22, 30);
+ assertEquals(options.getInboundPorts()[0], 22);
+ assertEquals(options.getInboundPorts()[1], 30);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
new file mode 100755
index 0000000..0e786ab
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
@@ -0,0 +1,171 @@
+/*
+ * 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.vcloud.compute.strategy;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.net.HttpHeaders;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(singleThreaded = true, testName = "InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest")
+public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest extends
+ BaseVCloudComputeServiceExpectTest {
+
+ String ns = "http://www.vmware.com/vcloud/v1";
+ Properties outputProperties;
+ public InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest() {
+ outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ }
+
+ HttpResponse successfulVersion1_0InstantiatedVApp = HttpResponse.builder()
+ .statusCode(200)
+ .message("HTTP/1.1 200 OK")
+ .payload(payloadFromResourceWithContentType("/instantiatedvapp.xml", "application/vnd.vmware.vcloud.vApp+xml")).build();
+
+ // TODO: finish me!
+ @Test(enabled = false)
+ public void testCreateNodeUsingVCloud1_0ApiAgainstVCloudDirector1_5WhenVAppTemplateHasNetworkNamedNone()
+ throws Exception {
+
+ String group = "group";
+ String name = "group-abcd";
+
+ String instantiateXML = XMLBuilder.create("InstantiateVAppTemplateParams")
+ .a("xmlns", ns).a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1")
+ .a("deploy", "false").a("name", name).a("powerOn", "false")
+ .e("Description").up()
+ .e("InstantiationParams")
+ .e("NetworkConfigSection")
+ .e("ovf:Info").t("Configuration parameters for logical networks").up()
+ .e("NetworkConfig").a("networkName", "orgNet-jclouds-External") // NOTE not "None"
+ .e("Configuration")
+ .e("ParentNetwork").a("href", ENDPOINT + "/v1.0/network/" + networkId).up()
+ .e("FenceMode").t("bridged").up()
+ .up()
+ .up()
+ .up()
+ .up()
+ .e("Source").a("href", ENDPOINT + "/v1.0/vAppTemplate/" + templateId).up()
+ .e("AllEULAsAccepted").t("true").up()
+ .asString(outputProperties);
+
+ HttpRequest version1_0InstantiateWithNetworkNamedSameAsOrgNetwork = HttpRequest.builder().method("POST")
+ .endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId + "/action/instantiateVAppTemplate")
+ .addHeader(HttpHeaders.ACCEPT, "application/vnd.vmware.vcloud.vApp+xml;version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken)
+ .payload(payloadFromStringWithContentType(instantiateXML, "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")).build();
+
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+ .put(version1_0InstantiateWithNetworkNamedSameAsOrgNetwork, successfulVersion1_0InstantiatedVApp).build());
+
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn starter = compute.getContext()
+ .utils().injector().getInstance(
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.class);
+
+
+ NodeAndInitialCredentials<VApp> appAndCreds = starter.createNodeWithGroupEncodedIntoName(group, name, compute
+ .templateBuilder().build());
+
+ assertEquals(appAndCreds.getNode().getName(), name);
+ assertEquals(appAndCreds.getCredentials(), LoginCredentials.builder().user("root").password("fromVApp").build());
+
+ }
+
+ public void testInstantiateVAppFromTemplateWhenUsingOverriddenNetworkAndFenceMode()
+ throws Exception {
+
+ String name = "group-abcd";
+ FenceMode fenceMode = FenceMode.NAT_ROUTED;
+ URI parentNetwork = URI.create(ENDPOINT + "/v1.0/network/" + "foooooooo");
+
+ String instantiateXML = XMLBuilder.create("InstantiateVAppTemplateParams")
+ .a("xmlns", ns).a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1")
+ .a("deploy", "false").a("name", name).a("powerOn", "false")
+ .e("Description").up()
+ .e("InstantiationParams")
+ .e("NetworkConfigSection")
+ .e("ovf:Info").t("Configuration parameters for logical networks").up()
+ .e("NetworkConfig").a("networkName", "jclouds") // NOTE not "None"
+ .e("Configuration")
+ .e("ParentNetwork").a("href", parentNetwork.toASCIIString()).up()
+ .e("FenceMode").t(fenceMode.toString()).up()
+ .up()
+ .up()
+ .up()
+ .up()
+ .e("Source").a("href", ENDPOINT + "/v1.0/vAppTemplate/" + templateId).up()
+ .e("AllEULAsAccepted").t("true").up()
+ .asString(outputProperties);
+
+ HttpRequest version1_0InstantiateWithCustomizedNetwork = HttpRequest.builder().method("POST")
+ .endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId + "/action/instantiateVAppTemplate")
+ .addHeader(HttpHeaders.ACCEPT, "application/vnd.vmware.vcloud.vApp+xml;version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken)
+ .payload(payloadFromStringWithContentType(instantiateXML, "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")).build();
+
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+ .put(version1_0InstantiateWithCustomizedNetwork, successfulVersion1_0InstantiatedVApp).build());
+
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn starter = compute.getContext()
+ .utils().injector().getInstance(
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.class);
+
+ Template template = compute.templateBuilder().build();
+ template.getOptions().as(VCloudTemplateOptions.class).parentNetwork(parentNetwork).fenceMode(fenceMode);
+ starter.instantiateVAppFromTemplate(name, template);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
new file mode 100755
index 0000000..09843d2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.vcloud.compute.strategy;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+public class VCloudComputeServiceAdapterTest extends BaseVCloudComputeServiceExpectTest {
+
+ @Test
+ public void testListHardwareProfiles() throws Exception {
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+ .build());
+
+ VCloudComputeServiceAdapter adapter = compute.getContext()
+ .utils().injector().getInstance(VCloudComputeServiceAdapter.class);
+
+ Iterable<VAppTemplate> hardwareProfiles = adapter.listHardwareProfiles();
+
+ Iterable<URI> hardwareProfileRefs = Iterables.transform(ImmutableList.copyOf(hardwareProfiles), new Function<VAppTemplate,URI>() {
+ @Override public URI apply(VAppTemplate input) {
+ return input.getHref();
+ }
+ });
+ assertEquals(ImmutableSet.copyOf(hardwareProfileRefs), ImmutableSet.of(URI.create("https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728")));
+ }
+
+ /**
+ * For issue 994. In BaseEnvelopeHandler when it encounters VirtualSystemCollection, it throws IllegalArgumentException
+ * (cannot currently create envelopes with multiple virtual systems).
+ * Thus we do not include the VM in the supported set, but we do return without propagating the exception.
+ */
+ @Test
+ public void testListHardwareProfilesWithUnsupportedTemplate() throws Exception {
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithMultipleVMsAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithMultipleVMs)
+ .build());
+
+ VCloudComputeServiceAdapter adapter = compute.getContext()
+ .utils().injector().getInstance(VCloudComputeServiceAdapter.class);
+
+ Iterable<VAppTemplate> hardwareProfiles = adapter.listHardwareProfiles();
+
+ assertEquals(ImmutableSet.copyOf(hardwareProfiles), ImmutableSet.of());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
new file mode 100755
index 0000000..fa81fa3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.vcloud.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.inject.Key;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "CatalogApiLiveTest")
+public class CatalogApiLiveTest extends BaseVCloudApiLiveTest {
+ @Test
+ public void testGetCatalog() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType catalog : org.getCatalogs().values()) {
+ assertEquals(catalog.getType(), VCloudMediaType.CATALOG_XML);
+ assertNotNull(getVCloudApi().getCatalogApi().getCatalog(catalog.getHref()));
+ }
+ }
+
+ @Test
+ public void testFindCatalogIsWriteableIfNotVersion1_5() throws Exception {
+ // when we are in vCloud 1.0.0 public catalogs don't work, so our default
+ // catalog is private
+ if (!view.utils().injector().getInstance(Key.get(String.class, ApiVersion.class)).startsWith("1.5"))
+ assertTrue(getVCloudApi().getCatalogApi().findCatalogInOrgNamed(null, null).isReadOnly());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiTest.java
new file mode 100755
index 0000000..cf63390
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiTest.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.vcloud.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.jclouds.vcloud.xml.CatalogHandler;
+import org.jclouds.vcloud.xml.CatalogItemHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code CatalogApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "CatalogApiTest")
+public class CatalogApiTest extends BaseVCloudApiTest<CatalogApi> {
+
+ public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "getCatalog", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCatalogInOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "findCatalogInOrgNamed", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "getCatalogItem", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "findCatalogItemInOrgCatalogNamed", String.class,
+ String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "item"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testAddVAppTemplateOrMediaImageToCatalogAndNameItem() throws SecurityException, NoSuchMethodException,
+ IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class,
+ URI.class, String.class, CatalogItemOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI.create("http://fooentity"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), "myname", CatalogItemOptions.Builder
+ .description("mydescription")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/catalog/1/catalogItems HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
+ assertPayloadEquals(
+ request,
+ "<CatalogItem xmlns=\"http://www.vmware.com/vcloud/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" name=\"myname\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd\"><Description>mydescription</Description><Entity href=\"http://fooentity\"/></CatalogItem>",
+ "application/vnd.vmware.vcloud.catalogItem+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
new file mode 100755
index 0000000..c9c6e4f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.vcloud.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "NetworkApiLiveTest")
+public class NetworkApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
new file mode 100755
index 0000000..0d23a22
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.OrgNetworkHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code NetworkApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "NetworkApiTest")
+public class NetworkApiTest extends BaseVCloudApiTest<NetworkApi> {
+
+ public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(NetworkApi.class, "getNetwork", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindNetworkInOrgVDCNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(NetworkApi.class, "findNetworkInOrgVDCNamed", String.class, String.class,
+ String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "vdc", "network"));
+
+ assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/network/1990 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
new file mode 100755
index 0000000..ae22a05
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.vcloud.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "OrgApiLiveTest")
+public class OrgApiLiveTest extends BaseVCloudApiLiveTest {
+
+ @Test
+ public void testListOrgs() throws Exception {
+ for (ReferenceType response : getVCloudApi().getOrgApi().listOrgs().values()) {
+ assertNotNull(response);
+ assertNotNull(response.getName());
+ assertNotNull(response.getHref());
+ assertEquals(getVCloudApi().getOrgApi().getOrg(response.getHref()).getName(), response.getName());
+ assertEquals(getVCloudApi().getOrgApi().findOrgNamed(response.getName()).getName(), response.getName());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
new file mode 100755
index 0000000..0f9fc72
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.OrgHandler;
+import org.jclouds.vcloud.xml.OrgListHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code OrgApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "OrgApiTest")
+public class OrgApiTest extends BaseVCloudApiTest<OrgApi> {
+
+ public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "listOrgs");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.orgList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgListHandler.class);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ checkFilters(request);
+ }
+
+ public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "getOrg", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "findOrgNamed", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
new file mode 100755
index 0000000..4a87247
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.vcloud.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TaskApiLiveTest")
+public class TaskApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
new file mode 100755
index 0000000..4c3ee51
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.TasksListHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code TaskApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "TaskApiTest")
+public class TaskApiTest extends BaseVCloudApiTest<TaskApi> {
+
+ public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "getTasksList", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TasksListHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "findTasksListInOrgNamed", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TasksListHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "getTask", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "cancelTask", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
new file mode 100755
index 0000000..7bfb325
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.vcloud.features;
+
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppApiLiveTest")
+public class VAppApiLiveTest extends BaseVCloudApiLiveTest {
+
+ @Test
+ public void testGetVApp() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
+ for (ReferenceType item : response.getResourceEntities().values()) {
+ if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+ try {
+ VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
+ assertNotNull(app);
+ } catch (RuntimeException e) {
+
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
new file mode 100755
index 0000000..d8ec98f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
@@ -0,0 +1,315 @@
+/*
+ * 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.vcloud.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VAppApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VAppApiTest")
+public class VAppApiTest extends BaseVCloudApiTest<VAppApi> {
+
+ public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapp"));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp-default.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testCopyVAppToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
+ .deploy().powerOn().description("The description of the new vApp")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testMoveVAppToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
+ .deploy().powerOn().description("The description of the new vApp")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVApp.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deployVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployAndPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deployAndPowerOnVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "getVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testRebootVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "rebootVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "undeployVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployAndSaveStateOfVAppSaveState() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "undeployAndSaveStateOfVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request,
+ "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deleteVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "powerOnVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "powerOffVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "resetVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "suspendVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "shutdownVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
new file mode 100755
index 0000000..63056dc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.vcloud.features;
+
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.jclouds.util.Predicates2.retry;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.jclouds.vcloud.predicates.TaskSuccess;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppTemplateApiLiveTest")
+public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
+ @Test
+ public void testGetVAppTemplate() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType cat : org.getCatalogs().values()) {
+ Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
+ for (ReferenceType resource : response.values()) {
+ if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+ CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
+ if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+ VAppTemplate template = getVCloudApi().getVAppTemplateApi().getVAppTemplate(item.getEntity().getHref());
+ if (template != null) {
+ // the UUID in the href is the only way to actually link templates
+ assertEquals(template.getHref(), item.getEntity().getHref());
+ } else {
+ // null can be no longer available or auth exception
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testGetOvfEnvelopeForVAppTemplate() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType cat : org.getCatalogs().values()) {
+ Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
+ for (ReferenceType resource : response.values()) {
+ if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+ CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
+ if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+ getVCloudApi().getVAppTemplateApi().getOvfEnvelopeForVAppTemplate(item.getEntity().getHref());
+ // null can be no longer available or auth exception
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testFindVAppTemplate() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType cat : org.getCatalogs().values()) {
+ Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
+ for (ReferenceType resource : response.values()) {
+ if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+ CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
+ if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+ VAppTemplate template = getVCloudApi().getVAppTemplateApi().findVAppTemplateInOrgCatalogNamed(
+ org.getName(), response.getName(), item.getEntity().getName());
+ if (template != null) {
+ // the UUID in the href is the only way to actually link templates
+ assertEquals(template.getHref(), item.getEntity().getHref());
+ } else {
+ // null can be no longer available or auth exception
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testCaptureVApp() throws Exception {
+ String group = prefix + "cap";
+ NodeMetadata node = null;
+ VAppTemplate vappTemplate = null;
+ CatalogItem item = null;
+ try {
+
+ node = getOnlyElement(client.createNodesInGroup(group, 1));
+
+ Predicate<URI> taskTester = retry(new TaskSuccess(getVCloudApi()), 600, 5, SECONDS);
+
+ // I have to undeploy first
+ Task task = getVCloudApi().getVAppApi().undeployVApp(URI.create(node.getId()));
+
+ // wait up to ten minutes per above
+ assert taskTester.apply(task.getHref()) : node;
+
+ VApp vApp = getVCloudApi().getVAppApi().getVApp(URI.create(node.getId()));
+
+ // wait up to ten minutes per above
+ assertEquals(vApp.getStatus(), Status.OFF);
+
+ // vdc is equiv to the node's location
+ // vapp uri is the same as the node's id
+ vappTemplate = getVCloudApi().getVAppTemplateApi().captureVAppAsTemplateInVDC(URI.create(node.getId()),
+ group, URI.create(node.getLocation().getId()));
+
+ assertEquals(vappTemplate.getName(), group);
+
+ task = vappTemplate.getTasks().get(0);
+
+ // wait up to ten minutes per above
+ assert taskTester.apply(task.getHref()) : vappTemplate;
+
+ item = getVCloudApi().getCatalogApi().addVAppTemplateOrMediaImageToCatalogAndNameItem(
+ vappTemplate.getHref(),
+ getVCloudApi().getCatalogApi().findCatalogInOrgNamed(null, null).getHref(), "fooname",
+ CatalogItemOptions.Builder.description("description").properties(ImmutableMap.of("foo", "bar")));
+
+ assertEquals(item.getName(), "fooname");
+ assertEquals(item.getDescription(), "description");
+ assertEquals(item.getProperties(), ImmutableMap.of("foo", "bar"));
+ assertEquals(item.getEntity().getName(), "fooname");
+ assertEquals(item.getEntity().getHref(), vappTemplate.getHref());
+ assertEquals(item.getEntity().getType(), vappTemplate.getType());
+
+ } finally {
+ if (item != null)
+ getVCloudApi().getCatalogApi().deleteCatalogItem(item.getHref());
+ if (vappTemplate != null)
+ getVCloudApi().getVAppTemplateApi().deleteVAppTemplate(vappTemplate.getHref());
+ if (node != null)
+ client.destroyNode(node.getId());
+ }
+ }
+}