This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.nosql.couchbase-resourceprovider-1.0.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-nosql-couchbase-resourceprovider.git
commit f50ee137049bc898d8e093190241fb2318637c0a Author: Stefan Seifert <sseif...@apache.org> AuthorDate: Wed May 20 23:28:04 2015 +0000 SLING-4381 add special handling for root resource git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider@1680700 13f79535-47bb-0310-9956-ffa450edef68 --- .../CouchbaseNoSqlResourceProviderIT.java | 24 +++++------ ...a => CouchbaseNoSqlResourceProviderRootIT.java} | 49 +++++----------------- ...chbaseNoSqlResourceProviderTransactionalIT.java | 24 +++++------ 3 files changed, 32 insertions(+), 65 deletions(-) diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java index cacf7f8..9fb8186 100644 --- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java +++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java @@ -40,15 +40,15 @@ public class CouchbaseNoSqlResourceProviderIT extends AbstractNoSqlResourceProvi @Override protected void registerResourceProviderFactory() { - context.registerInjectActivateService( - new CouchbaseClientImpl(), - ImmutableMap.<String, Object> builder() + context.registerInjectActivateService(new CouchbaseClientImpl(), ImmutableMap.<String, Object>builder() .put(CouchbaseClient.CLIENT_ID_PROPERTY, CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID) .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091")) - .put("bucketName", System.getProperty("bucketName", "resource-test")).build()); + .put("bucketName", System.getProperty("bucketName", "resource-test")) + .build()); - context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap - .<String, Object> builder().put(ResourceProvider.ROOTS, "/test").build()); + context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap.<String, Object>builder() + .put(ResourceProvider.ROOTS, "/test") + .build()); } @Override @@ -58,15 +58,13 @@ public class CouchbaseNoSqlResourceProviderIT extends AbstractNoSqlResourceProvi Resource root = context.resourceResolver().getResource("/"); Resource providerRoot = root.getChild("test"); if (providerRoot == null) { - providerRoot = context.resourceResolver().create( - root, - "test", - ImmutableMap - .<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); + providerRoot = context.resourceResolver().create(root, "test", + ImmutableMap.<String, Object>of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); } this.testRoot = context.resourceResolver().create(providerRoot, UUID.randomUUID().toString(), - ImmutableMap.<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); - } catch (PersistenceException ex) { + ImmutableMap.<String, Object>of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); + } + catch (PersistenceException ex) { throw new RuntimeException(ex); } } diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderRootIT.java similarity index 50% copy from src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java copy to src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderRootIT.java index cacf7f8..11e325a 100644 --- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java +++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderRootIT.java @@ -18,59 +18,30 @@ */ package org.apache.sling.nosql.couchbase.resourceprovider.integration; -import java.util.UUID; - -import org.apache.jackrabbit.JcrConstants; -import org.apache.sling.api.resource.PersistenceException; -import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceProvider; import org.apache.sling.nosql.couchbase.client.CouchbaseClient; import org.apache.sling.nosql.couchbase.client.impl.CouchbaseClientImpl; import org.apache.sling.nosql.couchbase.resourceprovider.impl.CouchbaseNoSqlResourceProviderFactory; -import org.apache.sling.nosql.generic.resource.impl.AbstractNoSqlResourceProviderTest; +import org.apache.sling.nosql.generic.resource.impl.AbstractNoSqlResourceProviderRootTest; import com.google.common.collect.ImmutableMap; /** * Test basic ResourceResolver and ValueMap with different data types. */ -public class CouchbaseNoSqlResourceProviderIT extends AbstractNoSqlResourceProviderTest { - - private Resource testRoot; - +public class CouchbaseNoSqlResourceProviderRootIT extends AbstractNoSqlResourceProviderRootTest { + @Override - protected void registerResourceProviderFactory() { - context.registerInjectActivateService( - new CouchbaseClientImpl(), - ImmutableMap.<String, Object> builder() + protected void registerResourceProviderFactoryAsRoot() { + context.registerInjectActivateService(new CouchbaseClientImpl(), ImmutableMap.<String, Object>builder() .put(CouchbaseClient.CLIENT_ID_PROPERTY, CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID) .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091")) - .put("bucketName", System.getProperty("bucketName", "resource-test")).build()); + .put("bucketName", System.getProperty("bucketName", "resource-test")) + .build()); - context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap - .<String, Object> builder().put(ResourceProvider.ROOTS, "/test").build()); - } - - @Override - protected Resource testRoot() { - if (this.testRoot == null) { - try { - Resource root = context.resourceResolver().getResource("/"); - Resource providerRoot = root.getChild("test"); - if (providerRoot == null) { - providerRoot = context.resourceResolver().create( - root, - "test", - ImmutableMap - .<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); - } - this.testRoot = context.resourceResolver().create(providerRoot, UUID.randomUUID().toString(), - ImmutableMap.<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); - } catch (PersistenceException ex) { - throw new RuntimeException(ex); - } - } - return this.testRoot; + context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap.<String, Object>builder() + .put(ResourceProvider.ROOTS, "/") + .build()); } } diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java index 76f87a5..9fc1a0b 100644 --- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java +++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java @@ -40,15 +40,15 @@ public class CouchbaseNoSqlResourceProviderTransactionalIT extends AbstractNoSql @Override protected void registerResourceProviderFactory() { - context.registerInjectActivateService( - new CouchbaseClientImpl(), - ImmutableMap.<String, Object> builder() + context.registerInjectActivateService(new CouchbaseClientImpl(),ImmutableMap.<String, Object>builder() .put(CouchbaseClient.CLIENT_ID_PROPERTY, CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID) .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091")) - .put("bucketName", System.getProperty("bucketName", "resource-test")).build()); + .put("bucketName", System.getProperty("bucketName", "resource-test")) + .build()); - context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap - .<String, Object> builder().put(ResourceProvider.ROOTS, "/test").build()); + context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap.<String, Object>builder() + .put(ResourceProvider.ROOTS, "/test") + .build()); } @Override @@ -58,15 +58,13 @@ public class CouchbaseNoSqlResourceProviderTransactionalIT extends AbstractNoSql Resource root = context.resourceResolver().getResource("/"); Resource providerRoot = root.getChild("test"); if (providerRoot == null) { - providerRoot = context.resourceResolver().create( - root, - "test", - ImmutableMap - .<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); + providerRoot = context.resourceResolver().create(root,"test", + ImmutableMap.<String, Object>of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); } this.testRoot = context.resourceResolver().create(providerRoot, UUID.randomUUID().toString(), - ImmutableMap.<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); - } catch (PersistenceException ex) { + ImmutableMap.<String, Object>of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED)); + } + catch (PersistenceException ex) { throw new RuntimeException(ex); } } -- To stop receiving notification emails like this one, please contact "commits@sling.apache.org" <commits@sling.apache.org>.