corrected api metadata and backfilled expect tests for hpcloud rackspace and trystack nova implementations

This commit is contained in:
Adrian Cole 2012-09-29 18:35:47 -07:00
parent 376db9e239
commit 4bc0ffbdd7
16 changed files with 575 additions and 1 deletions

View File

@ -76,6 +76,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-slf4j</artifactId>

View File

@ -31,6 +31,7 @@ import org.jclouds.hpcloud.compute.config.HPCloudComputeServiceContextModule;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.openstack.nova.v2_0.NovaApiMetadata;
import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
@ -88,6 +89,7 @@ public class HPCloudComputeProviderMetadata extends BaseProviderMetadata {
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(KeystoneAuthenticationModule.class)
.add(ZoneModule.class)
.add(NovaParserModule.class)
.add(NovaRestClientModule.class)
.add(HPCloudComputeServiceContextModule.class).build())
.build())

View File

@ -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.hpcloud.compute;
import static org.testng.Assert.assertEquals;
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.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* This test ensures that the wiring in {@link HPCloudComputeProviderMetadata} is correct.
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "HPCloudComputeProviderMetadataExpectTest")
public class HPCloudComputeProviderMetadataExpectTest extends BaseNovaApiExpectTest {
public HPCloudComputeProviderMetadataExpectTest() {
this.provider = "hpcloud-compute";
this.identity = "tenant:username";
this.credential = "password";
}
public void testCanGetConfiguredZones() {
HttpRequest authenticate = HttpRequest.builder().method("POST")
.endpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens")
.addHeader("Accept", "application/json")
.payload(payloadFromStringWithContentType(
"{\"auth\":{\"passwordCredentials\":{\"username\":\"username\",\"password\":\"password\"},\"tenantName\":\"tenant\"}}"
, "application/json")).build();
HttpResponse authenticationResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/access_hpcloud.json", "application/json")).build();
NovaApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("az-3.region-a.geo-1", "az-2.region-a.geo-1", "az-1.region-a.geo-1"));
}
}

View File

@ -0,0 +1,225 @@
{"access": {
"token": {
"expires": "2012-09-30T12:56:12.481Z",
"id": "HPAuth_e2b86593f73366704ed4f9e4441a2467f1a67568d5363e561a72f36a96da3b4a",
"tenant": {
"id": "37936628937291",
"name": "adrian@jclouds.org"
}
},
"user": {
"id": "54297837463082",
"name": "adrian@jclouds.org",
"roles": [
{
"id": "00000000004016",
"serviceId": "120",
"name": "netadmin",
"tenantId": "37936628937291"
},
{
"id": "00000000004025",
"serviceId": "120",
"name": "sysadmin",
"tenantId": "37936628937291"
},
{
"id": "00000000004014",
"serviceId": "150",
"name": "cdn-admin",
"tenantId": "37936628937291"
},
{
"id": "00000000004013",
"serviceId": "130",
"name": "block-admin",
"tenantId": "37936628937291"
},
{
"id": "00000000004022",
"serviceId": "110",
"name": "Admin",
"tenantId": "37936628937291"
},
{
"id": "00000000004016",
"serviceId": "120",
"name": "netadmin",
"tenantId": "37936628937291"
},
{
"id": "00000000004024",
"serviceId": "140",
"name": "user",
"tenantId": "37936628937291"
},
{
"id": "00000000004013",
"serviceId": "130",
"name": "block-admin",
"tenantId": "37936628937291"
},
{
"id": "00000000004003",
"serviceId": "100",
"name": "domainadmin"
},
{
"id": "00000000004025",
"serviceId": "120",
"name": "sysadmin",
"tenantId": "37936628937291"
},
{
"id": "00000000004024",
"serviceId": "140",
"name": "user",
"tenantId": "37936628937291"
},
{
"id": "00000000004004",
"serviceId": "100",
"name": "domainuser"
}
]
},
"serviceCatalog": [
{
"name": "CDN",
"type": "hpext:cdn",
"endpoints": [{
"tenantId": "37936628937291",
"publicURL": "https:\/\/region-a.geo-1.cdnmgmt.hpcloudsvc.com\/v1.0\/AUTH_651c939f-04f0-4fbf-bd50-27f114ccaa15",
"region": "region-a.geo-1",
"versionId": "1.0",
"versionInfo": "https:\/\/region-a.geo-1.cdnmgmt.hpcloudsvc.com\/v1.0\/",
"versionList": "https:\/\/region-a.geo-1.cdnmgmt.hpcloudsvc.com\/"
}]
},
{
"name": "Object Storage",
"type": "object-store",
"endpoints": [{
"tenantId": "37936628937291",
"publicURL": "https:\/\/region-a.geo-1.objects.hpcloudsvc.com\/v1.0\/AUTH_651c939f-04f0-4fbf-bd50-27f114ccaa15",
"region": "region-a.geo-1",
"versionId": "1.0",
"versionInfo": "https:\/\/region-a.geo-1.objects.hpcloudsvc.com\/v1.0\/",
"versionList": "https:\/\/region-a.geo-1.objects.hpcloudsvc.com"
}]
},
{
"name": "Identity",
"type": "identity",
"endpoints": [
{
"publicURL": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357\/v2.0\/",
"region": "region-b.geo-1",
"versionId": "2.0",
"versionInfo": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357\/v2.0\/",
"versionList": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357"
},
{
"publicURL": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357\/v2.0\/",
"region": "region-a.geo-1",
"versionId": "2.0",
"versionInfo": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357\/v2.0\/",
"versionList": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357"
}
]
},
{
"name": "Image Management",
"type": "image",
"endpoints": [
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/glance2.uswest.hpcloud.net:9292\/v1.0",
"region": "az-2.region-a.geo-1",
"versionId": "1.0",
"versionInfo": "https:\/\/glance2.uswest.hpcloud.net:9292\/v1.0\/",
"versionList": "https:\/\/glance2.uswest.hpcloud.net:9292"
},
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/glance3.uswest.hpcloud.net:9292\/v1.0",
"region": "az-3.region-a.geo-1",
"versionId": "1.0",
"versionInfo": "https:\/\/glance3.uswest.hpcloud.net:9292\/v1.0\/",
"versionList": "https:\/\/glance3.uswest.hpcloud.net:9292"
},
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/glance1.uswest.hpcloud.net:9292\/v1.0",
"region": "az-1.region-a.geo-1",
"versionId": "1.0",
"versionInfo": "https:\/\/glance1.uswest.hpcloud.net:9292\/v1.0\/",
"versionList": "https:\/\/glance1.uswest.hpcloud.net:9292"
}
]
},
{
"name": "Block Storage",
"type": "volume",
"endpoints": [
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/37936628937291",
"region": "az-1.region-a.geo-1",
"versionId": "1.1",
"versionInfo": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/",
"versionList": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com"
},
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/az-3.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/37936628937291",
"region": "az-3.region-a.geo-1",
"versionId": "1.1",
"versionInfo": "https:\/\/az-3.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/",
"versionList": "https:\/\/az-3.region-a.geo-1.compute.hpcloudsvc.com"
},
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/az-2.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/37936628937291",
"region": "az-2.region-a.geo-1",
"versionId": "1.1",
"versionInfo": "https:\/\/az-2.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/",
"versionList": "https:\/\/az-2.region-a.geo-1.compute.hpcloudsvc.com"
}
]
},
{
"name": "Compute",
"type": "compute",
"endpoints": [
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/az-3.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/37936628937291",
"publicURL2": "https:\/\/az-3.region-a.geo-1.ec2-compute.hpcloudsvc.com\/services\/Cloud",
"region": "az-3.region-a.geo-1",
"versionId": "1.1",
"versionInfo": "https:\/\/az-3.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/",
"versionList": "https:\/\/az-3.region-a.geo-1.compute.hpcloudsvc.com"
},
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/az-2.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/37936628937291",
"publicURL2": "https:\/\/az-2.region-a.geo-1.ec2-compute.hpcloudsvc.com\/services\/Cloud",
"region": "az-2.region-a.geo-1",
"versionId": "1.1",
"versionInfo": "https:\/\/az-2.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/",
"versionList": "https:\/\/az-2.region-a.geo-1.compute.hpcloudsvc.com"
},
{
"tenantId": "37936628937291",
"publicURL": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/37936628937291",
"publicURL2": "https:\/\/az-1.region-a.geo-1.ec2-compute.hpcloudsvc.com\/services\/Cloud",
"region": "az-1.region-a.geo-1",
"versionId": "1.1",
"versionInfo": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/",
"versionList": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com"
}
]
}
]
}}

