mirror of https://github.com/apache/jclouds.git
Adds a mock test for a much longer token format for Rackspace identity
This commit is contained in:
parent
4f649b43f4
commit
92ccea8c4f
|
@ -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.openstack.keystone.v2_0.parse;
|
||||
|
||||
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.openstack.keystone.v2_0.domain.Access;
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Role;
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Service;
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Token;
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = "unit", testName = "ParseRackspaceCryptoTokenAccessTest")
|
||||
public class ParseRackspaceCryptoTokenAccessTest extends BaseItemParserTest<Access> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/raxCryptoAuth.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("access")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Access expected() {
|
||||
return Access.builder()
|
||||
.token(Token.builder()
|
||||
.expires(new SimpleDateFormatDateService().iso8601DateParse("2012-06-06T20:56:47.000-05:00"))
|
||||
.id("AADMTnolqiuwewdqwdqsdf2324f4234fndquipwou12e08_qw23f2e32f2qw4rf2432fddi_ar23d2q32p_DJOIASdd32d2323d23dqoiwjdaosiqowdijOAQIDJWqowid0aisjd_ajoisdjaoisdj1209ejdalo___qwdqwd---sdpoaqwdsaasdisdjw023d23q23edasd435gtf3g3w4egf4g4323efasdsdvsdvsasdvjmhfg43OINAOISndqaiosjkdq0w")
|
||||
.tenant(Tenant.builder().id("40806637803162").name("40806637803162").build()).build())
|
||||
.user(User.builder()
|
||||
.id("54321")
|
||||
.name("joe")
|
||||
.role(Role.builder()
|
||||
.id("3")
|
||||
.name("identity:user-admin")
|
||||
.description("User Admin Role.").build()).build())
|
||||
.service(Service.builder().name("cloudDatabases").type("rax:database")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://dfw.databases.api.rackspacecloud.com/v1.0/40806637803162")
|
||||
.region("DFW").build())
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://ord.databases.api.rackspacecloud.com/v1.0/40806637803162")
|
||||
.region("ORD").build()).build())
|
||||
.service(Service.builder().name("cloudServers").type("compute")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://servers.api.rackspacecloud.com/v1.0/40806637803162")
|
||||
.versionId("1.0")
|
||||
.versionInfo("https://servers.api.rackspacecloud.com/v1.0")
|
||||
.versionList("https://servers.api.rackspacecloud.com/").build()).build())
|
||||
.service(Service.builder().name("cloudFiles").type("object-store")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22")
|
||||
.publicURL("https://storage101.dfw1.clouddrive.com/v1/MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22")
|
||||
.internalURL("https://snet-storage101.dfw1.clouddrive.com/v1/MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22")
|
||||
.region("DFW").build()).build())
|
||||
.service(Service.builder().name("cloudServersOpenStack").type("compute")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://dfw.servers.api.rackspacecloud.com/v2/40806637803162")
|
||||
.versionInfo("https://dfw.servers.api.rackspacecloud.com/v2")
|
||||
.versionList("https://dfw.servers.api.rackspacecloud.com/")
|
||||
.versionId("2")
|
||||
.region("DFW").build()).build())
|
||||
.service(Service.builder().name("cloudLoadBalancers").type("rax:load-balancer")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://ord.loadbalancers.api.rackspacecloud.com/v1.0/40806637803162")
|
||||
.region("ORD").build())
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/40806637803162")
|
||||
.region("DFW").build()).build())
|
||||
.service(Service.builder().name("cloudBlockStorage").type("volume")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://dfw.blockstorage.api.rackspacecloud.com/v1/40806637803162")
|
||||
.region("DFW").build())
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://ord.blockstorage.api.rackspacecloud.com/v1/40806637803162")
|
||||
.region("ORD").build()).build())
|
||||
.service(Service.builder().name("cloudMonitoring").type("rax:monitor")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://monitoring.api.rackspacecloud.com/v1.0/40806637803162").build()).build())
|
||||
.service(Service.builder().name("cloudDNS").type("rax:dns")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://dns.api.rackspacecloud.com/v1.0/40806637803162").build()).build())
|
||||
.service(Service.builder().name("cloudFilesCDN").type("rax:object-cdn")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22")
|
||||
.publicURL("https://cdn1.clouddrive.com/v1/MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22")
|
||||
.region("DFW").build()).build())
|
||||
.service(Service.builder().name("cloudQueues").type("rax:queues")
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://dfw.queues.api.rackspacecloud.com/v1/40806637803162")
|
||||
.internalURL("https://snet-dfw.queues.api.rackspacecloud.com/v1/40806637803162")
|
||||
.region("DFW").build())
|
||||
.endpoint(Endpoint.builder()
|
||||
.tenantId("40806637803162")
|
||||
.publicURL("https://ord.queues.api.rackspacecloud.com/v1/40806637803162")
|
||||
.internalURL("https://snet-ord.queues.api.rackspacecloud.com/v1/40806637803162")
|
||||
.region("ORD").build()).build()).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
{
|
||||
"access": {
|
||||
"token": {
|
||||
"id": "AADMTnolqiuwewdqwdqsdf2324f4234fndquipwou12e08_qw23f2e32f2qw4rf2432fddi_ar23d2q32p_DJOIASdd32d2323d23dqoiwjdaosiqowdijOAQIDJWqowid0aisjd_ajoisdjaoisdj1209ejdalo___qwdqwd---sdpoaqwdsaasdisdjw023d23q23edasd435gtf3g3w4egf4g4323efasdsdvsdvsasdvjmhfg43OINAOISndqaiosjkdq0w",
|
||||
"expires": "2012-06-06T20:56:47.000-05:00",
|
||||
"tenant": {
|
||||
"id": "40806637803162",
|
||||
"name": "40806637803162"
|
||||
},
|
||||
"RAX-AUTH:authenticatedBy": [
|
||||
"APIKEY"
|
||||
]
|
||||
},
|
||||
"serviceCatalog": [
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"region": "DFW",
|
||||
"tenantId": "40806637803162",
|
||||
"publicURL": "https://dfw.databases.api.rackspacecloud.com/v1.0/40806637803162"
|
||||
},
|
||||
{
|
||||
"region": "ORD",
|
||||
"tenantId": "40806637803162",
|
||||
"publicURL": "https://ord.databases.api.rackspacecloud.com/v1.0/40806637803162"
|
||||
}
|
||||
],
|
||||
"name": "cloudDatabases",
|
||||
"type": "rax:database"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"tenantId": "40806637803162",
|
||||
"publicURL": "https://servers.api.rackspacecloud.com/v1.0/40806637803162",
|
||||
"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": "MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22",
|
||||
"publicURL": "https://storage101.dfw1.clouddrive.com/v1/MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22",
|
||||
"internalURL": "https://snet-storage101.dfw1.clouddrive.com/v1/MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22"
|
||||
}
|
||||
],
|
||||
"name": "cloudFiles",
|
||||
"type": "object-store"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"region": "DFW",
|
||||
"tenantId": "40806637803162",
|
||||
"publicURL": "https://dfw.servers.api.rackspacecloud.com/v2/40806637803162",
|
||||
"versionInfo": "https://dfw.servers.api.rackspacecloud.com/v2",
|
||||
"versionList": "https://dfw.servers.api.rackspacecloud.com/",
|
||||
"versionId": "2"
|
||||
}
|
||||
],
|
||||
"name": "cloudServersOpenStack",
|
||||
"type": "compute"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"region": "ORD",
|
||||
"tenantId": "40806637803162",
|
||||
"publicURL": "https://ord.loadbalancers.api.rackspacecloud.com/v1.0/40806637803162"
|
||||
},
|
||||
{
|
||||
"region": "DFW",
|
||||
"tenantId": "40806637803162",
|
||||
"publicURL": "https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/40806637803162"
|
||||
}
|
||||
],
|
||||
"name": "cloudLoadBalancers",
|
||||
"type": "rax:load-balancer"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"publicURL": "https://dfw.blockstorage.api.rackspacecloud.com/v1/40806637803162",
|
||||
"tenantId": "40806637803162",
|
||||
"region": "DFW"
|
||||
},
|
||||
{
|
||||
"publicURL": "https://ord.blockstorage.api.rackspacecloud.com/v1/40806637803162",
|
||||
"tenantId": "40806637803162",
|
||||
"region": "ORD"
|
||||
}
|
||||
],
|
||||
"type": "volume",
|
||||
"name": "cloudBlockStorage"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"tenantId": "40806637803162",
|
||||
"publicURL": "https://monitoring.api.rackspacecloud.com/v1.0/40806637803162"
|
||||
}
|
||||
],
|
||||
"name": "cloudMonitoring",
|
||||
"type": "rax:monitor"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"tenantId": "40806637803162",
|
||||
"publicURL": "https://dns.api.rackspacecloud.com/v1.0/40806637803162"
|
||||
}
|
||||
],
|
||||
"name": "cloudDNS",
|
||||
"type": "rax:dns"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"region": "DFW",
|
||||
"tenantId": "MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22",
|
||||
"publicURL": "https://cdn1.clouddrive.com/v1/MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22"
|
||||
}
|
||||
],
|
||||
"name": "cloudFilesCDN",
|
||||
"type": "rax:object-cdn"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"internalURL": "https://snet-dfw.queues.api.rackspacecloud.com/v1/40806637803162",
|
||||
"publicURL": "https://dfw.queues.api.rackspacecloud.com/v1/40806637803162",
|
||||
"tenantId": "40806637803162",
|
||||
"region": "DFW"
|
||||
},
|
||||
{
|
||||
"internalURL": "https://snet-ord.queues.api.rackspacecloud.com/v1/40806637803162",
|
||||
"publicURL": "https://ord.queues.api.rackspacecloud.com/v1/40806637803162",
|
||||
"tenantId": "40806637803162",
|
||||
"region": "ORD"
|
||||
}
|
||||
],
|
||||
"type": "rax:queues",
|
||||
"name": "cloudQueues"
|
||||
}
|
||||
],
|
||||
"user": {
|
||||
"id": "54321",
|
||||
"roles": [
|
||||
{
|
||||
"id": "3",
|
||||
"description": "User Admin Role.",
|
||||
"name": "identity:user-admin"
|
||||
}
|
||||
],
|
||||
"name": "joe"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue