refactored out rackspace cloudloadblancers api from us provider specifics

This commit is contained in:
danikov 2011-11-07 13:30:24 +00:00
parent 281c92a581
commit adc95d19c0
54 changed files with 244 additions and 9 deletions

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.api</groupId>
<artifactId>cloudloadbalancers</artifactId>
<name>jclouds cloudloadbalancers api</name>
<description>jclouds components to access a rackspace implementation of LoadBalancer</description>
<packaging>bundle</packaging>
<properties>
<test.cloudloadbalancers.endpoint>https://auth.api.rackspacecloud.com</test.cloudloadbalancers.endpoint>
<test.cloudloadbalancers.apiversion>1.0</test.cloudloadbalancers.apiversion>
<test.cloudloadbalancers.identity>${test.rackspace.identity}</test.cloudloadbalancers.identity>
<test.cloudloadbalancers.credential>${test.rackspace.credential}</test.cloudloadbalancers.credential>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-loadbalancer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.common</groupId>
<artifactId>openstack-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-loadbalancer</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.common</groupId>
<artifactId>openstack-common</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.cloudloadbalancers.endpoint</name>
<value>${test.cloudloadbalancers.endpoint}</value>
</property>
<property>
<name>test.cloudloadbalancers.apiversion</name>
<value>${test.cloudloadbalancers.apiversion}</value>
</property>
<property>
<name>test.cloudloadbalancers.identity</name>
<value>${test.cloudloadbalancers.identity}</value>
</property>
<property>
<name>test.cloudloadbalancers.credential</name>
<value>${test.cloudloadbalancers.credential}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Export-Package>org.jclouds.cloudloadbalancers.*;version="${project.version}"</Export-Package>
<Import-Package>org.jclouds.*;version="${project.version}",*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -18,11 +18,17 @@
*/
package org.jclouds.cloudloadbalancers;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import org.jclouds.cloudloadbalancers.features.BaseCloudLoadBalancersAsyncClientTest;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -67,4 +73,21 @@ public class CloudLoadBalancersAsyncClientTest extends BaseCloudLoadBalancersAsy
protected void checkFilters(HttpRequest request) {
}
protected String provider = "cloudservers";
@Override
public RestContextSpec<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> createContextSpec() {
return new RestContextFactory(getProperties()).createContextSpec(provider, "user", "password", new Properties());
}
@Override
protected Properties getProperties() {
Properties overrides = new Properties();
overrides.setProperty(PROPERTY_REGIONS, "US");
overrides.setProperty(PROPERTY_API_VERSION, "1");
overrides.setProperty(provider + ".endpoint", "https://auth");
overrides.setProperty(provider + ".contextbuilder", CloudLoadBalancersContextBuilder.class.getName());
return overrides;
}
}

View File

@ -86,7 +86,7 @@ public abstract class BaseCloudLoadBalancersAsyncClientTest<T> extends RestClien
@Override
public RestContextSpec<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> createContextSpec() {
Properties props = new Properties();
return new RestContextFactory().createContextSpec("cloudloadbalancers-us", "email", "apikey", props);
return new RestContextFactory().createContextSpec("cloudloadbalancers", "email", "apikey", props);
}
@BeforeClass

View File