View File

@ -88,6 +88,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-slf4j</artifactId>

View File

@ -28,6 +28,7 @@ import java.util.Properties;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.openstack.nova.v2_0.NovaApiMetadata;
import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
@ -88,6 +89,7 @@ public class CloudServersUKProviderMetadata extends BaseProviderMetadata {
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(CloudIdentityAuthenticationModule.class)
.add(ZoneModule.class)
.add(NovaParserModule.class)
.add(NovaRestClientModule.class)
.add(CloudServersUKComputeServiceContextModule.class).build())
.build())

View File

@ -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 uke this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudservers.uk;
import static org.testng.Assert.assertEquals;
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.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* This test ensures that the wiring in {@link CloudServersUKProviderMetadata} is correct.
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "CloudServersUKProviderMetadataExpectTest")
public class CloudServersUKProviderMetadataExpectTest extends BaseNovaApiExpectTest {
public CloudServersUKProviderMetadataExpectTest() {
this.provider = "rackspace-cloudservers-uk";
this.identity = "myUsername";
this.credential = "myApiKey";
}
public void testCanGetConfiguredZones() {
HttpRequest authenticate = HttpRequest.builder().method("POST")
.endpoint("https://lon.identity.api.rackspacecloud.com/v2.0/tokens")
.addHeader("Accept", "application/json")
.payload(payloadFromStringWithContentType(
"{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"myUsername\",\"apiKey\":\"myApiKey\"}}}"
, "application/json")).build();
HttpResponse authenticationResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/access_rax_uk.json", "application/json")).build();
NovaApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("LON"));
}
}

View File

@ -0,0 +1 @@
{"access":{"token":{"id":"bdd18214-e266-4ad3-b985-d9bfb22c8da8","expires":"2012-10-01T02:11:16.000+01:00","tenant":{"id":"10001786","name":"10001786"}},"serviceCatalog":[{"endpoints":[{"region":"LON","tenantId":"MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953","publicURL":"https:\/\/storage101.lon3.clouddrive.com\/v1\/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953","internalURL":"https:\/\/snet-storage101.lon3.clouddrive.com\/v1\/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953"}],"name":"cloudFiles","type":"object-store"},{"endpoints":[{"region":"LON","tenantId":"MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953","publicURL":"https:\/\/cdn3.clouddrive.com\/v1\/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953"}],"name":"cloudFilesCDN","type":"rax:object-cdn"},{"endpoints":[{"tenantId":"10001786","publicURL":"https:\/\/lon.servers.api.rackspacecloud.com\/v1.0\/10001786","versionInfo":"https:\/\/lon.servers.api.rackspacecloud.com\/v1.0","versionList":"https:\/\/lon.servers.api.rackspacecloud.com\/","versionId":"1.0"}],"name":"cloudServers","type":"compute"},{"endpoints":[{"tenantId":"10001786","publicURL":"https:\/\/lon.dns.api.rackspacecloud.com\/v1.0\/10001786"}],"name":"cloudDNS","type":"rax:dns"},{"endpoints":[{"region":"LON","tenantId":"10001786","publicURL":"https:\/\/lon.loadbalancers.api.rackspacecloud.com\/v1.0\/10001786"}],"name":"cloudLoadBalancers","type":"rax:load-balancer"},{"endpoints":[{"tenantId":"10001786","publicURL":"https:\/\/monitoring.api.rackspacecloud.com\/v1.0\/10001786"}],"name":"cloudMonitoring","type":"rax:monitor"},{"endpoints":[{"region":"LON","tenantId":"10001786","publicURL":"https:\/\/lon.databases.api.rackspacecloud.com\/v1.0\/10001786"}],"name":"cloudDatabases","type":"rax:database"},{"endpoints":[{"region":"LON","tenantId":"10001786","publicURL":"https:\/\/lon.servers.api.rackspacecloud.com\/v2\/10001786","versionInfo":"https:\/\/lon.servers.api.rackspacecloud.com\/v2","versionList":"https:\/\/lon.servers.api.rackspacecloud.com\/","versionId":"2"}],"name":"cloudServersOpenStack","type":"compute"}],"user":{"id":"378","roles":[{"id":"3","description":"User Admin Role.","name":"identity:user-admin"}],"name":"jclouds","RAX-AUTH:defaultRegion":""}}}

View File

@ -88,6 +88,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-slf4j</artifactId>

View File

@ -28,6 +28,7 @@ import java.util.Properties;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.openstack.nova.v2_0.NovaApiMetadata;
import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
@ -89,6 +90,7 @@ public class CloudServersUSProviderMetadata extends BaseProviderMetadata {
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(CloudIdentityAuthenticationModule.class)
.add(ZoneModule.class)
.add(NovaParserModule.class)
.add(NovaRestClientModule.class)
.add(CloudServersUSComputeServiceContextModule.class).build())
.build())

View File

@ -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.rackspace.cloudservers.us;
import static org.testng.Assert.assertEquals;
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.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* This test ensures that the wiring in {@link CloudServersUSProviderMetadata} is correct.
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "CloudServersUSProviderMetadataExpectTest")
public class CloudServersUSProviderMetadataExpectTest extends BaseNovaApiExpectTest {
public CloudServersUSProviderMetadataExpectTest() {
this.provider = "rackspace-cloudservers-us";
this.identity = "myUsername";
this.credential = "myApiKey";
}
public void testCanGetConfiguredZones() {
HttpRequest authenticate = HttpRequest.builder().method("POST")
.endpoint("https://identity.api.rackspacecloud.com/v2.0/tokens")
.addHeader("Accept", "application/json")
.payload(payloadFromStringWithContentType(
"{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"myUsername\",\"apiKey\":\"myApiKey\"}}}"
, "application/json")).build();
HttpResponse authenticationResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/access_rax_us.json", "application/json")).build();
NovaApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("ORD", "DFW"));
}
}

View File

@ -0,0 +1 @@
{"access":{"token":{"id":"myToken","expires":"2012-09-30T17:15:32.000-05:00","tenant":{"id":"717071","name":"717071"}},"serviceCatalog":[{"endpoints":[{"tenantId":"717071","publicURL":"https:\/\/dns.api.rackspacecloud.com\/v1.0\/717071"}],"name":"cloudDNS","type":"rax:dns"},{"endpoints":[{"tenantId":"717071","publicURL":"https:\/\/monitoring.api.rackspacecloud.com\/v1.0\/717071"}],"name":"cloudMonitoring","type":"rax:monitor"},{"endpoints":[{"region":"DFW","tenantId":"717071","publicURL":"https:\/\/dfw.servers.api.rackspacecloud.com\/v2\/717071","versionInfo":"https:\/\/dfw.servers.api.rackspacecloud.com\/v2","versionList":"https:\/\/dfw.servers.api.rackspacecloud.com\/","versionId":"2"},{"region":"ORD","tenantId":"717071","publicURL":"https:\/\/ord.servers.api.rackspacecloud.com\/v2\/717071","versionInfo":"https:\/\/ord.servers.api.rackspacecloud.com\/v2","versionList":"https:\/\/ord.servers.api.rackspacecloud.com\/","versionId":"2"}],"name":"cloudServersOpenStack","type":"compute"},{"endpoints":[{"region":"ORD","tenantId":"717071","publicURL":"https:\/\/ord.loadbalancers.api.rackspacecloud.com\/v1.0\/717071"},{"region":"DFW","tenantId":"717071","publicURL":"https:\/\/dfw.loadbalancers.api.rackspacecloud.com\/v1.0\/717071"}],"name":"cloudLoadBalancers","type":"rax:load-balancer"},{"endpoints":[{"region":"DFW","tenantId":"717071","publicURL":"https:\/\/dfw.databases.api.rackspacecloud.com\/v1.0\/717071"},{"region":"ORD","tenantId":"717071","publicURL":"https:\/\/ord.databases.api.rackspacecloud.com\/v1.0\/717071"}],"name":"cloudDatabases","type":"rax:database"},{"endpoints":[{"region":"DFW","tenantId":"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9","publicURL":"https:\/\/storage101.dfw1.clouddrive.com\/v1\/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9","internalURL":"https:\/\/snet-storage101.dfw1.clouddrive.com\/v1\/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9"},{"region":"ORD","tenantId":"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9","publicURL":"https:\/\/storage101.ord1.clouddrive.com\/v1\/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9","internalURL":"https:\/\/snet-storage101.ord1.clouddrive.com\/v1\/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9"}],"name":"cloudFiles","type":"object-store"},{"endpoints":[{"region":"DFW","tenantId":"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9","publicURL":"https:\/\/cdn1.clouddrive.com\/v1\/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9"},{"region":"ORD","tenantId":"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9","publicURL":"https:\/\/cdn2.clouddrive.com\/v1\/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9"}],"name":"cloudFilesCDN","type":"rax:object-cdn"},{"endpoints":[{"tenantId":"717071","publicURL":"https:\/\/servers.api.rackspacecloud.com\/v1.0\/717071","versionInfo":"https:\/\/servers.api.rackspacecloud.com\/v1.0","versionList":"https:\/\/servers.api.rackspacecloud.com\/","versionId":"1.0"}],"name":"cloudServers","type":"compute"},{"endpoints":[{"region":"DFW","tenantId":"717071","publicURL":"https:\/\/dfw.blockstorage.api.rackspacecloud.com\/v1\/717071"}],"name":"cloudBlockStorage","type":"volume"}],"user":{"id":"224085","roles":[{"id":"3","description":"User Admin Role.","name":"identity:user-admin"}],"name":"myUsername","RAX-AUTH:defaultRegion":"DFW"}}}

