You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ab...@apache.org on 2013/05/10 23:53:25 UTC
[16/18] JCLOUDS-25. Remove oprhaned sandbox-* from repo
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java b/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java
deleted file mode 100644
index f586c2d..0000000
--- a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.libvirt.compute;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.ComputeServiceContextFactory;
-import org.jclouds.rest.RestContext;
-import org.libvirt.Connect;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@Test(groups = "unit")
-public class LibvirtComputeServiceContextBuilderTest {
-
- @Test
- public void testCanBuildWithComputeService() {
- ComputeServiceContext context = new ComputeServiceContextFactory()
- .createContext(new LibvirtComputeServiceContextSpec("test:///default", "identity", "credential"));
- // System.err.println(context.getComputeService().
- context.close();
- }
-
- @Test
- public void testCanBuildWithRestProperties() {
- Properties restProperties = new Properties();
- restProperties.setProperty("libvirt.contextbuilder", LibvirtComputeServiceContextBuilder.class.getName());
- restProperties.setProperty("libvirt.propertiesbuilder", LibvirtPropertiesBuilder.class.getName());
- restProperties.setProperty("libvirt.endpoint", "test:///default");
-
- ComputeServiceContext context = new ComputeServiceContextFactory(restProperties).createContext("libvirt",
- "identity", "credential");
-
- context.close();
- }
-
- @Test
- public void testProviderSpecificContextIsCorrectType() {
- Properties restProperties = new Properties();
- restProperties.setProperty("libvirt.contextbuilder", LibvirtComputeServiceContextBuilder.class.getName());
- restProperties.setProperty("libvirt.propertiesbuilder", LibvirtPropertiesBuilder.class.getName());
- restProperties.setProperty("libvirt.endpoint", "test:///default");
-
- ComputeServiceContext context = new ComputeServiceContextFactory(restProperties).createContext("libvirt",
- "identity", "credential");
-
- RestContext<Connect, Connect> providerContext = context.getProviderSpecificContext();
-
- assertEquals(providerContext.getApi().getClass(), Connect.class);
-
- context.close();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceLiveTest.java b/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceLiveTest.java
deleted file mode 100644
index 72e7a2b..0000000
--- a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceLiveTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.libvirt.compute;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.compute.BaseComputeServiceLiveTest;
-import org.jclouds.compute.ComputeServiceContextFactory;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.rest.RestContext;
-import org.jclouds.ssh.jsch.config.JschSshClientModule;
-import org.libvirt.Connect;
-import org.testng.annotations.Test;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "live", enabled = true, sequential = true)
-public class LibvirtComputeServiceLiveTest extends BaseComputeServiceLiveTest {
- public LibvirtComputeServiceLiveTest() {
- provider = "libvirt";
- }
-
- @Override
- protected Properties setupRestProperties() {
- Properties restProperties = new Properties();
- restProperties.setProperty("libvirt.contextbuilder", LibvirtComputeServiceContextBuilder.class.getName());
- restProperties.setProperty("libvirt.propertiesbuilder", LibvirtPropertiesBuilder.class.getName());
- restProperties.setProperty("libvirt.endpoint", "test:///default");
- return restProperties;
- }
-
- @Test
- public void testTemplateBuilder() {
- Template defaultTemplate = client.templateBuilder().build();
- assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.3");
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
- assertEquals(defaultTemplate.getLocation().getId(), "1");
- assertEquals(getCores(defaultTemplate.getHardware()), 0.5d);
- }
-
- @Override
- protected JschSshClientModule getSshModule() {
- return new JschSshClientModule();
- }
-
- public void testAssignability() throws Exception {
- @SuppressWarnings("unused")
- RestContext<Connect, Connect> goGridContext = new ComputeServiceContextFactory().createContext(provider,
- identity, credential).getProviderSpecificContext();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java b/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java
deleted file mode 100644
index 3820811..0000000
--- a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.libvirt.compute;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.ComputeServiceContextFactory;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.libvirt.compute.LibvirtComputeServiceContextSpec;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Adrian Cole
- */
-@Test(groups = "live")
-public class LibvirtExperimentLiveTest {
- protected String provider = "libvirt";
- protected String identity;
- protected String credential;
- protected String endpoint;
- protected String apiVersion;
-
- @BeforeClass
- protected void setupCredentials() {
- identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
- credential = System.getProperty("test." + provider + ".credential");
- endpoint = System.getProperty("test." + provider + ".endpoint");
- apiVersion = System.getProperty("test." + provider + ".api-version");
- }
-
- @Test
- public void testAndExperiment() {
- ComputeServiceContext context = null;
- try {
- context = new ComputeServiceContextFactory().createContext(new LibvirtComputeServiceContextSpec(
- "qemu:///system", "identity", "credential"));
-
-
- /*
- * /* System.out.println("images " + context.getComputeService().listImages());
- * System.out.println("nodes " + context.getComputeService().listNodes());
- * System.out.println("hardware profiles " +
- * context.getComputeService().listHardwareProfiles());
- */
-
-
-/* Template defaultTemplate = context.getComputeService().templateBuilder()
- .hardwareId("d106ae67-5a1b-8f91-b311-83c93bcb0a1f").imageId("1") //.locationId("")
- .build();*/
-
-
- /*
- * We will probably make a default template out of properties at some point You can control
- * the default template via overriding a method in standalonecomputeservicexontextmodule
- */
-
- Set<? extends NodeMetadata> nodeMetadataSet = context.getComputeService().createNodesInGroup("tty", 1);
- for (NodeMetadata nodeMetadata : nodeMetadataSet) {
- /*
- * context.getComputeService().suspendNode(nodeMetadata.getId());
- * context.getComputeService().resumeNode(nodeMetadata.getId());
- */
- context.getComputeService().destroyNode(nodeMetadata.getId());
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (context != null)
- context.close();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/libvirt/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/sandbox-apis/libvirt/src/test/resources/log4j.xml b/sandbox-apis/libvirt/src/test/resources/log4j.xml
deleted file mode 100644
index 9620794..0000000
--- a/sandbox-apis/libvirt/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
- <!--
- For more configuration infromation and examples see the Apache
- Log4j website: http://logging.apache.org/log4j/
- -->
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
- debug="false">
-
- <!-- A time/date based rolling appender -->
- <appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-wire.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
- <!-- A time/date based rolling appender -->
- <appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-compute.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="COMPUTEFILE" />
- </appender>
- <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="FILE" />
- </appender>
-
- <appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="WIREFILE" />
- </appender>
-
- <!-- ================ -->
- <!-- Limit categories -->
- <!-- ================ -->
-
- <category name="org.jclouds">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNC" />
- </category>
-
- <category name="jclouds.headers">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
- <category name="jclouds.wire">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
-
- <category name="jclouds.compute">
- <priority value="TRACE" />
- <appender-ref ref="ASYNCCOMPUTE" />
- </category>
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <priority value="DEBUG" />
- </root>
-
-</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/README.txt
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/README.txt b/sandbox-apis/nirvanix/README.txt
deleted file mode 100644
index a5e68dc..0000000
--- a/sandbox-apis/nirvanix/README.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-====
- Licensed to jclouds, Inc. (jclouds) under one or more
- contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. jclouds licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-====
-
-#
-# The jclouds provider for the Nirvanix Storage Delivery Network (http://www.nirvanix.com/products-services/storage-delivery-network/index.aspx).
-#
-# TODO: Implementation status.
-# TODO: Supported features.
-# TODO: Usage example.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/pom.xml b/sandbox-apis/nirvanix/pom.xml
deleted file mode 100644
index 11b6481..0000000
--- a/sandbox-apis/nirvanix/pom.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?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.7.0-SNAPSHOT</version>
- <relativePath>../../project/pom.xml</relativePath>
- </parent>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>nirvanix</artifactId>
- <name>jclouds nirvanix storage delivery network core</name>
- <description>jclouds Core components to access nirvanix nirvanix</description>
- <packaging>bundle</packaging>
-
- <!-- bootstrapping: need to fetch the project POM -->
- <repositories>
- <repository>
- <id>jclouds-sona-snapshots-nexus</id>
- <url>https://oss.sonatype.org/content/repositories/snapshots</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <properties>
- <test.nirvanix.endpoint>http://services.nirvanix.com</test.nirvanix.endpoint>
- <test.nirvanix.api-version>2.5.6</test.nirvanix.api-version>
- <test.nirvanix.build-version></test.nirvanix.build-version>
- <test.nirvanix.identity>FIXME</test.nirvanix.identity>
- <test.nirvanix.credential> FIXME </test.nirvanix.credential>
-
- <jclouds.osgi.export>org.jclouds.nirvanix.sdn*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-core</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-blobstore</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <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>
- <systemPropertyVariables>
- <test.nirvanix.endpoint>${test.nirvanix.endpoint}</test.nirvanix.endpoint>
- <test.nirvanix.api-version>${test.nirvanix.api-version}</test.nirvanix.api-version>
- <test.nirvanix.build-version>${test.nirvanix.build-version}</test.nirvanix.build-version>
- <test.nirvanix.identity>${test.nirvanix.identity}</test.nirvanix.identity>
- <test.nirvanix.credential>${test.nirvanix.credential}</test.nirvanix.credential>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAsyncClient.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAsyncClient.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAsyncClient.java
deleted file mode 100644
index 985654a..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAsyncClient.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.blobstore.binders.BindBlobToMultipartForm;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.nirvanix.sdn.binders.BindMetadataToQueryParams;
-import org.jclouds.nirvanix.sdn.domain.UploadInfo;
-import org.jclouds.nirvanix.sdn.filters.AddSessionTokenToRequest;
-import org.jclouds.nirvanix.sdn.filters.InsertUserContextIntoPath;
-import org.jclouds.nirvanix.sdn.functions.ParseMetadataFromJsonResponse;
-import org.jclouds.nirvanix.sdn.functions.ParseUploadInfoFromJsonResponse;
-import org.jclouds.nirvanix.sdn.reference.SDNQueryParams;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.OverrideRequestFilters;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SkipEncoding;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Provides;
-
-/**
- * Provides asynchronous access to Nirvanix SDN resources via their REST API.
- * <p/>
- *
- * @see SDNClient
- * @see <a href="http://developer.nirvanix.com/sitefiles/1000/API.html" />
- * @author Adrian Cole
- */
-@RequestFilters(AddSessionTokenToRequest.class)
-@SkipEncoding( { '/', ':' })
-@QueryParams(keys = SDNQueryParams.OUTPUT, values = "json")
-public interface SDNAsyncClient {
- @Provides
- public Blob newBlob();
-
- /**
- * @see SDNClient#getStorageNode
- */
- @GET
- @Path("/ws/IMFS/GetStorageNode.ashx")
- @ResponseParser(ParseUploadInfoFromJsonResponse.class)
- ListenableFuture<UploadInfo> getStorageNode(
- @QueryParam(SDNQueryParams.DESTFOLDERPATH) String folderPath,
- @QueryParam(SDNQueryParams.SIZEBYTES) long size);
-
- /**
- * @see SDNClient#upload
- */
- @POST
- @Path("/Upload.ashx")
- ListenableFuture<Void> upload(@EndpointParam URI endpoint,
- @QueryParam(SDNQueryParams.UPLOADTOKEN) String uploadToken,
- @QueryParam(SDNQueryParams.DESTFOLDERPATH) String folderPath,
- @BinderParam(BindBlobToMultipartForm.class) Blob blob);
-
- /**
- * @see SDNClient#setMetadata
- */
- @GET
- @Path("/ws/Metadata/SetMetadata.ashx")
- @QueryParams(keys = SDNQueryParams.PATH, values = "{path}")
- ListenableFuture<Void> setMetadata(@PathParam("path") String path,
- @BinderParam(BindMetadataToQueryParams.class) Map<String, String> metadata);
-
- /**
- * @see SDNClient#getMetadata
- */
- @GET
- @Path("/ws/Metadata/GetMetadata.ashx")
- @ResponseParser(ParseMetadataFromJsonResponse.class)
- @QueryParams(keys = SDNQueryParams.PATH, values = "{path}")
- ListenableFuture<Map<String, String>> getMetadata(@PathParam("path") String path);
-
- /**
- * @see SDNClient#getFile
- */
- @GET
- @Path("/{path}")
- @OverrideRequestFilters
- @RequestFilters(InsertUserContextIntoPath.class)
- ListenableFuture<String> getFile(@PathParam("path") String path);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClient.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClient.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClient.java
deleted file mode 100644
index 33d7710..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClient.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.nirvanix.sdn.functions.ParseSessionTokenFromJsonResponse;
-import org.jclouds.nirvanix.sdn.reference.SDNQueryParams;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Nirvanix SDN resources via their REST API.
- * <p/>
- *
- * @see <a href="http://developer.nirvanix.com/sitefiles/1000/API.html" />
- * @author Adrian Cole
- */
-@QueryParams(keys = SDNQueryParams.OUTPUT, values = "json")
-public interface SDNAuthAsyncClient {
-
- public interface AuthenticationResponse {
- @SessionToken
- String getSessionToken();
- }
-
- @GET
- @ResponseParser(ParseSessionTokenFromJsonResponse.class)
- @Path("/ws/Authentication/Login.ashx")
- ListenableFuture<String> authenticate(@QueryParam(SDNQueryParams.APPKEY) String appKey,
- @QueryParam(SDNQueryParams.USERNAME) String user,
- @QueryParam(SDNQueryParams.PASSWORD) String password);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNClient.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNClient.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNClient.java
deleted file mode 100644
index 8315ccd..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNClient.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.concurrent.Timeout;
-import org.jclouds.nirvanix.sdn.domain.UploadInfo;
-
-import com.google.inject.Provides;
-
-/**
- * Provides access to Nirvanix SDN resources via their REST API.
- * <p/>
- *
- * @see <a href="http://developer.nirvanix.com/sitefiles/1000/API.html" />
- * @see SDNAsyncClient
- * @author Adrian Cole
- */
-@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
-public interface SDNClient {
- @Provides
- public Blob newBlob();
-
- /**
- * The GetStorageNode method is used to determine which storage node a file should be uploaded
- * to. It returns the host to upload to and an Upload Token that will be used to authenticate.
- */
- UploadInfo getStorageNode(String folderPath, long size);
-
- void upload(URI endpoint, String uploadToken, String folderPath, Blob blob);
-
- /**
- * The SetMetadata method is used to set specified metadata for a file or folder.
- */
- void setMetadata(String path, Map<String, String> metadata);
-
- /**
- * The GetMetadata method is used to retrieve all metadata from a file or folder.
- */
- Map<String, String> getMetadata(String path);
-
- /**
- * Get the contents of a file
- */
- String getFile(String path);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java
deleted file mode 100644
index 726880e..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.nirvanix.sdn.config.SDNAuthRestClientModule;
-import org.jclouds.nirvanix.sdn.config.SDNRestClientModule;
-import org.jclouds.rest.RestContextBuilder;
-
-import com.google.inject.Module;
-
-/**
- *
- * @author Adrian Cole
- */
-public class SDNContextBuilder extends RestContextBuilder<SDNClient, SDNAsyncClient> {
-
- public SDNContextBuilder(Properties props) {
- super(SDNClient.class, SDNAsyncClient.class, props);
- }
-
- @Override
- protected void addClientModule(List<Module> modules) {
- modules.add(new SDNAuthRestClientModule());
- modules.add(new SDNRestClientModule());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNPropertiesBuilder.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNPropertiesBuilder.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNPropertiesBuilder.java
deleted file mode 100644
index 8825e7b..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNPropertiesBuilder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import java.util.Properties;
-
-import org.jclouds.Constants;
-import org.jclouds.PropertiesBuilder;
-
-/**
- * Builds properties used in SDN Clients
- *
- * @author Adrian Cole
- */
-public class SDNPropertiesBuilder extends PropertiesBuilder {
-
- @Override
- protected Properties defaultProperties() {
- Properties properties = super.defaultProperties();
- properties.setProperty(Constants.PROPERTY_API_VERSION, "2.5.6");
- properties.setProperty(Constants.PROPERTY_ENDPOINT, "http://services.nirvanix.com");
- return properties;
- }
-
- public SDNPropertiesBuilder(Properties properties) {
- super(properties);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SessionToken.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SessionToken.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SessionToken.java
deleted file mode 100644
index e8fc119..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SessionToken.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * Related to a SDN resource.
- *
- * @author Adrian Cole
- *
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
-@Qualifier
-public @interface SessionToken {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java
deleted file mode 100644
index 6de711a..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-import javax.ws.rs.core.UriBuilder;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.utils.ModifyRequest;
-import org.jclouds.rest.Binder;
-
-import com.google.common.collect.Lists;
-
-@Singleton
-public class BindMetadataToQueryParams implements Binder {
- private final Provider<UriBuilder> builder;
-
- @Inject
- BindMetadataToQueryParams(Provider<UriBuilder> builder) {
- this.builder = builder;
- }
-
- @SuppressWarnings("unchecked")
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Maps!");
- Map<String, String> userMetadata = (Map<String, String>) input;
- List<String> metadata = Lists.newArrayList();
- for (Entry<String, String> entry : userMetadata.entrySet()) {
- metadata.add(String.format("%s:%s", entry.getKey().toLowerCase(), entry.getValue()));
- }
- return ModifyRequest.addQueryParam(request, "metadata", metadata, builder.get());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNAuthRestClientModule.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNAuthRestClientModule.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNAuthRestClientModule.java
deleted file mode 100644
index 38d7499..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNAuthRestClientModule.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.config;
-
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.http.RequiresHttp;
-import org.jclouds.nirvanix.sdn.SDNAuthAsyncClient;
-import org.jclouds.nirvanix.sdn.SessionToken;
-import org.jclouds.nirvanix.sdn.reference.SDNConstants;
-import org.jclouds.rest.AsyncClientFactory;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-
-/**
- * Configures the SDN authentication service connection, including logging and http transport.
- *
- * @author Adrian Cole
- */
-@RequiresHttp
-public class SDNAuthRestClientModule extends AbstractModule {
-
- @Override
- protected void configure() {
- }
-
- @Provides
- @Singleton
- @Named(SDNConstants.PROPERTY_SDN_APPKEY)
- public String credentials1(@Named(Constants.PROPERTY_IDENTITY) String identity) {
- List<String> parts = Lists.newArrayList(Splitter.on('/').split(identity));
- if (parts.size() != 3) {
- throw new IllegalArgumentException("identity syntax is appkey/appname/username");
- }
- return parts.get(0);
- }
-
- @Provides
- @Singleton
- @Named(SDNConstants.PROPERTY_SDN_APPNAME)
- public String credentials2(@Named(Constants.PROPERTY_IDENTITY) String identity) {
- List<String> parts = Lists.newArrayList(Splitter.on('/').split(identity));
- if (parts.size() != 3) {
- throw new IllegalArgumentException("identity syntax is appkey/appname/username");
- }
- return parts.get(1);
- }
-
- @Provides
- @Singleton
- @Named(SDNConstants.PROPERTY_SDN_USERNAME)
- public String credentials3(@Named(Constants.PROPERTY_IDENTITY) String identity) {
- List<String> parts = Lists.newArrayList(Splitter.on('/').split(identity));
- if (parts.size() != 3) {
- throw new IllegalArgumentException("identity syntax is appkey/appname/username");
- }
- return parts.get(2);
- }
-
- @Provides
- @SessionToken
- protected String provideSessionToken(AsyncClientFactory factory,
- @Named(SDNConstants.PROPERTY_SDN_APPKEY) String appKey,
- @Named(SDNConstants.PROPERTY_SDN_USERNAME) String username,
- @Named(Constants.PROPERTY_CREDENTIAL) String password) throws InterruptedException,
- ExecutionException, TimeoutException {
- return factory.create(SDNAuthAsyncClient.class).authenticate(appKey, username, password).get(
- 20, TimeUnit.SECONDS);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNRestClientModule.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNRestClientModule.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNRestClientModule.java
deleted file mode 100644
index 8582ae8..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNRestClientModule.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.config;
-
-import org.jclouds.blobstore.config.BlobStoreObjectModule;
-import org.jclouds.http.RequiresHttp;
-import org.jclouds.nirvanix.sdn.SDNAsyncClient;
-import org.jclouds.nirvanix.sdn.SDNClient;
-import org.jclouds.rest.config.RestClientModule;
-
-/**
- * Configures the SDN authentication service connection, including logging and http transport.
- *
- * @author Adrian Cole
- */
-@RequiresHttp
-public class SDNRestClientModule extends RestClientModule<SDNClient, SDNAsyncClient> {
-
- public SDNRestClientModule() {
- super(SDNClient.class, SDNAsyncClient.class);
- }
-
- @Override
- protected void configure() {
- install(new BlobStoreObjectModule());
- super.configure();
- }
-
- @Override
- protected void bindRetryHandlers() {
- // TODO retry on 401 by AuthenticateRequest.update()
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/domain/UploadInfo.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/domain/UploadInfo.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/domain/UploadInfo.java
deleted file mode 100644
index 8b6a1f0..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/domain/UploadInfo.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.domain;
-
-import java.net.URI;
-
-public class UploadInfo {
- private final String token;
- private final URI host;
-
- public UploadInfo(String token, URI host) {
- this.token = token;
- this.host = host;
- }
-
- public String getToken() {
- return token;
- }
-
- public URI getHost() {
- return host;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java
deleted file mode 100644
index b0d7cde..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.filters;
-
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-import javax.ws.rs.core.UriBuilder;
-
-import com.google.commons.util.concurrent.Atomitcs;
-
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.http.utils.ModifyRequest;
-import org.jclouds.nirvanix.sdn.SessionToken;
-import org.jclouds.nirvanix.sdn.reference.SDNQueryParams;
-
-/**
- * Adds the Session Token to the request. This will update the Session Token before 20 minutes is
- * up.
- *
- * @author Adrian Cole
- *
- */
-@Singleton
-public class AddSessionTokenToRequest implements HttpRequestFilter {
-
- private final Provider<String> authTokenProvider;
- private final Provider<UriBuilder> builder;
-
- public final long BILLION = 1000000000;
- public final long MINUTES = 60 * BILLION;
-
- private final AtomicReference<String> authToken;
- private final AtomicLong trigger = new AtomicLong(0);
-
- /**
- * Start the time update service. Nirvanix clocks need to be 20 minutes of the session token.
- * This is not performed per-request, as creation of the token is a slow, synchronized command.
- */
- synchronized void updateIfTimeOut() {
-
- if (trigger.get() - System.nanoTime() <= 0) {
- createNewToken();
- }
-
- }
-
- // this is a hotspot when submitted concurrently, so be lazy.
- // session tokens expire in 20 minutes of no use, but let's be a little paranoid and go 19
- public String createNewToken() {
- authToken.set(authTokenProvider.get());
- trigger.set(System.nanoTime() + System.nanoTime() + 19 * MINUTES);
- return authToken.get();
-
- }
-
- public String getSessionToken() {
- updateIfTimeOut();
- return authToken.get();
- }
-
- @Inject
- public AddSessionTokenToRequest(@SessionToken Provider<String> authTokenProvider, Provider<UriBuilder> builder) {
- this.builder = builder;
- this.authTokenProvider = authTokenProvider;
- authToken = Atomics.newReference();
- }
-
- @Override
- public HttpRequest filter(HttpRequest request) throws HttpException {
- return ModifyRequest.addQueryParam(request, SDNQueryParams.SESSIONTOKEN, getSessionToken(), builder.get());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPath.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPath.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPath.java
deleted file mode 100644
index ae08354..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPath.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.filters;
-
-import java.net.URI;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-import javax.ws.rs.core.UriBuilder;
-
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.nirvanix.sdn.reference.SDNConstants;
-
-/**
- * Adds the Session Token to the request. This will update the Session Token before 20 minutes is
- * up.
- *
- * @author Adrian Cole
- *
- */
-@Singleton
-public class InsertUserContextIntoPath implements HttpRequestFilter {
-
- private final AddSessionTokenToRequest sessionManager;
- private final String pathPrefix;
- private final Provider<UriBuilder> builder;
-
- @Inject
- public InsertUserContextIntoPath(AddSessionTokenToRequest sessionManager,
- @Named(SDNConstants.PROPERTY_SDN_APPNAME) String appname,
- @Named(SDNConstants.PROPERTY_SDN_USERNAME) String username, Provider<UriBuilder> builder) {
- this.builder = builder;
- this.sessionManager = sessionManager;
- this.pathPrefix = String.format("/%s/%s/", appname, username);
- }
-
- @Override
- public HttpRequest filter(HttpRequest request) throws HttpException {
- String sessionToken = sessionManager.getSessionToken();
- int prefixIndex = request.getEndpoint().getPath().indexOf(pathPrefix);
- String path;
- if (prefixIndex == -1) { // addToken
- path = "/" + sessionToken + pathPrefix + request.getEndpoint().getPath().substring(1);
- } else { // replace token
- path = "/" + sessionToken + request.getEndpoint().getPath().substring(prefixIndex);
- }
- URI newEndpoint = builder.get().uri(request.getEndpoint()).replacePath(path).build();
- return request.toBuilder().endpoint(newEndpoint).build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponse.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponse.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponse.java
deleted file mode 100644
index 5186fff..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponse.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.functions;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseJson;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Maps;
-
-/**
- * This parses a Map of Metadata from a Nirvanix response
- *
- * @author Adrian Cole
- */
-@Singleton
-public class ParseMetadataFromJsonResponse implements
- Function<HttpResponse, Map<String, String>> {
-
- private final ParseJson<Response> json;
-
- @Inject
- ParseMetadataFromJsonResponse(ParseJson<Response> json) {
- this.json = json;
- }
-
- @Override
- public Map<String, String> apply(HttpResponse arg0) {
- Response response = json.apply(arg0);
- if (response.ResponseCode == null || response.ResponseCode != 0)
- throw new RuntimeException("bad response code: "
- + response.ResponseCode);
- Map<String, String> metadata = Maps.newHashMap();
- for (Map<String, String> keyValue : response.Metadata) {
- metadata.put(keyValue.get("Type"), keyValue.get("Value"));
- }
- return metadata;
- }
-
- private static class Response {
- Integer ResponseCode;
- List<Map<String, String>> Metadata;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponse.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponse.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponse.java
deleted file mode 100644
index 09316bb..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponse.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.functions;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseJson;
-
-import com.google.common.base.Function;
-
-/**
- * This parses the Nirvanix SessionToken from a gson string.
- *
- * @author Adrian Cole
- */
-@Singleton
-public class ParseSessionTokenFromJsonResponse implements
- Function<HttpResponse, String> {
-
- private final ParseJson<Response> json;
-
- @Inject
- ParseSessionTokenFromJsonResponse(ParseJson<Response> json) {
- this.json = json;
- }
-
- @Override
- public String apply(HttpResponse arg0) {
- Response response = json.apply(arg0);
- if (response.ResponseCode == null || response.ResponseCode != 0)
- throw new RuntimeException("bad response code: "
- + response.ResponseCode);
- return response.SessionToken;
- }
-
- private static class Response {
- Integer ResponseCode;
- String SessionToken;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponse.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponse.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponse.java
deleted file mode 100644
index adf1b70..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponse.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.functions;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.nirvanix.sdn.domain.UploadInfo;
-
-import com.google.common.base.Function;
-
-/**
- * This parses the Nirvanix Upload host and token from a gson string.
- *
- * @see UploadInfo
- * @author Adrian Cole
- */
-@Singleton
-public class ParseUploadInfoFromJsonResponse implements
- Function<HttpResponse, UploadInfo> {
-
- private final ParseJson<Response> json;
-
- @Inject
- ParseUploadInfoFromJsonResponse(ParseJson<Response> json) {
- this.json = json;
- }
-
- @Override
- public UploadInfo apply(HttpResponse arg0) {
- Response response = json.apply(arg0);
- if (response.ResponseCode == null || response.ResponseCode != 0)
- throw new RuntimeException("bad response code: "
- + response.ResponseCode);
- return new UploadInfo(response.GetStorageNode.get("UploadToken"), URI
- .create("https://" + response.GetStorageNode.get("UploadHost")));
- }
-
- private static class Response {
- Integer ResponseCode;
- Map<String, String> GetStorageNode;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNConstants.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNConstants.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNConstants.java
deleted file mode 100644
index 4830f0c..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.reference;
-
-/**
- * Configuration properties and constants used in SDN connections.
- *
- * @author Adrian Cole
- */
-public interface SDNConstants {
- public static final String PROPERTY_SDN_USERNAME = "jclouds.nirvanix.sdn.username";
- public static final String PROPERTY_SDN_APPKEY = "jclouds.nirvanix.sdn.appkey";
- public static final String PROPERTY_SDN_APPNAME = "jclouds.nirvanix.sdn.appname";
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNQueryParams.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNQueryParams.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNQueryParams.java
deleted file mode 100644
index c348a68..0000000
--- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNQueryParams.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn.reference;
-
-/**
- * Query parameters common to SDN apis.
- *
- * @see <a href="http://developer.nirvanix.com/sitefiles/1000/API.html" />
- * @author Adrian Cole
- *
- */
-public interface SDNQueryParams {
- public static final String USERNAME = "username";
- public static final String PASSWORD = "password";
- public static final String APPKEY = "appKey";
- public static final String OUTPUT = "output";
- public static final String SESSIONTOKEN = "sessionToken";
- public static final String DESTFOLDERPATH = "destFolderPath";
- public static final String PATH = "path";
- public static final String SIZEBYTES = "sizeBytes";
- public static final String UPLOADTOKEN = "uploadToken";
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAsyncClientTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAsyncClientTest.java
deleted file mode 100644
index b4620ae..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAsyncClientTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.RequiresHttp;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.http.functions.ReturnStringIf2xx;
-import org.jclouds.nirvanix.sdn.config.SDNRestClientModule;
-import org.jclouds.nirvanix.sdn.filters.AddSessionTokenToRequest;
-import org.jclouds.nirvanix.sdn.filters.InsertUserContextIntoPath;
-import org.jclouds.nirvanix.sdn.functions.ParseMetadataFromJsonResponse;
-import org.jclouds.nirvanix.sdn.functions.ParseUploadInfoFromJsonResponse;
-import org.jclouds.nirvanix.sdn.reference.SDNConstants;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestClientTest;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.rest.RestContextSpec;
-import org.jclouds.rest.internal.RestAnnotationProcessor;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-/**
- * Tests behavior of {@code JaxrsAnnotationProcessor}
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "sdn.SDNClient")
-public class SDNAsyncClientTest extends RestClientTest<SDNAsyncClient> {
-
- public void testGetStorageNode() throws SecurityException, NoSuchMethodException, IOException {
- Method method = SDNAsyncClient.class.getMethod("getStorageNode", String.class, long.class);
- GeneratedHttpRequest request = processor.createRequest(method, "adriansmovies", 734859264);
-
- assertRequestLineEquals(
- request,
- "GET http://services.nirvanix.com/ws/IMFS/GetStorageNode.ashx?output=json&destFolderPath=adriansmovies&sizeBytes=734859264 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseUploadInfoFromJsonResponse.class);
- assertSaxResponseParserClassEquals(method, null);
- assertExceptionParserClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testUpload() throws SecurityException, NoSuchMethodException, IOException {
- Method method = SDNAsyncClient.class.getMethod("upload", URI.class, String.class, String.class, Blob.class);
- Blob blob = BindBlobToMultipartFormTest.TEST_BLOB;
- GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://uploader"), "token", "adriansmovies",
- blob);
-
- assertRequestLineEquals(request,
- "POST http://uploader/Upload.ashx?output=json&destFolderPath=adriansmovies&uploadToken=token HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- StringBuilder expects = new StringBuilder();
- expects.append("----JCLOUDS--\r\n");
- expects.append("Content-Disposition: form-data; name=\"hello\"\r\n");
- expects.append("Content-Type: text/plain\r\n\r\n");
- expects.append("hello\r\n");
- expects.append("----JCLOUDS----\r\n");
-
- assertPayloadEquals(request, expects.toString(), "multipart/form-data; boundary=--JCLOUDS--", false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertExceptionParserClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testSetMetadata() throws SecurityException, NoSuchMethodException, IOException {
- Method method = SDNAsyncClient.class.getMethod("setMetadata", String.class, Map.class);
- GeneratedHttpRequest request = processor.createRequest(method, "adriansmovies/sushi.avi", ImmutableMap.of("Chef",
- "Kawasaki"));
-
- assertRequestLineEquals(
- request,
- "GET http://services.nirvanix.com/ws/Metadata/SetMetadata.ashx?output=json&path=adriansmovies/sushi.avi&metadata=chef:Kawasaki HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertExceptionParserClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testGetMetadata() throws SecurityException, NoSuchMethodException, IOException {
- Method method = SDNAsyncClient.class.getMethod("getMetadata", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, "adriansmovies/sushi.avi");
-
- assertRequestLineEquals(request,
- "GET http://services.nirvanix.com/ws/Metadata/GetMetadata.ashx?output=json&path=adriansmovies/sushi.avi HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseMetadataFromJsonResponse.class);
- assertSaxResponseParserClassEquals(method, null);
- assertExceptionParserClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testGetFile() throws SecurityException, NoSuchMethodException, IOException {
- Method method = SDNAsyncClient.class.getMethod("getFile", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, "adriansmovies/sushi.avi");
-
- assertRequestLineEquals(request, "GET http://services.nirvanix.com/adriansmovies/sushi.avi?output=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnStringIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertExceptionParserClassEquals(method, null);
-
- assertEquals(request.getFilters().size(), 1);
- assertEquals(request.getFilters().get(0).getClass(), InsertUserContextIntoPath.class);
-
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
- assertEquals(request.getFilters().size(), 1);
- assertEquals(request.getFilters().get(0).getClass(), AddSessionTokenToRequest.class);
- }
-
- @Override
- protected TypeLiteral<RestAnnotationProcessor<SDNAsyncClient>> createTypeLiteral() {
- return new TypeLiteral<RestAnnotationProcessor<SDNAsyncClient>>() {
- };
- }
-
- protected Module createModule() {
- return new TestSDNRestClientModule();
- }
-
- @RequiresHttp
- @ConfiguresRestClient
- static class TestSDNRestClientModule extends SDNRestClientModule {
- @Override
- public void configure() {
- bind(String.class).annotatedWith(SessionToken.class).toInstance("sessiontoken");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPKEY)).toInstance("appKey");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPNAME)).toInstance("appname");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_USERNAME)).toInstance("username");
- }
-
- }
-
- @Override
- public RestContextSpec<SDNClient, SDNAsyncClient> createContextSpec() {
- return new RestContextFactory().createContextSpec("sdn", "user", "password", new Properties());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClientTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClientTest.java
deleted file mode 100644
index 3243ffd..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClientTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import static org.jclouds.rest.RestContextFactory.contextSpec;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.nirvanix.sdn.SDNAuthenticationLiveTest.SDNAuthClient;
-import org.jclouds.nirvanix.sdn.functions.ParseSessionTokenFromJsonResponse;
-import org.jclouds.rest.RestClientTest;
-import org.jclouds.rest.RestContextSpec;
-import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
-import org.jclouds.rest.internal.RestAnnotationProcessor;
-import org.testng.annotations.Test;
-
-import com.google.inject.TypeLiteral;
-
-/**
- * Tests behavior of {@code JaxrsAnnotationProcessor}
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "sdn.SDNAuthentication")
-public class SDNAuthAsyncClientTest extends RestClientTest<SDNAuthAsyncClient> {
-
- public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException {
- Method method = SDNAuthAsyncClient.class.getMethod("authenticate", String.class, String.class, String.class);
- GeneratedHttpRequest httpRequest = processor.createRequest(method, "apple", "foo", "bar");
- assertRequestLineEquals(httpRequest,
- "GET http://localhost:8080/ws/Authentication/Login.ashx?output=json&appKey=apple&password=bar&username=foo HTTP/1.1");
- assertNonPayloadHeadersEqual(httpRequest, "");
- assertPayloadEquals(httpRequest, null, null, false);
-
- assertResponseParserClassEquals(method, httpRequest, ParseSessionTokenFromJsonResponse.class);
- assertSaxResponseParserClassEquals(method, null);
- assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
-
- }
-
- @Override
- protected TypeLiteral<RestAnnotationProcessor<SDNAuthAsyncClient>> createTypeLiteral() {
- return new TypeLiteral<RestAnnotationProcessor<SDNAuthAsyncClient>>() {
- };
- }
-
- @Override
- public RestContextSpec<SDNAuthClient, SDNAuthAsyncClient> createContextSpec() {
- return contextSpec("test", "http://localhost:8080", "1", "", "identity", "credential", SDNAuthClient.class,
- SDNAuthAsyncClient.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthenticationLiveTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthenticationLiveTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthenticationLiveTest.java
deleted file mode 100644
index 849e8b4..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthenticationLiveTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.nirvanix.sdn;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.rest.RestContextFactory.contextSpec;
-import static org.jclouds.rest.RestContextFactory.createContextBuilder;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.concurrent.MoreExecutors;
-import org.jclouds.concurrent.Timeout;
-import org.jclouds.concurrent.config.ExecutorServiceModule;
-import org.jclouds.logging.log4j.config.Log4JLoggingModule;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.RestContextSpec;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.inject.Module;
-
-/**
- * Tests behavior of {@code SDNAuthentication}
- *
- * @author Adrian Cole
- */
-@Test(groups = "live", testName = "sdn.SDNAuthenticationLiveTest")
-public class SDNAuthenticationLiveTest {
-
- private RestContext<SDNAuthClient, SDNAuthAsyncClient> context;
-
- @Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
- public interface SDNAuthClient {
-
- String authenticate(String appKey, String user, String password);
- }
-
- private String credential;
- private String identity;
-
- @Test
- public void testAuthentication() throws Exception {
- ArrayList<String> list = Lists.newArrayList(Splitter.on('/').split(credential));
- String response = context.getApi().authenticate(list.get(0), list.get(1), identity);
- assertNotNull(response);
- }
-
- @BeforeClass
- void setupFactory() {
-
- String endpoint = "http://services.nirvanix.com";
- identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
- credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
-
- RestContextSpec<SDNAuthClient, SDNAuthAsyncClient> contextSpec = contextSpec("test", endpoint, "1", "", identity,
- credential, SDNAuthClient.class, SDNAuthAsyncClient.class);
-
- context = createContextBuilder(
- contextSpec,
- ImmutableSet.<Module> of(new Log4JLoggingModule(), new ExecutorServiceModule(MoreExecutors
- .sameThreadExecutor(), MoreExecutors.sameThreadExecutor()))).buildContext();
- }
-}