updated pcs

This commit is contained in:
Adrian Cole 2011-02-18 16:55:18 -08:00
parent 5c1c731311
commit 5f676d99b8
62 changed files with 305 additions and 218 deletions

View File

@ -20,6 +20,8 @@
package org.jclouds.logging.internal; package org.jclouds.logging.internal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.io.Closeables.closeQuietly;
import static org.jclouds.io.Payloads.newPayload;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
@ -33,11 +35,9 @@ import javax.annotation.Resource;
import org.jclouds.io.MutableContentMetadata; import org.jclouds.io.MutableContentMetadata;
import org.jclouds.io.Payload; import org.jclouds.io.Payload;
import org.jclouds.io.PayloadEnclosing; import org.jclouds.io.PayloadEnclosing;
import org.jclouds.io.Payloads;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.google.common.io.Closeables;
import com.google.common.io.FileBackedOutputStream; import com.google.common.io.FileBackedOutputStream;
/** /**
@ -101,8 +101,8 @@ public abstract class Wire {
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("Error tapping line", e); throw new RuntimeException("Error tapping line", e);
} finally { } finally {
Closeables.closeQuietly(out); closeQuietly(out);
Closeables.closeQuietly(instream); closeQuietly(instream);
} }
} }
@ -112,14 +112,19 @@ public abstract class Wire {
public void input(PayloadEnclosing request) { public void input(PayloadEnclosing request) {
Payload oldContent = request.getPayload(); Payload oldContent = request.getPayload();
Payload wiredPayload = Payloads.newPayload(input(oldContent.getInput())); Payload wiredPayload = newPayload(input(oldContent.getInput()));
copyPayloadMetadata(oldContent, wiredPayload); copyPayloadMetadata(oldContent, wiredPayload);
request.setPayload(wiredPayload); request.setPayload(wiredPayload);
} }
public void output(PayloadEnclosing request) { public void output(PayloadEnclosing request) {
Payload oldContent = request.getPayload(); Payload oldContent = request.getPayload();
Payload wiredPayload = Payloads.newPayload(output(oldContent.getRawContent())); Payload wiredPayload;
try {
wiredPayload = newPayload(output(oldContent.getRawContent()));
} catch (UnsupportedOperationException e) {
wiredPayload = newPayload(output(oldContent.getInput()));
}
copyPayloadMetadata(oldContent, wiredPayload); copyPayloadMetadata(oldContent, wiredPayload);
request.setPayload(wiredPayload); request.setPayload(wiredPayload);
} }
@ -150,9 +155,8 @@ public abstract class Wire {
} else if (data instanceof File) { } else if (data instanceof File) {
output(((File) data)); output(((File) data));
return data; return data;
} else {
throw new UnsupportedOperationException("Content not supported " + data.getClass());
} }
throw new UnsupportedOperationException("Content not supported " + data.getClass());
} }
private void output(final File out) { private void output(final File out) {
@ -164,7 +168,7 @@ public abstract class Wire {
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
logger.error(e, "Error tapping file: %s", out); logger.error(e, "Error tapping file: %s", out);
} finally { } finally {
Closeables.closeQuietly(in); closeQuietly(in);
} }
} }

View File

@ -29,8 +29,8 @@ azurequeue.endpoint=https://{identity}.queue.core.windows.net
azureblob.contextbuilder=org.jclouds.azureblob.AzureBlobContextBuilder azureblob.contextbuilder=org.jclouds.azureblob.AzureBlobContextBuilder
azureblob.propertiesbuilder=org.jclouds.azureblob.AzureBlobPropertiesBuilder azureblob.propertiesbuilder=org.jclouds.azureblob.AzureBlobPropertiesBuilder
pcs.contextbuilder=org.jclouds.mezeo.pcs2.PCSContextBuilder pcs.contextbuilder=org.jclouds.mezeo.pcs.PCSContextBuilder
pcs.apiVersion=unknown pcs.propertiesbuilder=org.jclouds.mezeo.pcs.PCSPropertiesBuilder
sdn.contextbuilder=org.jclouds.nirvanix.sdn.SDNContextBuilder sdn.contextbuilder=org.jclouds.nirvanix.sdn.SDNContextBuilder
sdn.propertiesbuilder=org.jclouds.nirvanix.sdn.SDNPropertiesBuilder sdn.propertiesbuilder=org.jclouds.nirvanix.sdn.SDNPropertiesBuilder

View File

@ -30,7 +30,7 @@
</parent> </parent>
<groupId>org.jclouds.api</groupId> <groupId>org.jclouds.api</groupId>
<artifactId>pcs</artifactId> <artifactId>pcs</artifactId>
<name>jclouds mezeo cloud storage platform v2 core</name> <name>jclouds mezeo cloud storage platform core</name>
<description>jclouds Core components to access mezeo pcs2</description> <description>jclouds Core components to access mezeo pcs2</description>
<!-- bootstrapping: need to fetch the project POM --> <!-- bootstrapping: need to fetch the project POM -->
<repositories> <repositories>
@ -55,6 +55,11 @@
<artifactId>jclouds-core</artifactId> <artifactId>jclouds-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-blobstore</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.jclouds</groupId> <groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId> <artifactId>jclouds-core</artifactId>
@ -62,6 +67,13 @@
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-blobstore</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
@ -83,7 +95,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<executions>:%s/ <executions>
<execution> <execution>
<id>integration</id> <id>integration</id>
<phase>integration-test</phase> <phase>integration-test</phase>

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2; package org.jclouds.mezeo.pcs;
import java.io.InputStream; import java.io.InputStream;
import java.net.URI; import java.net.URI;
@ -33,17 +33,17 @@ import javax.ws.rs.Produces;
import org.jclouds.blobstore.functions.ReturnNullOnKeyNotFound; import org.jclouds.blobstore.functions.ReturnNullOnKeyNotFound;
import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.mezeo.pcs2.binders.BindContainerNameToXmlPayload; import org.jclouds.mezeo.pcs.binders.BindContainerNameToXmlPayload;
import org.jclouds.mezeo.pcs2.binders.BindFileInfoToXmlPayload; import org.jclouds.mezeo.pcs.binders.BindFileInfoToXmlPayload;
import org.jclouds.mezeo.pcs2.binders.BindPCSFileToMultipartForm; import org.jclouds.mezeo.pcs.binders.BindPCSFileToMultipartForm;
import org.jclouds.mezeo.pcs2.domain.ContainerList; import org.jclouds.mezeo.pcs.domain.ContainerList;
import org.jclouds.mezeo.pcs2.domain.FileInfoWithMetadata; import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.jclouds.mezeo.pcs2.endpoints.RootContainer; import org.jclouds.mezeo.pcs.endpoints.RootContainer;
import org.jclouds.mezeo.pcs2.functions.AddMetadataItemIntoMap; import org.jclouds.mezeo.pcs.functions.AddMetadataItemIntoMap;
import org.jclouds.mezeo.pcs2.options.PutBlockOptions; import org.jclouds.mezeo.pcs.options.PutBlockOptions;
import org.jclouds.mezeo.pcs2.xml.ContainerHandler; import org.jclouds.mezeo.pcs.xml.ContainerHandler;
import org.jclouds.mezeo.pcs2.xml.FileHandler; import org.jclouds.mezeo.pcs.xml.FileHandler;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
@ -59,7 +59,7 @@ import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
/** /**
* Provides asynchronous access to Mezeo PCS v2 via their REST API. * Provides asynchronous access to Mezeo PCS via their REST API.
* <p/> * <p/>
* *
* @see PCSClient * @see PCSClient

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2; package org.jclouds.mezeo.pcs;
import java.io.InputStream; import java.io.InputStream;
import java.net.URI; import java.net.URI;
@ -25,13 +25,13 @@ import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.mezeo.pcs2.domain.ContainerList; import org.jclouds.mezeo.pcs.domain.ContainerList;
import org.jclouds.mezeo.pcs2.domain.FileInfoWithMetadata; import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.jclouds.mezeo.pcs2.options.PutBlockOptions; import org.jclouds.mezeo.pcs.options.PutBlockOptions;
/** /**
* Provides access to Mezeo PCS v2 via their REST API. * Provides access to Mezeo PCS via their REST API.
* <p/> * <p/>
* *
* @see <a href= * @see <a href=

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2; package org.jclouds.mezeo.pcs;
import java.net.URI; import java.net.URI;
@ -25,14 +25,14 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.mezeo.pcs2.endpoints.Contacts; import org.jclouds.mezeo.pcs.endpoints.Contacts;
import org.jclouds.mezeo.pcs2.endpoints.Metacontainers; import org.jclouds.mezeo.pcs.endpoints.Metacontainers;
import org.jclouds.mezeo.pcs2.endpoints.Projects; import org.jclouds.mezeo.pcs.endpoints.Projects;
import org.jclouds.mezeo.pcs2.endpoints.Recyclebin; import org.jclouds.mezeo.pcs.endpoints.Recyclebin;
import org.jclouds.mezeo.pcs2.endpoints.RootContainer; import org.jclouds.mezeo.pcs.endpoints.RootContainer;
import org.jclouds.mezeo.pcs2.endpoints.Shares; import org.jclouds.mezeo.pcs.endpoints.Shares;
import org.jclouds.mezeo.pcs2.endpoints.Tags; import org.jclouds.mezeo.pcs.endpoints.Tags;
import org.jclouds.mezeo.pcs2.xml.CloudXlinkHandler; import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
@ -72,6 +72,6 @@ public interface PCSCloudAsyncClient {
@GET @GET
@XMLResponseParser(CloudXlinkHandler.class) @XMLResponseParser(CloudXlinkHandler.class)
@Path("/") @Path("/v{jclouds.api-version}")
ListenableFuture<Response> authenticate(); ListenableFuture<Response> authenticate();
} }

View File

@ -17,12 +17,12 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2; package org.jclouds.mezeo.pcs;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import org.jclouds.mezeo.pcs2.config.PCSRestClientModule; import org.jclouds.mezeo.pcs.config.PCSRestClientModule;
import org.jclouds.rest.RestContextBuilder; import org.jclouds.rest.RestContextBuilder;
import com.google.inject.Module; import com.google.inject.Module;

View File

@ -0,0 +1,45 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.mezeo.pcs;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import java.util.Properties;
import org.jclouds.PropertiesBuilder;
/**
* Builds properties used in PCS Connections
*
* @author Adrian Cole
*/
public class PCSPropertiesBuilder extends PropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_API_VERSION, "2");
return properties;
}
public PCSPropertiesBuilder(Properties properties) {
super(properties);
}
}

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.binders; package org.jclouds.mezeo.pcs.binders;
import javax.inject.Singleton; import javax.inject.Singleton;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.binders; package org.jclouds.mezeo.pcs.binders;
import java.io.File; import java.io.File;
@ -26,7 +26,7 @@ import javax.ws.rs.core.HttpHeaders;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.utils.ModifyRequest; import org.jclouds.http.utils.ModifyRequest;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.jclouds.rest.Binder; import org.jclouds.rest.Binder;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.binders; package org.jclouds.mezeo.pcs.binders;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
@ -27,8 +27,8 @@ import javax.inject.Singleton;
import org.jclouds.blobstore.binders.BindBlobToMultipartForm; import org.jclouds.blobstore.binders.BindBlobToMultipartForm;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.mezeo.pcs2.blobstore.functions.PCSFileToBlob; import org.jclouds.mezeo.pcs.blobstore.functions.PCSFileToBlob;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.jclouds.rest.Binder; import org.jclouds.rest.Binder;
@Singleton @Singleton

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.blobstore.functions; package org.jclouds.mezeo.pcs.blobstore.functions;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.mezeo.pcs2.domain.MutableFileInfo; import org.jclouds.mezeo.pcs.domain.MutableFileInfo;
import org.jclouds.mezeo.pcs2.domain.internal.MutableFileInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.MutableFileInfoImpl;
import com.google.common.base.Function; import com.google.common.base.Function;

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.blobstore.functions; package org.jclouds.mezeo.pcs.blobstore.functions;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import com.google.common.base.Function; import com.google.common.base.Function;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.blobstore.functions; package org.jclouds.mezeo.pcs.blobstore.functions;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -26,7 +26,7 @@ import javax.inject.Singleton;
import org.jclouds.blobstore.domain.MutableBlobMetadata; import org.jclouds.blobstore.domain.MutableBlobMetadata;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl; import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
import org.jclouds.mezeo.pcs2.domain.FileInfo; import org.jclouds.mezeo.pcs.domain.FileInfo;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import com.google.common.base.Function; import com.google.common.base.Function;

View File

@ -17,14 +17,14 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.blobstore.functions; package org.jclouds.mezeo.pcs.blobstore.functions;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.Blob.Factory; import org.jclouds.blobstore.domain.Blob.Factory;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import com.google.common.base.Function; import com.google.common.base.Function;

View File

@ -17,15 +17,15 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.config; package org.jclouds.mezeo.pcs.config;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Provider; import javax.inject.Provider;
import org.jclouds.blobstore.config.BlobStoreObjectModule; import org.jclouds.blobstore.config.BlobStoreObjectModule;
import org.jclouds.mezeo.pcs2.domain.MutableFileInfo; import org.jclouds.mezeo.pcs.domain.MutableFileInfo;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.jclouds.mezeo.pcs2.domain.internal.PCSFileImpl; import org.jclouds.mezeo.pcs.domain.internal.PCSFileImpl;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Provides; import com.google.inject.Provides;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.config; package org.jclouds.mezeo.pcs.config;
import java.net.URI; import java.net.URI;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -31,19 +31,19 @@ import org.jclouds.Constants;
import org.jclouds.http.HttpRetryHandler; import org.jclouds.http.HttpRetryHandler;
import org.jclouds.http.RequiresHttp; import org.jclouds.http.RequiresHttp;
import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.ClientError;
import org.jclouds.mezeo.pcs2.PCSAsyncClient; import org.jclouds.mezeo.pcs.PCSAsyncClient;
import org.jclouds.mezeo.pcs2.PCSClient; import org.jclouds.mezeo.pcs.PCSClient;
import org.jclouds.mezeo.pcs2.PCSCloudAsyncClient; import org.jclouds.mezeo.pcs.PCSCloudAsyncClient;
import org.jclouds.mezeo.pcs2.PCSCloudAsyncClient.Response; import org.jclouds.mezeo.pcs.PCSCloudAsyncClient.Response;
import org.jclouds.mezeo.pcs2.endpoints.Contacts; import org.jclouds.mezeo.pcs.endpoints.Contacts;
import org.jclouds.mezeo.pcs2.endpoints.Metacontainers; import org.jclouds.mezeo.pcs.endpoints.Metacontainers;
import org.jclouds.mezeo.pcs2.endpoints.Projects; import org.jclouds.mezeo.pcs.endpoints.Projects;
import org.jclouds.mezeo.pcs2.endpoints.Recyclebin; import org.jclouds.mezeo.pcs.endpoints.Recyclebin;
import org.jclouds.mezeo.pcs2.endpoints.RootContainer; import org.jclouds.mezeo.pcs.endpoints.RootContainer;
import org.jclouds.mezeo.pcs2.endpoints.Shares; import org.jclouds.mezeo.pcs.endpoints.Shares;
import org.jclouds.mezeo.pcs2.endpoints.Tags; import org.jclouds.mezeo.pcs.endpoints.Tags;
import org.jclouds.mezeo.pcs2.endpoints.WebDAV; import org.jclouds.mezeo.pcs.endpoints.WebDAV;
import org.jclouds.mezeo.pcs2.handlers.PCSClientErrorRetryHandler; import org.jclouds.mezeo.pcs.handlers.PCSClientErrorRetryHandler;
import org.jclouds.rest.AsyncClientFactory; import org.jclouds.rest.AsyncClientFactory;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule; import org.jclouds.rest.config.RestClientModule;
@ -71,8 +71,8 @@ public class PCSRestClientModule extends RestClientModule<PCSClient, PCSAsyncCli
@Provides @Provides
@Singleton @Singleton
protected Response provideCloudResponse(AsyncClientFactory factory) throws InterruptedException, protected Response provideCloudResponse(AsyncClientFactory factory) throws InterruptedException, ExecutionException,
ExecutionException, TimeoutException { TimeoutException {
return factory.create(PCSCloudAsyncClient.class).authenticate().get(10, TimeUnit.SECONDS); return factory.create(PCSCloudAsyncClient.class).authenticate().get(10, TimeUnit.SECONDS);
} }
@ -80,7 +80,7 @@ public class PCSRestClientModule extends RestClientModule<PCSClient, PCSAsyncCli
@Singleton @Singleton
@WebDAV @WebDAV
protected URI provideWebDAVURI(@Named(Constants.PROPERTY_ENDPOINT) String endpoint) { protected URI provideWebDAVURI(@Named(Constants.PROPERTY_ENDPOINT) String endpoint) {
return URI.create(endpoint.replaceAll("v2", "dav")); return URI.create(endpoint + "/dav");
} }
@Provides @Provides
@ -134,8 +134,7 @@ public class PCSRestClientModule extends RestClientModule<PCSClient, PCSAsyncCli
@Override @Override
protected void bindRetryHandlers() { protected void bindRetryHandlers() {
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to( bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(PCSClientErrorRetryHandler.class);
PCSClientErrorRetryHandler.class);
} }
} }

