jclouds-es: integration test with S3 provider Using docker and https://s3.scality.com/
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/f54ad6d8 Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/f54ad6d8 Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/f54ad6d8 Branch: refs/heads/develop Commit: f54ad6d8e1323f0d148123a1a33309ffc2c8e5d3 Parents: 5a2782c Author: Paul Merlin <[email protected]> Authored: Sun Feb 26 12:33:54 2017 +0100 Committer: Paul Merlin <[email protected]> Committed: Sun Feb 26 13:08:54 2017 +0100 ---------------------------------------------------------------------- dependencies.gradle | 19 ++++--- extensions/entitystore-jclouds/build.gradle | 2 +- .../entitystore/jclouds/JCloudsS3Test.java | 53 ++++++++++++++++++++ .../src/main/docker/s3server/Dockerfile | 20 ++++++++ 4 files changed, 86 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f54ad6d8/dependencies.gradle ---------------------------------------------------------------------- diff --git a/dependencies.gradle b/dependencies.gradle index 932bf85..adb7bb6 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -78,8 +78,7 @@ def velocityVersion = '1.7' dependencies.libraries << [ bonecp : "com.jolbox:bonecp:$bonecpVersion", bouncy_castle : "org.bouncycastle:bcprov-jdk15on:$bouncyVersion", - cassandra_client : [ "com.datastax.cassandra:cassandra-driver-core:$cassandraClientVersion", - ], + cassandra_client : "com.datastax.cassandra:cassandra-driver-core:$cassandraClientVersion", codahale_metrics : [ "io.dropwizard.metrics:metrics-core:$codahaleMetricsVersion", "io.dropwizard.metrics:metrics-healthchecks:$codahaleMetricsVersion" ], commons_dbcp : "org.apache.commons:commons-dbcp2:$commonsDbcpVersion", @@ -177,6 +176,7 @@ def easyMockVersion = '3.4' def embedMongoVersion = '1.50.5' def h2Version = '1.4.193' def hamcrestVersion = '1.3' +def jaxRsApiVersion = '2.0.1' def junitVersion = '4.12' def logbackVersion = '1.1.7' def mockitoVersion = '2.2.9' @@ -229,6 +229,11 @@ dependencies.dependencySubstitutionSpec = { DependencySubstitution substitution, { substitution.useTarget group: dep.group, name: dep.module, version: jacksonVersion } + // Always resolve JAX-RS API to the same version + else if( [ 'jaxrs-api', 'jsr311-api', 'javax.ws.rs-api' ].contains( dep.module ) ) + { + substitution.useTarget group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: jaxRsApiVersion + } // woodstox:wstx-asl is broken (no pom), use org.codehaus.woodstox:wstx-asl instead else if( dep.group == 'woodstox' && dep.module == 'wstx-asl' ) { @@ -255,10 +260,10 @@ dependencies.buildToolsVersions << [ // Docker Images dependencies.dockerImagesVersions << [ cassandra: 'cassandra:3.10', - fakeS3: 'lphoward/fake-s3:14.04', memcached: 'memcached:1.4-alpine', - mariadb: 'mariadb:10.1', - postgres: 'postgres:9.6-alpine', - redis: 'redis:3.2-alpine', - riak: 'basho/riak-kv:ubuntu-2.2.0' + mariadb : 'mariadb:10.1', + postgres : 'postgres:9.6-alpine', + redis : 'redis:3.2-alpine', + riak : 'basho/riak-kv:ubuntu-2.2.0', + s3server : 'scality/s3server:mem-e2a2574' ] http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f54ad6d8/extensions/entitystore-jclouds/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jclouds/build.gradle b/extensions/entitystore-jclouds/build.gradle index f0ccb8e..01a732e 100644 --- a/extensions/entitystore-jclouds/build.gradle +++ b/extensions/entitystore-jclouds/build.gradle @@ -36,7 +36,7 @@ dependencies { runtimeOnly polygene.core.runtime runtimeOnly libraries.jaxb_api - testImplementation polygene.core.testsupport + testImplementation polygene.internals.testsupport testImplementation polygene.extension( 'valueserialization-orgjson' ) testImplementation libraries.jclouds_filesystem http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f54ad6d8/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java new file mode 100644 index 0000000..f375b02 --- /dev/null +++ b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.entitystore.jclouds; + +import org.apache.polygene.api.common.Visibility; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.entitystore.jclouds.assembly.JCloudsEntityStoreAssembler; +import org.apache.polygene.test.EntityTestAssembler; +import org.apache.polygene.test.entity.AbstractEntityStoreTest; +import org.apache.polygene.test.internal.DockerRule; +import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; +import org.junit.ClassRule; + +public class JCloudsS3Test extends AbstractEntityStoreTest +{ + @ClassRule + public static final DockerRule DOCKER = new DockerRule( "s3server", 8000 ); + + @Override + public void assemble( ModuleAssembly module ) + { + super.assemble( module ); + ModuleAssembly config = module.layer().module( "config" ); + new EntityTestAssembler().assemble( config ); + new OrgJsonValueSerializationAssembler().assemble( module ); + new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); + JCloudsMapEntityStoreConfiguration defaults = config.forMixin( JCloudsMapEntityStoreConfiguration.class ) + .declareDefaults(); + String host = DOCKER.getDockerHost(); + int port = DOCKER.getExposedContainerPort( "8000/tcp" ); + defaults.provider().set( "s3" ); + defaults.endpoint().set( "http://" + host + ':' + port ); + defaults.identifier().set( "dummyIdentifier" ); + defaults.credential().set( "dummyCredential" ); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f54ad6d8/internals/testsupport-internal/src/main/docker/s3server/Dockerfile ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/s3server/Dockerfile b/internals/testsupport-internal/src/main/docker/s3server/Dockerfile new file mode 100644 index 0000000..552569f --- /dev/null +++ b/internals/testsupport-internal/src/main/docker/s3server/Dockerfile @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM @s3server@ + +# See https://github.com/scality/S3/blob/master/DOCKER.md +ENV ACCESS_KEY dummyIdentifier +ENV SECRET_KEY dummyCredential