@ -52,7 +52,7 @@ public class BaseCloudLoadBalancersClientLiveTest {
protected CloudLoadBalancersClient client;
protected RestContext<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> context;
protected String provider = "cloudloadbalancers-us";
protected String provider = "cloudloadbalancers";
protected String identity;
protected String credential;
protected String endpoint;

View File

@ -18,9 +18,16 @@
*/
package org.jclouds.cloudloadbalancers.features;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Properties;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersAsyncClient;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersClient;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersContextBuilder;
import org.jclouds.cloudloadbalancers.domain.LoadBalancerAttributes;
import org.jclouds.cloudloadbalancers.domain.LoadBalancerRequest;
import org.jclouds.cloudloadbalancers.domain.LoadBalancerAttributes.Builder;
@ -29,6 +36,8 @@ import org.jclouds.cloudloadbalancers.functions.UnwrapLoadBalancer;
import org.jclouds.cloudloadbalancers.functions.UnwrapLoadBalancers;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
@ -163,4 +172,21 @@ public class LoadBalancerAsyncClientTest extends BaseCloudLoadBalancersAsyncClie
return new TypeLiteral<RestAnnotationProcessor<LoadBalancerAsyncClient>>() {
};
}
protected String provider = "cloudservers";
@Override
public RestContextSpec<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> createContextSpec() {
return new RestContextFactory(getProperties()).createContextSpec(provider, "user", "password", new Properties());
}
@Override
protected Properties getProperties() {
Properties overrides = new Properties();
overrides.setProperty(PROPERTY_REGIONS, "US");
overrides.setProperty(PROPERTY_API_VERSION, "1");
overrides.setProperty(provider + ".endpoint", "https://auth");
overrides.setProperty(provider + ".contextbuilder", CloudLoadBalancersContextBuilder.class.getName());
return overrides;
}
}

View File

@ -170,7 +170,7 @@ savvis-symphonyvpdc.contextbuilder=org.jclouds.savvis.vpdc.VPDCContextBuilder
savvis-symphonyvpdc.propertiesbuilder=org.jclouds.savvis.vpdc.VPDCPropertiesBuilder
cloudloadbalancers-us.contextbuilder=org.jclouds.cloudloadbalancers.CloudLoadBalancersContextBuilder
cloudloadbalancers-us.propertiesbuilder=org.jclouds.cloudloadbalancers.CloudLoadBalancersUSPropertiesBuilder
cloudloadbalancers-us.propertiesbuilder=org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersUSPropertiesBuilder
cloudfiles-us.contextbuilder=org.jclouds.cloudfiles.CloudFilesContextBuilder
cloudfiles-us.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesUSPropertiesBuilder

View File

@ -29,8 +29,8 @@
</parent>
<groupId>org.jclouds.provider</groupId>
<artifactId>cloudloadbalancers-us</artifactId>
<name>jclouds cloudloadbalancers-us core</name>
<description>jclouds components to access cloudloadbalancers-us</description>
<name>jclouds CloudLoadBalancers US provider </name>
<description>LoadBalancer implementation targeted to Rackspace US</description>
<packaging>bundle</packaging>
<properties>
@ -39,7 +39,20 @@
<test.cloudloadbalancers-us.identity>${test.rackspace-us.identity}</test.cloudloadbalancers-us.identity>
<test.cloudloadbalancers-us.credential>${test.rackspace-us.credential}</test.cloudloadbalancers-us.credential>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>cloudloadbalancers</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>cloudloadbalancers</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-loadbalancer</artifactId>

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudloadbalancers;
package org.jclouds.rackspace.cloudloadbalancers;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudloadbalancers;
package org.jclouds.rackspace.cloudloadbalancers;
import com.google.common.collect.ImmutableSet;

View File

@ -1 +1 @@
org.jclouds.cloudloadbalancers.CloudLoadBalancersUSProviderMetadata
org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersUSProviderMetadata

View File

@ -0,0 +1,33 @@
/**
* 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.cloudloadbalancers;
import org.jclouds.cloudloadbalancers.features.LoadBalancerClientLiveTest;
import org.testng.annotations.Test;
/**
*
* @author Dan Lo Bianco
*/
@Test(groups = "live", singleThreaded = true)
public class CloudLoadBalancersUSClientLiveTest extends LoadBalancerClientLiveTest {
public CloudLoadBalancersUSClientLiveTest() {
provider = "cloudloadbalancers-us";
}
}

View File

@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudloadbalancers;
package org.jclouds.rackspace.cloudloadbalancers;
import org.jclouds.providers.BaseProviderMetadataTest;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersUSProviderMetadata;
import org.testng.annotations.Test;
/**