View File

@ -17,11 +17,11 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain; package org.jclouds.mezeo.pcs.domain;
import java.net.URI; import java.net.URI;
import org.jclouds.mezeo.pcs2.domain.internal.ContainerInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.ContainerInfoImpl;
import com.google.inject.ImplementedBy; import com.google.inject.ImplementedBy;

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain; package org.jclouds.mezeo.pcs.domain;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import java.util.SortedSet; import java.util.SortedSet;
import org.jclouds.mezeo.pcs2.domain.internal.ContainerListImpl; import org.jclouds.mezeo.pcs.domain.internal.ContainerListImpl;
import com.google.inject.ImplementedBy; import com.google.inject.ImplementedBy;

View File

@ -17,11 +17,11 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain; package org.jclouds.mezeo.pcs.domain;
import java.net.URI; import java.net.URI;
import org.jclouds.mezeo.pcs2.domain.internal.FileInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.FileInfoImpl;
import com.google.inject.ImplementedBy; import com.google.inject.ImplementedBy;

View File

@ -17,12 +17,12 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain; package org.jclouds.mezeo.pcs.domain;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import org.jclouds.mezeo.pcs2.domain.internal.FileInfoWithMetadataImpl; import org.jclouds.mezeo.pcs.domain.internal.FileInfoWithMetadataImpl;
import com.google.inject.ImplementedBy; import com.google.inject.ImplementedBy;