View File

@ -76,6 +76,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-slf4j</artifactId>

View File

@ -24,7 +24,10 @@ import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERAT
import java.net.URI;
import java.util.Properties;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.openstack.nova.v2_0.NovaApiMetadata;
import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
@ -74,7 +77,12 @@ public class TryStackNovaProviderMetadata extends BaseProviderMetadata {
.name("TryStack.org (Nova)")
.apiMetadata(
new NovaApiMetadata().toBuilder()
.defaultModules(ImmutableSet.<Class<? extends Module>>of(NovaRestClientModule.class, TryStackNovaServiceContextModule.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(KeystoneAuthenticationModule.class)
.add(ZoneModule.class)
.add(NovaParserModule.class)
.add(NovaRestClientModule.class)
.add(TryStackNovaServiceContextModule.class).build())
.build())
.homepage(URI.create("https://trystack.org"))
.console(URI.create("https://trystack.org/dash"))

View File

@ -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.trystack.nova;
import static org.testng.Assert.assertEquals;
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.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* This test ensures that the wiring in {@link TryStackNovaProviderMetadata} is correct.
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "TryStackNovaProviderMetadataExpectTest")
public class TryStackNovaProviderMetadataExpectTest extends BaseNovaApiExpectTest {
public TryStackNovaProviderMetadataExpectTest() {
this.provider = "trystack-nova";
this.identity = "demo:demo";
this.credential = "password";
}
public void testCanGetConfiguredZones() {
HttpRequest authenticate = HttpRequest.builder().method("POST")
.endpoint("https://nova-api.trystack.org:5443/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_trystack.json", "application/json")).build();
NovaApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("RegionOne"));
}
}

View File

@ -0,0 +1,49 @@
{
"access": {
"token": {
"expires": "2012-03-23T21:44:09",
"id": "Auth_4f173437e4b013bee56d1007",
"tenant": {
"id": "3456",
"name": "508151008"
}
},
"serviceCatalog": [{
"endpoints": [{
"adminURL": "https://nova-api.trystack.org:9774/v1.1/3456",
"region": "RegionOne",
"internalURL": "https://nova-api.trystack.org:9774/v1.1/3456",
"publicURL": "https://nova-api.trystack.org:9774/v1.1/3456"
}],
"type": "compute",
"name": "nova"
}, {
"endpoints": [{
"adminURL": "https://GLANCE_API_IS_NOT_DISCLOSED/v1.1/3456",
"region": "RegionOne",
"internalURL": "https://GLANCE_API_IS_NOT_DISCLOSED/v1.1/3456",
"publicURL": "https://GLANCE_API_IS_NOT_DISCLOSED/v1.1/3456"
}],
"type": "image",
"name": "glance"
}, {
"endpoints": [{
"adminURL": "https://nova-api.trystack.org:5443/v2.0",
"region": "RegionOne",
"internalURL": "https://keystone.thefreecloud.org:5000/v2.0",
"publicURL": "https://keystone.thefreecloud.org:5000/v2.0"
}],
"type": "identity",
"name": "keystone"
}],
"user": {
"id": "43",
"roles": [{
"tenantId": "3456",
"id": "2",
"name": "Member"
}],
"name": "508151008"
}
}
}