sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1615932 - in /sling/trunk/contrib/extensions/replication: core/src/main/java/org/apache/sling/replication/serialization/impl/vlt/ it/ it/src/test/java/org/apache/sling/replication/it/
Date Tue, 05 Aug 2014 13:52:36 GMT
Author: tommaso
Date: Tue Aug  5 13:52:36 2014
New Revision: 1615932

URL: http://svn.apache.org/r1615932
Log:
SLING-3820 - minor fixes, temporarily removing jcr package creation from vlt package builder
until it's fully working

Modified:
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/vlt/FileVaultReplicationPackageBuilder.java
    sling/trunk/contrib/extensions/replication/it/   (props changed)
    sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ForwardReplicationTest.java
    sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationUtils.java

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/vlt/FileVaultReplicationPackageBuilder.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/vlt/FileVaultReplicationPackageBuilder.java?rev=1615932&r1=1615931&r2=1615932&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/vlt/FileVaultReplicationPackageBuilder.java
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/vlt/FileVaultReplicationPackageBuilder.java
Tue Aug  5 13:52:36 2014
@@ -18,18 +18,14 @@
  */
 package org.apache.sling.replication.serialization.impl.vlt;
 
-import java.io.File;
-import java.io.InputStream;
-import java.util.Properties;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Modified;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
+import java.io.File;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.felix.scr.annotations.*;
 import org.apache.jackrabbit.vault.fs.api.PathFilterSet;
 import org.apache.jackrabbit.vault.fs.config.DefaultMetaInf;
 import org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter;
@@ -171,12 +167,8 @@ public class FileVaultReplicationPackage
                 VaultPackage pkg = packaging.getPackageManager().open(file);
                 replicationPackage = new FileVaultReplicationPackage(pkg);
             }
-            else {
-                VaultPackage pkg = packaging.getPackageManager(getSession()).open(PackageId.fromString(id)).getPackage();
-                replicationPackage = new FileVaultReplicationPackage(pkg);
-            }
         } catch (Exception e) {
-            log.info("could not find a package with id : {}", id);
+            log.warn("could not find a package with id : {}", id);
         }
         return replicationPackage;
     }
@@ -190,21 +182,25 @@ public class FileVaultReplicationPackage
 
 
     @Override
-    public boolean installPackageInternal(ReplicationPackage replicationPackage) throws ReplicationPackageReadingException{
-        log.debug("reading a stream");
+    public boolean installPackageInternal(ReplicationPackage replicationPackage) throws ReplicationPackageReadingException
{
+        if (log.isDebugEnabled()) {
+            log.debug("reading a replication package stream");
+        }
 
         Session session = null;
         try {
             session = getSession();
             if (session != null) {
-                final JcrPackage jcrPackage =  packaging.getPackageManager(getSession())
+                final JcrPackage jcrPackage = packaging.getPackageManager(getSession())
                         .open(PackageId.fromString(replicationPackage.getId()));
 
                 jcrPackage.install(new ImportOptions());
 
             }
         } catch (Exception e) {
-            log.error("could not read / install the package", e);
+            if (log.isErrorEnabled()) {
+                log.error("could not read / install the package", e);
+            }
             throw new ReplicationPackageReadingException(e);
         } finally {
             if (session != null) {

Propchange: sling/trunk/contrib/extensions/replication/it/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Aug  5 13:52:36 2014
@@ -1,4 +1,4 @@
-org.apache.sling.replication.it.iml
 derby.log
-
+*.iml
 sling
+target

Modified: sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ForwardReplicationTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ForwardReplicationTest.java?rev=1615932&r1=1615931&r2=1615932&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ForwardReplicationTest.java
(original)
+++ sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ForwardReplicationTest.java
Tue Aug  5 13:52:36 2014
@@ -24,6 +24,9 @@ import org.junit.Test;
 
 import static org.apache.sling.replication.it.ReplicationUtils.*;
 
+/**
+ * Integration test for forward replication
+ */
 public class ForwardReplicationTest extends ReplicationIntegrationTestBase {
 
     @Test
@@ -34,7 +37,6 @@ public class ForwardReplicationTest exte
         assertExists(publishClient, nodePath);
     }
 
-
     @Test
     public void testDeleteContent() throws Exception {
         String nodePath = createRandomNode(publishClient, "/content/forward_del_" + System.nanoTime());

Modified: sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationUtils.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationUtils.java?rev=1615932&r1=1615931&r2=1615932&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationUtils.java
(original)
+++ sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationUtils.java
Tue Aug  5 13:52:36 2014
@@ -19,6 +19,11 @@
 
 package org.apache.sling.replication.it;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
 import org.apache.http.NameValuePair;
 import org.apache.http.client.entity.UrlEncodedFormEntity;
 import org.apache.http.message.BasicNameValuePair;
@@ -28,14 +33,7 @@ import org.apache.sling.testing.tools.ht
 import org.apache.sling.testing.tools.sling.SlingClient;
 import org.apache.sling.testing.tools.sling.SlingInstance;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 /**
  * Utils class for Replication ITs
@@ -46,7 +44,7 @@ public class ReplicationUtils {
     private static final String REPLICATION_ROOT_PATH = "/libs/sling/replication";
 
     private static void assertPostResourceWithParameters(SlingInstance slingInstance,
-                                                           int status, String path, String...
parameters) throws IOException {
+                                                         int status, String path, String...
parameters) throws IOException {
         Request request = slingInstance.getRequestBuilder().buildPostRequest(path);
 
         if (parameters != null) {
@@ -65,7 +63,7 @@ public class ReplicationUtils {
     }
 
     private static void assertPostResourceWithHeaders(SlingInstance slingInstance,
-                                                        int status, String path, String...
headers) throws IOException {
+                                                      int status, String path, String...
headers) throws IOException {
         Request request = slingInstance.getRequestBuilder().buildPostRequest(path);
         if (headers != null) {
             assertEquals(0, headers.length % 2);
@@ -79,7 +77,7 @@ public class ReplicationUtils {
     }
 
     public static void assertResponseContains(SlingInstance slingInstance,
-                                                     String resource, String... parameters)
throws IOException {
+                                              String resource, String... parameters) throws
IOException {
         if (!resource.endsWith(JSON_SELECTOR)) {
             resource += JSON_SELECTOR;
         }
@@ -105,7 +103,7 @@ public class ReplicationUtils {
         args.add(action.toString());
 
         if (paths != null) {
-            for (String path: paths) {
+            for (String path : paths) {
                 args.add(ReplicationHeader.PATH.toString());
                 args.add(path);
             }
@@ -120,7 +118,7 @@ public class ReplicationUtils {
 
     public static void assertExists(SlingClient slingClient, String path) throws Exception
{
         int retries = 10;
-        while(!slingClient.exists(path) && retries-- > 0) {
+        while (!slingClient.exists(path) && retries-- > 0) {
             Thread.sleep(1000);
         }
         assertTrue(slingClient.exists(path));
@@ -128,18 +126,19 @@ public class ReplicationUtils {
 
     public static void assertNotExits(SlingClient slingClient, String path) throws Exception
{
         int retries = 10;
-        while(slingClient.exists(path) && retries-- > 0) {
+        while (slingClient.exists(path) && retries-- > 0) {
             Thread.sleep(1000);
         }
         assertFalse(slingClient.exists(path));
     }
 
     public static String createRandomNode(SlingClient slingClient, String parentPath) throws
Exception {
+        String nodePath = parentPath + "/" + UUID.randomUUID();
         if (!slingClient.exists(parentPath)) {
             slingClient.createNode(parentPath, "jcr:primaryType", "nt:unstructured");
         }
-        return slingClient.createNode(parentPath + "/" + UUID.randomUUID(), "jcr:primaryType",
"nt:unstructured",
-                "propName", "propValue");
+        slingClient.createNode(nodePath, "jcr:primaryType", "nt:unstructured", "propName",
"propValue");
+        return nodePath;
     }
 
     public static String agentRootUrl() {
@@ -151,7 +150,7 @@ public class ReplicationUtils {
     }
 
     public static String queueUrl(String agentName) {
-        return REPLICATION_ROOT_PATH + "/agents/" + agentName +"/queue";
+        return REPLICATION_ROOT_PATH + "/agents/" + agentName + "/queue";
     }
 
     public static String agentConfigUrl(String agentName) {



Mime
View raw message