View File

@ -17,11 +17,11 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain; package org.jclouds.mezeo.pcs.domain;
import java.net.URI; import java.net.URI;
import org.jclouds.mezeo.pcs2.domain.internal.MutableFileInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.MutableFileInfoImpl;
import com.google.inject.ImplementedBy; import com.google.inject.ImplementedBy;

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain; package org.jclouds.mezeo.pcs.domain;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.mezeo.pcs2.domain.internal.MutableResourceInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.MutableResourceInfoImpl;
import com.google.inject.ImplementedBy; import com.google.inject.ImplementedBy;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain; package org.jclouds.mezeo.pcs.domain;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain; package org.jclouds.mezeo.pcs.domain;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.mezeo.pcs2.domain.internal.ResourceInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.ResourceInfoImpl;
import com.google.inject.ImplementedBy; import com.google.inject.ImplementedBy;

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain.internal; package org.jclouds.mezeo.pcs.domain.internal;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.mezeo.pcs2.domain.ContainerInfo; import org.jclouds.mezeo.pcs.domain.ContainerInfo;
/** /**
* *

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain.internal; package org.jclouds.mezeo.pcs.domain.internal;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
@ -26,8 +26,8 @@ import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.mezeo.pcs2.domain.ContainerList; import org.jclouds.mezeo.pcs.domain.ContainerList;
import org.jclouds.mezeo.pcs2.domain.ResourceInfo; import org.jclouds.mezeo.pcs.domain.ResourceInfo;
/** /**
* *

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain.internal; package org.jclouds.mezeo.pcs.domain.internal;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.mezeo.pcs2.domain.FileInfo; import org.jclouds.mezeo.pcs.domain.FileInfo;
/** /**
* *

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain.internal; package org.jclouds.mezeo.pcs.domain.internal;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import org.jclouds.mezeo.pcs2.domain.FileInfoWithMetadata; import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
/** /**
* *

View File

@ -17,14 +17,14 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain.internal; package org.jclouds.mezeo.pcs.domain.internal;
import java.net.URI; import java.net.URI;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.mezeo.pcs2.domain.MutableFileInfo; import org.jclouds.mezeo.pcs.domain.MutableFileInfo;
/** /**
* *

View File

@ -17,14 +17,14 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain.internal; package org.jclouds.mezeo.pcs.domain.internal;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.mezeo.pcs2.domain.MutableResourceInfo; import org.jclouds.mezeo.pcs.domain.MutableResourceInfo;
import org.jclouds.mezeo.pcs2.domain.ResourceInfo; import org.jclouds.mezeo.pcs.domain.ResourceInfo;
/** /**
* *

View File

@ -17,15 +17,15 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain.internal; package org.jclouds.mezeo.pcs.domain.internal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import javax.inject.Inject; import javax.inject.Inject;
import org.jclouds.http.internal.PayloadEnclosingImpl; import org.jclouds.http.internal.PayloadEnclosingImpl;
import org.jclouds.mezeo.pcs2.domain.MutableFileInfo; import org.jclouds.mezeo.pcs.domain.MutableFileInfo;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.domain.internal; package org.jclouds.mezeo.pcs.domain.internal;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.mezeo.pcs2.domain.ResourceInfo; import org.jclouds.mezeo.pcs.domain.ResourceInfo;
/** /**
* *

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.endpoints; package org.jclouds.mezeo.pcs.endpoints;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.endpoints; package org.jclouds.mezeo.pcs.endpoints;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.endpoints; package org.jclouds.mezeo.pcs.endpoints;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.endpoints; package org.jclouds.mezeo.pcs.endpoints;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.endpoints; package org.jclouds.mezeo.pcs.endpoints;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.endpoints; package org.jclouds.mezeo.pcs.endpoints;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.endpoints; package org.jclouds.mezeo.pcs.endpoints;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.endpoints; package org.jclouds.mezeo.pcs.endpoints;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.functions; package org.jclouds.mezeo.pcs.functions;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.functions; package org.jclouds.mezeo.pcs.functions;
import static org.jclouds.util.Throwables2.propagateOrNull; import static org.jclouds.util.Throwables2.propagateOrNull;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.functions; package org.jclouds.mezeo.pcs.functions;
import static org.jclouds.util.Throwables2.propagateOrNull; import static org.jclouds.util.Throwables2.propagateOrNull;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.handlers; package org.jclouds.mezeo.pcs.handlers;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.inject.Inject; import javax.inject.Inject;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.options; package org.jclouds.mezeo.pcs.options;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;

View File

@ -17,13 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.xml; package org.jclouds.mezeo.pcs.xml;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.mezeo.pcs2.PCSCloudAsyncClient; import org.jclouds.mezeo.pcs.PCSCloudAsyncClient;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.xml; package org.jclouds.mezeo.pcs.xml;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
@ -31,11 +31,11 @@ import javax.inject.Inject;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.mezeo.pcs2.domain.ContainerList; import org.jclouds.mezeo.pcs.domain.ContainerList;
import org.jclouds.mezeo.pcs2.domain.ResourceInfo; import org.jclouds.mezeo.pcs.domain.ResourceInfo;
import org.jclouds.mezeo.pcs2.domain.internal.ContainerInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.ContainerInfoImpl;
import org.jclouds.mezeo.pcs2.domain.internal.ContainerListImpl; import org.jclouds.mezeo.pcs.domain.internal.ContainerListImpl;
import org.jclouds.mezeo.pcs2.domain.internal.FileInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.FileInfoImpl;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.xml; package org.jclouds.mezeo.pcs.xml;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
@ -28,8 +28,8 @@ import javax.inject.Inject;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.mezeo.pcs2.domain.FileInfoWithMetadata; import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
import org.jclouds.mezeo.pcs2.domain.internal.FileInfoWithMetadataImpl; import org.jclouds.mezeo.pcs.domain.internal.FileInfoWithMetadataImpl;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2; package org.jclouds.mezeo.pcs;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -37,14 +37,16 @@ import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x; import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnInputStream; import org.jclouds.http.functions.ReturnInputStream;
import org.jclouds.mezeo.pcs2.PCSCloudAsyncClient.Response; import org.jclouds.mezeo.pcs.PCSAsyncClient;
import org.jclouds.mezeo.pcs2.blobstore.functions.BlobToPCSFile; import org.jclouds.mezeo.pcs.PCSClient;
import org.jclouds.mezeo.pcs2.config.PCSRestClientModule; import org.jclouds.mezeo.pcs.PCSCloudAsyncClient.Response;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.blobstore.functions.BlobToPCSFile;
import org.jclouds.mezeo.pcs2.functions.AddMetadataItemIntoMap; import org.jclouds.mezeo.pcs.config.PCSRestClientModule;
import org.jclouds.mezeo.pcs2.options.PutBlockOptions; import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.jclouds.mezeo.pcs2.xml.ContainerHandler; import org.jclouds.mezeo.pcs.functions.AddMetadataItemIntoMap;
import org.jclouds.mezeo.pcs2.xml.FileHandler; import org.jclouds.mezeo.pcs.options.PutBlockOptions;
import org.jclouds.mezeo.pcs.xml.ContainerHandler;
import org.jclouds.mezeo.pcs.xml.FileHandler;
import org.jclouds.rest.AsyncClientFactory; import org.jclouds.rest.AsyncClientFactory;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.RestClientTest; import org.jclouds.rest.RestClientTest;
@ -291,7 +293,6 @@ public class PCSAsyncClientTest extends RestClientTest<PCSAsyncClient> {
@Override @Override
public RestContextSpec<PCSClient, PCSAsyncClient> createContextSpec() { public RestContextSpec<PCSClient, PCSAsyncClient> createContextSpec() {
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty("pcs.apiversion", "foo");
properties.setProperty("pcs.endpoint", "http://goo"); properties.setProperty("pcs.endpoint", "http://goo");
return new RestContextFactory().createContextSpec("pcs", "identity", "credential", properties); return new RestContextFactory().createContextSpec("pcs", "identity", "credential", properties);
} }

View File

@ -17,10 +17,10 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2; package org.jclouds.mezeo.pcs;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.mezeo.pcs2.options.PutBlockOptions.Builder.range; import static org.jclouds.mezeo.pcs.options.PutBlockOptions.Builder.range;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -36,15 +36,18 @@ import java.util.concurrent.TimeoutException;
import javax.inject.Provider; import javax.inject.Provider;
import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilder;
import org.jclouds.Constants;
import org.jclouds.blobstore.KeyNotFoundException; import org.jclouds.blobstore.KeyNotFoundException;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest; import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.http.HttpResponseException; import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.mezeo.pcs2.domain.ContainerList; import org.jclouds.mezeo.pcs.PCSAsyncClient;
import org.jclouds.mezeo.pcs2.domain.FileInfoWithMetadata; import org.jclouds.mezeo.pcs.PCSClient;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.ContainerList;
import org.jclouds.mezeo.pcs2.domain.ResourceInfo; import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.jclouds.mezeo.pcs.domain.ResourceInfo;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextFactory;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
@ -64,9 +67,6 @@ import com.sun.jersey.api.uri.UriBuilderImpl;
@Test(groups = "live", testName = "pcs2.PCSClientLiveTest") @Test(groups = "live", testName = "pcs2.PCSClientLiveTest")
public class PCSClientLiveTest { public class PCSClientLiveTest {
private PCSClient connection;
private String identity;
Provider<UriBuilder> uriBuilderProvider = new Provider<UriBuilder>() { Provider<UriBuilder> uriBuilderProvider = new Provider<UriBuilder>() {
@Override @Override
@ -77,24 +77,47 @@ public class PCSClientLiveTest {
}; };
private RestContext<PCSClient, PCSAsyncClient> context; private RestContext<PCSClient, PCSAsyncClient> context;
private PCSClient connection;
protected String provider = "pcs";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("test." + provider + ".apiversion");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException { public void setupClient() {
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
String endpoint = checkNotNull(System.getProperty("jclouds.test.endpoint"),
"jclouds.test.endpoint");
Properties props = new Properties(); context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
props.setProperty("pcs.endpoint", endpoint); overrides);
context = new RestContextFactory().createContext("pcs", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()), props);
connection = context.getApi(); connection = context.getApi();
ContainerList response = connection.list(); ContainerList response = connection.list();
for (ResourceInfo resource : response) { for (ResourceInfo resource : response) {
if (resource.getType() == StorageType.FOLDER if (resource.getType() == StorageType.FOLDER && resource.getName().startsWith(containerPrefix)) {
&& resource.getName().startsWith(containerPrefix)) {
System.err.printf("*** deleting container %s...%n", resource.getName()); System.err.printf("*** deleting container %s...%n", resource.getName());
connection.deleteContainer(resource.getUrl()); connection.deleteContainer(resource.getUrl());
} }
@ -122,9 +145,8 @@ public class PCSClientLiveTest {
response = connection.list(containerURI); response = connection.list(containerURI);
validateContainerList(response, rootUrl, container); validateContainerList(response, rootUrl, container);
assertEquals(response.getMetadataItems().get("name"), URI.create(containerURI assertEquals(response.getMetadataItems().get("name"),
.toASCIIString() URI.create(containerURI.toASCIIString() + "/metadata/name"));
+ "/metadata/name"));
validateMetadataItemNameEquals(containerURI, container); validateMetadataItemNameEquals(containerURI, container);
@ -132,8 +154,8 @@ public class PCSClientLiveTest {
} }
} }
private void validateMetadataItemNameEquals(URI resource, String name) private void validateMetadataItemNameEquals(URI resource, String name) throws InterruptedException,
throws InterruptedException, ExecutionException, TimeoutException { ExecutionException, TimeoutException {
Map<String, String> metadata = Maps.newHashMap(); Map<String, String> metadata = Maps.newHashMap();
connection.addMetadataItemToMap(resource, "name", metadata); connection.addMetadataItemToMap(resource, "name", metadata);
assertEquals(metadata.get("name"), name); assertEquals(metadata.get("name"), name);
@ -144,8 +166,7 @@ public class PCSClientLiveTest {
validateResource(response, parent, name); validateResource(response, parent, name);
} }
private void validateFileInfo(FileInfoWithMetadata response, URI parent, String name, Long size, private void validateFileInfo(FileInfoWithMetadata response, URI parent, String name, Long size, String mimeType) {
String mimeType) {
assertNotNull(response.getMetadataItems()); assertNotNull(response.getMetadataItems());
assertFalse(response.isPublic()); assertFalse(response.isPublic());
assertEquals(response.getBytes(), size); assertEquals(response.getBytes(), size);
@ -241,17 +262,15 @@ public class PCSClientLiveTest {
connection.deleteContainer(container); connection.deleteContainer(container);
} }
private FileInfoWithMetadata validateFileInfoAndNameIsInMetadata(URI container, URI objectURI, private FileInfoWithMetadata validateFileInfoAndNameIsInMetadata(URI container, URI objectURI, String name, Long size)
String name, Long size) throws InterruptedException, ExecutionException, throws InterruptedException, ExecutionException, TimeoutException {
TimeoutException {
FileInfoWithMetadata response; FileInfoWithMetadata response;
connection.putMetadataItem(objectURI, "name", name); connection.putMetadataItem(objectURI, "name", name);
response = connection.getFileInfo(objectURI); response = connection.getFileInfo(objectURI);
validateFileInfo(response, container, name, size, "text/plain"); validateFileInfo(response, container, name, size, "text/plain");
assertEquals(response.getMetadataItems().get("name"), URI.create(objectURI.toASCIIString() assertEquals(response.getMetadataItems().get("name"), URI.create(objectURI.toASCIIString() + "/metadata/name"));
+ "/metadata/name"));
validateMetadataItemNameEquals(objectURI, name); validateMetadataItemNameEquals(objectURI, name);
return response; return response;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2; package org.jclouds.mezeo.pcs;
import static org.jclouds.rest.RestContextFactory.contextSpec; import static org.jclouds.rest.RestContextFactory.contextSpec;
@ -28,8 +28,9 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.mezeo.pcs2.PCSCloudAsyncClient.Response; import org.jclouds.mezeo.pcs.PCSCloudAsyncClient;
import org.jclouds.mezeo.pcs2.xml.CloudXlinkHandler; import org.jclouds.mezeo.pcs.PCSCloudAsyncClient.Response;
import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler;
import org.jclouds.rest.RestClientTest; import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.RestContextSpec; import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
@ -38,18 +39,18 @@ import org.testng.annotations.Test;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
/** /**
* Tests behavior of {@code PCSClient} * Tests behavior of {@code PCSCloudAsyncClient}
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "unit", testName = "pcs2.PCSCloudTest") @Test(groups = "unit", testName = "pcs2.PCSCloudTest")
public class PCSCloudTest extends RestClientTest<PCSCloudAsyncClient> { public class PCSCloudAsyncClientTest extends RestClientTest<PCSCloudAsyncClient> {
public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException { public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException {
Method method = PCSCloudAsyncClient.class.getMethod("authenticate"); Method method = PCSCloudAsyncClient.class.getMethod("authenticate");
HttpRequest request = processor.createRequest(method); HttpRequest request = processor.createRequest(method);
assertRequestLineEquals(request, "GET http://localhost:8080/ HTTP/1.1"); assertRequestLineEquals(request, "GET http://localhost:8080/v3 HTTP/1.1");
assertNonPayloadHeadersEqual(request, ""); assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
@ -68,8 +69,8 @@ public class PCSCloudTest extends RestClientTest<PCSCloudAsyncClient> {
@Override @Override
public RestContextSpec<PCSCloudClient, PCSCloudAsyncClient> createContextSpec() { public RestContextSpec<PCSCloudClient, PCSCloudAsyncClient> createContextSpec() {
return contextSpec("test", "http://localhost:8080", "1", "identity", "credential", return contextSpec("test", "http://localhost:8080", "3", "", "identity", "credential", PCSCloudClient.class,
PCSCloudClient.class, PCSCloudAsyncClient.class); PCSCloudAsyncClient.class);
} }
@Override @Override

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2; package org.jclouds.mezeo.pcs;
import org.jclouds.blobstore.util.BlobStoreUtils; import org.jclouds.blobstore.util.BlobStoreUtils;
import org.jclouds.rest.Providers; import org.jclouds.rest.Providers;

View File

@ -17,13 +17,14 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.binders; package org.jclouds.mezeo.pcs.binders;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.net.URI; import java.net.URI;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.mezeo.pcs.binders.BindContainerNameToXmlPayload;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.binders; package org.jclouds.mezeo.pcs.binders;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -26,8 +26,9 @@ import java.net.URI;
import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.HttpHeaders;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.mezeo.pcs2.config.PCSObjectModule; import org.jclouds.mezeo.pcs.binders.BindFileInfoToXmlPayload;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.config.PCSObjectModule;
import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.inject.Guice; import com.google.inject.Guice;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.functions; package org.jclouds.mezeo.pcs.functions;
import org.testng.annotations.Test; import org.testng.annotations.Test;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.functions; package org.jclouds.mezeo.pcs.functions;
/** /**

View File

@ -17,17 +17,17 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.internal; package org.jclouds.mezeo.pcs.internal;
import java.io.InputStream; import java.io.InputStream;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import org.jclouds.mezeo.pcs2.PCSAsyncClient; import org.jclouds.mezeo.pcs.PCSAsyncClient;
import org.jclouds.mezeo.pcs2.domain.ContainerList; import org.jclouds.mezeo.pcs.domain.ContainerList;
import org.jclouds.mezeo.pcs2.domain.FileInfoWithMetadata; import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
import org.jclouds.mezeo.pcs2.domain.PCSFile; import org.jclouds.mezeo.pcs.domain.PCSFile;
import org.jclouds.mezeo.pcs2.options.PutBlockOptions; import org.jclouds.mezeo.pcs.options.PutBlockOptions;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;

View File

@ -17,12 +17,13 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.options; package org.jclouds.mezeo.pcs.options;
import static org.jclouds.mezeo.pcs2.options.PutBlockOptions.Builder.range; import static org.jclouds.mezeo.pcs.options.PutBlockOptions.Builder.range;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;
import org.jclouds.mezeo.pcs.options.PutBlockOptions;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.xml; package org.jclouds.mezeo.pcs.xml;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -26,8 +26,9 @@ import java.net.URI;
import java.util.Map; import java.util.Map;
import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.mezeo.pcs2.PCSCloudAsyncClient; import org.jclouds.mezeo.pcs.PCSCloudAsyncClient;
import org.jclouds.mezeo.pcs2.xml.CloudXlinkHandler.PCSCloudResponseImpl; import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler;
import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler.PCSCloudResponseImpl;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.xml; package org.jclouds.mezeo.pcs.xml;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -26,11 +26,12 @@ import java.net.URI;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.mezeo.pcs2.domain.ContainerList; import org.jclouds.mezeo.pcs.domain.ContainerList;
import org.jclouds.mezeo.pcs2.domain.ResourceInfo; import org.jclouds.mezeo.pcs.domain.ResourceInfo;
import org.jclouds.mezeo.pcs2.domain.internal.ContainerInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.ContainerInfoImpl;
import org.jclouds.mezeo.pcs2.domain.internal.ContainerListImpl; import org.jclouds.mezeo.pcs.domain.internal.ContainerListImpl;
import org.jclouds.mezeo.pcs2.domain.internal.FileInfoImpl; import org.jclouds.mezeo.pcs.domain.internal.FileInfoImpl;
import org.jclouds.mezeo.pcs.xml.ContainerHandler;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.mezeo.pcs2.xml; package org.jclouds.mezeo.pcs.xml;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -26,8 +26,9 @@ import java.net.URI;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.mezeo.pcs2.domain.FileInfoWithMetadata; import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
import org.jclouds.mezeo.pcs2.domain.internal.FileInfoWithMetadataImpl; import org.jclouds.mezeo.pcs.domain.internal.FileInfoWithMetadataImpl;
import org.jclouds.mezeo.pcs.xml.FileHandler;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;