mirror of https://github.com/apache/jclouds.git
Fix line endings. Use Unix line endings everywhere
This commit is contained in:
parent
9f85213b4f
commit
a585440e70
|
@ -1,43 +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.keystone.v2_0.functions;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
/**
|
||||
* Select internal URL endpoints services
|
||||
*
|
||||
*/
|
||||
@Singleton
|
||||
public class InternalURL implements EndpointToSupplierURI {
|
||||
@Override
|
||||
public Supplier<URI> apply(Endpoint input) {
|
||||
return Suppliers.ofInstance(input.getInternalURL());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "supplyInternalURL()";
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF 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.functions;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
/**
|
||||
* Select internal URL endpoints services
|
||||
*
|
||||
*/
|
||||
@Singleton
|
||||
public class InternalURL implements EndpointToSupplierURI {
|
||||
@Override
|
||||
public Supplier<URI> apply(Endpoint input) {
|
||||
return Suppliers.ofInstance(input.getInternalURL());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "supplyInternalURL()";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +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.keystone.v2_0.functions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*/
|
||||
@Test(groups = "unit", testName = "InternalURLTest")
|
||||
public class InternalURLTest {
|
||||
private final InternalURL fn = new InternalURL();
|
||||
|
||||
public void testInternalURL() {
|
||||
assertEquals(
|
||||
fn.apply(
|
||||
Endpoint.builder().region("regionOne").versionId("2.0")
|
||||
.internalURL(URI.create("https://ericsson.com/v2/1900e98b-7272-4cbd-8e95-0b8c2a9266c0"))
|
||||
.build()).get(), URI.create("https://ericsson.com/v2/1900e98b-7272-4cbd-8e95-0b8c2a9266c0"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF 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.functions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*/
|
||||
@Test(groups = "unit", testName = "InternalURLTest")
|
||||
public class InternalURLTest {
|
||||
private final InternalURL fn = new InternalURL();
|
||||
|
||||
public void testInternalURL() {
|
||||
assertEquals(
|
||||
fn.apply(
|
||||
Endpoint.builder().region("regionOne").versionId("2.0")
|
||||
.internalURL(URI.create("https://ericsson.com/v2/1900e98b-7272-4cbd-8e95-0b8c2a9266c0"))
|
||||
.build()).get(), URI.create("https://ericsson.com/v2/1900e98b-7272-4cbd-8e95-0b8c2a9266c0"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,74 +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;
|
||||
|
||||
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 org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@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/v2/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.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
||||
|
||||
assertEquals(apiWhenServersExist.getServerApi("az-1.region-a.geo-1").list().concat().toString(),
|
||||
new ParseServerListTest().expected().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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 org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@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/v2/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.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
||||
|
||||
assertEquals(apiWhenServersExist.getServerApi("az-1.region-a.geo-1").list().concat().toString(),
|
||||
new ParseServerListTest().expected().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,74 +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;
|
||||
|
||||
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
|
||||
*/
|
||||
@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/v2/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.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
||||
|
||||
assertEquals(apiWhenServersExist.getServerApi("az-1.region-a.geo-1").list().concat().toString(),
|
||||
new ParseServerListTest().expected().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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
|
||||
*/
|
||||
@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/v2/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.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
||||
|
||||
assertEquals(apiWhenServersExist.getServerApi("az-1.region-a.geo-1").list().concat().toString(),
|
||||
new ParseServerListTest().expected().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,68 +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;
|
||||
|
||||
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 org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@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/v2/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.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
||||
|
||||
assertEquals(apiWhenServersExist.getServerApi("az-1.region-a.geo-1").list().concat().toString(),
|
||||
new ParseServerListTest().expected().toString());
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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 org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@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/v2/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.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
||||
|
||||
assertEquals(apiWhenServersExist.getServerApi("az-1.region-a.geo-1").list().concat().toString(),
|
||||
new ParseServerListTest().expected().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,69 +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.swift.keystone;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
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.openstack.swift.SwiftKeystoneClient;
|
||||
import org.jclouds.openstack.swift.internal.BaseSwiftKeystoneExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest")
|
||||
public class AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest extends BaseSwiftKeystoneExpectTest<SwiftKeystoneClient> {
|
||||
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 testContainerExistsWhenResponseIs2xx() throws Exception {
|
||||
HttpRequest containerExists = HttpRequest.builder()
|
||||
.method("HEAD")
|
||||
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container")
|
||||
.addHeader("Accept", MediaType.WILDCARD)
|
||||
.addHeader("X-Auth-Token", authToken).build();
|
||||
|
||||
HttpResponse containerExistsResponse = HttpResponse.builder().statusCode(200).build();
|
||||
|
||||
SwiftKeystoneClient clientWhenContainerExists = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantId,
|
||||
responseWithKeystoneAccess, containerExists, containerExistsResponse);
|
||||
|
||||
assertEquals(clientWhenContainerExists.containerExists("container"), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.swift.keystone;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
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.openstack.swift.SwiftKeystoneClient;
|
||||
import org.jclouds.openstack.swift.internal.BaseSwiftKeystoneExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest")
|
||||
public class AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest extends BaseSwiftKeystoneExpectTest<SwiftKeystoneClient> {
|
||||
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 testContainerExistsWhenResponseIs2xx() throws Exception {
|
||||
HttpRequest containerExists = HttpRequest.builder()
|
||||
.method("HEAD")
|
||||
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container")
|
||||
.addHeader("Accept", MediaType.WILDCARD)
|
||||
.addHeader("X-Auth-Token", authToken).build();
|
||||
|
||||
HttpResponse containerExistsResponse = HttpResponse.builder().statusCode(200).build();
|
||||
|
||||
SwiftKeystoneClient clientWhenContainerExists = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantId,
|
||||
responseWithKeystoneAccess, containerExists, containerExistsResponse);
|
||||
|
||||
assertEquals(clientWhenContainerExists.containerExists("container"), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,70 +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.swift.keystone;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
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.openstack.swift.SwiftKeystoneClient;
|
||||
import org.jclouds.openstack.swift.internal.BaseSwiftKeystoneExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest")
|
||||
public class AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest extends BaseSwiftKeystoneExpectTest<SwiftKeystoneClient> {
|
||||
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 testContainerExistsWhenResponseIs2xx() throws Exception {
|
||||
HttpRequest containerExists = HttpRequest.builder()
|
||||
.method("HEAD")
|
||||
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container")
|
||||
.addHeader("Accept", MediaType.WILDCARD)
|
||||
.addHeader("X-Auth-Token", authToken).build();
|
||||
|
||||
HttpResponse containerExistsResponse = HttpResponse.builder().statusCode(200).build();
|
||||
|
||||
SwiftKeystoneClient clientWhenContainerExists = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
|
||||
responseWithKeystoneAccess, containerExists, containerExistsResponse);
|
||||
|
||||
assertEquals(clientWhenContainerExists.containerExists("container"), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.swift.keystone;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
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.openstack.swift.SwiftKeystoneClient;
|
||||
import org.jclouds.openstack.swift.internal.BaseSwiftKeystoneExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest")
|
||||
public class AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest extends BaseSwiftKeystoneExpectTest<SwiftKeystoneClient> {
|
||||
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 testContainerExistsWhenResponseIs2xx() throws Exception {
|
||||
HttpRequest containerExists = HttpRequest.builder()
|
||||
.method("HEAD")
|
||||
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container")
|
||||
.addHeader("Accept", MediaType.WILDCARD)
|
||||
.addHeader("X-Auth-Token", authToken).build();
|
||||
|
||||
HttpResponse containerExistsResponse = HttpResponse.builder().statusCode(200).build();
|
||||
|
||||
SwiftKeystoneClient clientWhenContainerExists = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
|
||||
responseWithKeystoneAccess, containerExists, containerExistsResponse);
|
||||
|
||||
assertEquals(clientWhenContainerExists.containerExists("container"), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,64 +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.swift.keystone;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.openstack.swift.SwiftKeystoneClient;
|
||||
import org.jclouds.openstack.swift.internal.BaseSwiftKeystoneExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAuthenticationExpectTest")
|
||||
public class AccessKeyAndSecretKeyAuthenticationExpectTest extends BaseSwiftKeystoneExpectTest<SwiftKeystoneClient> {
|
||||
|
||||
/**
|
||||
* 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 testContainerExistsWhenResponseIs2xx() throws Exception {
|
||||
HttpRequest containerExists = HttpRequest.builder()
|
||||
.method("HEAD")
|
||||
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container")
|
||||
.addHeader("Accept", MediaType.WILDCARD)
|
||||
.addHeader("X-Auth-Token", authToken).build();
|
||||
|
||||
HttpResponse containerExistsResponse = HttpResponse.builder().statusCode(200).build();
|
||||
|
||||
SwiftKeystoneClient clientWhenContainerExists = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
|
||||
responseWithKeystoneAccess, containerExists, containerExistsResponse);
|
||||
|
||||
assertEquals(clientWhenContainerExists.containerExists("container"), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.swift.keystone;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.openstack.swift.SwiftKeystoneClient;
|
||||
import org.jclouds.openstack.swift.internal.BaseSwiftKeystoneExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see KeystoneProperties#CREDENTIAL_TYPE
|
||||
*/
|
||||
@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAuthenticationExpectTest")
|
||||
public class AccessKeyAndSecretKeyAuthenticationExpectTest extends BaseSwiftKeystoneExpectTest<SwiftKeystoneClient> {
|
||||
|
||||
/**
|
||||
* 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 testContainerExistsWhenResponseIs2xx() throws Exception {
|
||||
HttpRequest containerExists = HttpRequest.builder()
|
||||
.method("HEAD")
|
||||
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container")
|
||||
.addHeader("Accept", MediaType.WILDCARD)
|
||||
.addHeader("X-Auth-Token", authToken).build();
|
||||
|
||||
HttpResponse containerExistsResponse = HttpResponse.builder().statusCode(200).build();
|
||||
|
||||
SwiftKeystoneClient clientWhenContainerExists = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
|
||||
responseWithKeystoneAccess, containerExists, containerExistsResponse);
|
||||
|
||||
assertEquals(clientWhenContainerExists.containerExists("container"), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,65 +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.compute.domain;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.compute.domain.internal.ComputeMetadataImpl;
|
||||
import org.jclouds.domain.ResourceMetadata;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ImplementedBy(ComputeMetadataImpl.class)
|
||||
public interface ComputeMetadata extends ResourceMetadata<ComputeType> {
|
||||
/**
|
||||
* @return Type of the resource, ex node, image, size
|
||||
*/
|
||||
@Override
|
||||
ComputeType getType();
|
||||
|
||||
/**
|
||||
* @return id of the server within the naming scope it was created. potentially generated by the
|
||||
* service.
|
||||
*/
|
||||
@Override
|
||||
String getProviderId();
|
||||
|
||||
/**
|
||||
* @return user defined name of the server.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
/**
|
||||
*
|
||||
* A means to uniquely address this resource within a provider. For example, if the namespace of
|
||||
* a node or image is region based, the id will likely include both the region and the
|
||||
* provider-supplied id encoded to avoid collisions.
|
||||
*
|
||||
* @return unique id within your account on the provider
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @return tags describing this resource, if supported
|
||||
*/
|
||||
Set<String> getTags();
|
||||
}
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.compute.domain;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.compute.domain.internal.ComputeMetadataImpl;
|
||||
import org.jclouds.domain.ResourceMetadata;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ImplementedBy(ComputeMetadataImpl.class)
|
||||
public interface ComputeMetadata extends ResourceMetadata<ComputeType> {
|
||||
/**
|
||||
* @return Type of the resource, ex node, image, size
|
||||
*/
|
||||
@Override
|
||||
ComputeType getType();
|
||||
|
||||
/**
|
||||
* @return id of the server within the naming scope it was created. potentially generated by the
|
||||
* service.
|
||||
*/
|
||||
@Override
|
||||
String getProviderId();
|
||||
|
||||
/**
|
||||
* @return user defined name of the server.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
/**
|
||||
*
|
||||
* A means to uniquely address this resource within a provider. For example, if the namespace of
|
||||
* a node or image is region based, the id will likely include both the region and the
|
||||
* provider-supplied id encoded to avoid collisions.
|
||||
*
|
||||
* @return unique id within your account on the provider
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @return tags describing this resource, if supported
|
||||
*/
|
||||
Set<String> getTags();
|
||||
}
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.compute.domain;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface ComputeMetadataIncludingStatus<S extends Enum<S>> extends ComputeMetadata {
|
||||
|
||||
/**
|
||||
* portable status of the resource
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
S getStatus();
|
||||
|
||||
/**
|
||||
* status of the resource, as supplied literally from the backend api.
|
||||
*
|
||||
* @return status or null, if the backend api has no concept of status
|
||||
* @since 1.5
|
||||
*/
|
||||
@Nullable
|
||||
String getBackendStatus();
|
||||
}
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.compute.domain;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface ComputeMetadataIncludingStatus<S extends Enum<S>> extends ComputeMetadata {
|
||||
|
||||
/**
|
||||
* portable status of the resource
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
S getStatus();
|
||||
|
||||
/**
|
||||
* status of the resource, as supplied literally from the backend api.
|
||||
*
|
||||
* @return status or null, if the backend api has no concept of status
|
||||
* @since 1.5
|
||||
*/
|
||||
@Nullable
|
||||
String getBackendStatus();
|
||||
}
|
||||
|
|
|
@ -1,28 +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.compute.domain;
|
||||
|
||||
|
||||
/**
|
||||
* The login type of the server.
|
||||
*
|
||||
*/
|
||||
public enum LoginType {
|
||||
|
||||
RDP, SSH
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.compute.domain;
|
||||
|
||||
|
||||
/**
|
||||
* The login type of the server.
|
||||
*
|
||||
*/
|
||||
public enum LoginType {
|
||||
|
||||
RDP, SSH
|
||||
|
||||
}
|
||||
|
|
|
@ -1,38 +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.domain;
|
||||
|
||||
/**
|
||||
* The scope of the location
|
||||
*
|
||||
*/
|
||||
public enum LocationScope {
|
||||
|
||||
PROVIDER,
|
||||
REGION,
|
||||
ZONE,
|
||||
/**
|
||||
* @see <a href="http://dmtf.org/standards/cloud">cimi system docs</a>
|
||||
*/
|
||||
SYSTEM,
|
||||
/**
|
||||
* E.g. the DMZ segment, secure segment.
|
||||
*/
|
||||
NETWORK,
|
||||
HOST;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.domain;
|
||||
|
||||
/**
|
||||
* The scope of the location
|
||||
*
|
||||
*/
|
||||
public enum LocationScope {
|
||||
|
||||
PROVIDER,
|
||||
REGION,
|
||||
ZONE,
|
||||
/**
|
||||
* @see <a href="http://dmtf.org/standards/cloud">cimi system docs</a>
|
||||
*/
|
||||
SYSTEM,
|
||||
/**
|
||||
* E.g. the DMZ segment, secure segment.
|
||||
*/
|
||||
NETWORK,
|
||||
HOST;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,67 +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.loadbalancer.domain;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.domain.ResourceMetadata;
|
||||
import org.jclouds.loadbalancer.domain.internal.LoadBalancerMetadataImpl;
|
||||
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ImplementedBy(LoadBalancerMetadataImpl.class)
|
||||
public interface LoadBalancerMetadata extends ResourceMetadata<LoadBalancerType> {
|
||||
/**
|
||||
* Type of the resource, ex node, image, size
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
LoadBalancerType getType();
|
||||
|
||||
/**
|
||||
* id of the server within the naming scope it was created. potentially generated by the service.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
String getProviderId();
|
||||
|
||||
/**
|
||||
* user defined name of the server.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
String getName();
|
||||
|
||||
/**
|
||||
*
|
||||
* A means to uniquely address this resource within a provider. For example, if the namespace of
|
||||
* a node or image is region based, the id will likely include both the region and the
|
||||
* provider-supplied id encoded to avoid collisions.
|
||||
*
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @return DNS Name of the load balancer; note we don't use InetAddress, as it is incompatible
|
||||
* with google appengine.
|
||||
*/
|
||||
// TODO: this is no longer the case
|
||||
Set<String> getAddresses();
|
||||
|
||||
}
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.loadbalancer.domain;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.domain.ResourceMetadata;
|
||||
import org.jclouds.loadbalancer.domain.internal.LoadBalancerMetadataImpl;
|
||||
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ImplementedBy(LoadBalancerMetadataImpl.class)
|
||||
public interface LoadBalancerMetadata extends ResourceMetadata<LoadBalancerType> {
|
||||
/**
|
||||
* Type of the resource, ex node, image, size
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
LoadBalancerType getType();
|
||||
|
||||
/**
|
||||
* id of the server within the naming scope it was created. potentially generated by the service.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
String getProviderId();
|
||||
|
||||
/**
|
||||
* user defined name of the server.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
String getName();
|
||||
|
||||
/**
|
||||
*
|
||||
* A means to uniquely address this resource within a provider. For example, if the namespace of
|
||||
* a node or image is region based, the id will likely include both the region and the
|
||||
* provider-supplied id encoded to avoid collisions.
|
||||
*
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @return DNS Name of the load balancer; note we don't use InetAddress, as it is incompatible
|
||||
* with google appengine.
|
||||
*/
|
||||
// TODO: this is no longer the case
|
||||
Set<String> getAddresses();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue