sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1615901 - in /sling/trunk/contrib/extensions/replication: core/src/main/java/org/apache/sling/replication/agent/impl/ core/src/main/resources/SLING-CONTENT/libs/sling/replication/config/author/ it/src/test/java/org/apache/sling/replication...
Date Tue, 05 Aug 2014 09:40:52 GMT
Author: tommaso
Date: Tue Aug  5 09:40:52 2014
New Revision: 1615901

URL: http://svn.apache.org/r1615901
Log:
SLING-3820 - applying Marius Petria's patch which fixes resource ITs, fixed default importer
name to local

Removed:
    sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationAgentCommandsIntegrationTest.java
Modified:
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgent.java
    sling/trunk/contrib/extensions/replication/core/src/main/resources/SLING-CONTENT/libs/sling/replication/config/author/org.apache.sling.replication.transport.impl.importer.RemoteReplicationPackageImporter-publish.json
    sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationAgentResourcesIntegrationTest.java
    sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationIntegrationTestBase.java
    sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationPackageImporterResourcesIntegrationTest.java
    sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationUtils.java
    sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReverseReplicationTest.java

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgent.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgent.java?rev=1615901&r1=1615900&r2=1615901&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgent.java
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgent.java
Tue Aug  5 09:40:52 2014
@@ -22,25 +22,16 @@ import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.List;
 import java.util.Properties;
+
 import org.apache.sling.replication.agent.AgentReplicationException;
 import org.apache.sling.replication.agent.ReplicationAgent;
 import org.apache.sling.replication.communication.ReplicationRequest;
 import org.apache.sling.replication.communication.ReplicationResponse;
 import org.apache.sling.replication.event.ReplicationEventFactory;
 import org.apache.sling.replication.event.ReplicationEventType;
-import org.apache.sling.replication.queue.ReplicationQueue;
-import org.apache.sling.replication.queue.ReplicationQueueDistributionStrategy;
-import org.apache.sling.replication.queue.ReplicationQueueException;
-import org.apache.sling.replication.queue.ReplicationQueueItem;
-import org.apache.sling.replication.queue.ReplicationQueueItemState;
-import org.apache.sling.replication.queue.ReplicationQueueProcessor;
-import org.apache.sling.replication.queue.ReplicationQueueProvider;
+import org.apache.sling.replication.queue.*;
 import org.apache.sling.replication.rule.ReplicationRuleEngine;
-import org.apache.sling.replication.serialization.ReplicationPackage;
-import org.apache.sling.replication.serialization.ReplicationPackageBuildingException;
-import org.apache.sling.replication.serialization.ReplicationPackageExporter;
-import org.apache.sling.replication.serialization.ReplicationPackageImporter;
-import org.apache.sling.replication.serialization.ReplicationPackageReadingException;
+import org.apache.sling.replication.serialization.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -128,14 +119,17 @@ public class SimpleReplicationAgent impl
 
         if (useAggregatePaths) {
             ReplicationPackage replicationPackage = buildPackage(replicationRequest);
-            packages.add(replicationPackage);
+            if (replicationPackage != null) {
+                packages.add(replicationPackage);
+            }
         } else {
             for (String path : replicationRequest.getPaths()) {
                 ReplicationPackage replicationPackage = buildPackage(new ReplicationRequest(replicationRequest.getTime(),
                         replicationRequest.getAction(),
                         path));
-
-                packages.add(replicationPackage);
+                if (replicationPackage != null) {
+                    packages.add(replicationPackage);
+                }
             }
         }
 
@@ -158,6 +152,9 @@ public class SimpleReplicationAgent impl
 
     private ReplicationResponse schedule(ReplicationPackage replicationPackage, boolean offer)
throws AgentReplicationException {
         ReplicationResponse replicationResponse = new ReplicationResponse();
+        if (log.isInfoEnabled()) {
+            log.info("scheduling replication of package {}", replicationPackage);
+        }
         ReplicationQueueItem replicationQueueItem = new ReplicationQueueItem(replicationPackage.getId(),
                 replicationPackage.getPaths(),
                 replicationPackage.getAction(),

Modified: sling/trunk/contrib/extensions/replication/core/src/main/resources/SLING-CONTENT/libs/sling/replication/config/author/org.apache.sling.replication.transport.impl.importer.RemoteReplicationPackageImporter-publish.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/resources/SLING-CONTENT/libs/sling/replication/config/author/org.apache.sling.replication.transport.impl.importer.RemoteReplicationPackageImporter-publish.json?rev=1615901&r1=1615900&r2=1615901&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/resources/SLING-CONTENT/libs/sling/replication/config/author/org.apache.sling.replication.transport.impl.importer.RemoteReplicationPackageImporter-publish.json
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/resources/SLING-CONTENT/libs/sling/replication/config/author/org.apache.sling.replication.transport.impl.importer.RemoteReplicationPackageImporter-publish.json
Tue Aug  5 09:40:52 2014
@@ -4,6 +4,6 @@
     "TransportAuthenticationProviderFactory.target" : "(name=user)",
     "authentication.properties" : ["user=admin","password=admin"],
     "ReplicationPackageBuilder.target" : "(name=vlt)",
-    "endpoints" : [ "http://localhost:4503/libs/sling/replication/importers/default" ],
+    "endpoints" : [ "http://localhost:4503/libs/sling/replication/importers/local" ],
     "runModes" : ["author"]
 }
\ No newline at end of file

Modified: sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationAgentResourcesIntegrationTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationAgentResourcesIntegrationTest.java?rev=1615901&r1=1615900&r2=1615901&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationAgentResourcesIntegrationTest.java
(original)
+++ sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationAgentResourcesIntegrationTest.java
Tue Aug  5 09:40:52 2014
@@ -33,8 +33,7 @@ public class ReplicationAgentResourcesIn
         String[] defaultAgentNames = new String[]{
                 "publish",
                 "publish-reverse",
-                "reverserepo",
-                "author",
+                "reverse",
                 "cache-flush"
         };
         for (String agentName : defaultAgentNames) {
@@ -47,8 +46,7 @@ public class ReplicationAgentResourcesIn
     public void testDefaultPublishAgentResources() throws Exception {
         // these agents do not exist as they are bundled to publish runMode
         String[] defaultPublishAgentNames = new String[]{
-                "reverserepo",
-                "author",
+                "reverse",
                 "cache-flush"
         };
         for (String agentName : defaultPublishAgentNames) {
@@ -72,8 +70,7 @@ public class ReplicationAgentResourcesIn
     public void testDefaultPublishAgentQueueResources() throws Exception {
         // these agent queues do not exist as they are bundled to publish runMode
         String[] defaultPublishAgentNames = new String[]{
-                "reverserepo",
-                "author",
+                "reverse",
                 "cache-flush"
         };
         for (String agentName : defaultPublishAgentNames) {
@@ -97,7 +94,7 @@ public class ReplicationAgentResourcesIn
     public void testDefaultAgentsRootResource() throws Exception {
         assertExists(authorClient, agentRootUrl());
         assertResponseContains(author, agentRootUrl(),
-                "sling:resourceType", "replication/agents",
+                "sling:resourceType", "replication/agent/list",
                 "items", "publish-reverse","publish");
     }
 
@@ -106,12 +103,11 @@ public class ReplicationAgentResourcesIn
         String agentName = "sample-create-config" + UUID.randomUUID();
         String newConfigResource = agentConfigUrl(agentName);
 
-        authorClient.createNode(newConfigResource, "name", agentName, "transportHandler",
"(name=author)");
+        authorClient.createNode(newConfigResource, "name", agentName);
         assertExists(authorClient, newConfigResource);
         assertResponseContains(author, newConfigResource,
                 "sling:resourceType", "replication/config/agent",
-                "name", agentName,
-                "transportHandler", "(name=author)");
+                "name", agentName);
     }
 
     @Test

Modified: sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationIntegrationTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationIntegrationTestBase.java?rev=1615901&r1=1615900&r2=1615901&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationIntegrationTestBase.java
(original)
+++ sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationIntegrationTestBase.java
Tue Aug  5 09:40:52 2014
@@ -49,8 +49,7 @@ public abstract class ReplicationIntegra
 
         try {
             // change the url for publish agent and wait for it to start
-
-            String receiverUrl = "http://localhost:4503/libs/sling/replication/importers/default"
+            String receiverUrl = "http://localhost:4503/libs/sling/replication/importers/local"
                     .replace("http://localhost:4503", publish.getServerBaseUrl());
             authorClient.setProperties("/libs/sling/replication/config/importers/remote/publish",
                     "endpoints", receiverUrl);

Modified: sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationPackageImporterResourcesIntegrationTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationPackageImporterResourcesIntegrationTest.java?rev=1615901&r1=1615900&r2=1615901&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationPackageImporterResourcesIntegrationTest.java
(original)
+++ sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReplicationPackageImporterResourcesIntegrationTest.java
Tue Aug  5 09:40:52 2014
@@ -32,16 +32,16 @@ public class ReplicationPackageImporterR
         String rootResource = importerRootUrl();
         assertExists(authorClient, rootResource);
         assertResponseContains(author, rootResource,
-                "sling:resourceType", "replication/importers",
-                "items", "default");
+                "sling:resourceType", "replication/importer/list",
+                "items", "local");
     }
 
     @Test
-    public void testDefaultImporterResource() throws Exception {
-        String rootResource = importerUrl("default");
+    public void testLocalImporterResource() throws Exception {
+        String rootResource = importerUrl("local");
         assertExists(authorClient, rootResource);
         assertResponseContains(author, rootResource,
                 "sling:resourceType", "replication/importer",
-                "name", "default");
+                "name", "local");
     }
 }

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=1615901&r1=1615900&r2=1615901&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 09:40:52 2014
@@ -120,6 +120,7 @@ public class ReplicationUtils {
     }
 
     public static void assertExists(SlingClient slingClient, String path) throws Exception
{
+
         int retries = 100;
         while(!slingClient.exists(path) && retries-- > 0) {
             Thread.sleep(1000);
@@ -129,6 +130,7 @@ public class ReplicationUtils {
     }
 
     public static void assertNotExits(SlingClient slingClient, String path) throws Exception
{
+
         int retries = 100;
         while(slingClient.exists(path) && retries-- > 0) {
             Thread.sleep(1000);
@@ -139,13 +141,12 @@ public class ReplicationUtils {
 
     public static String createRandomNode(SlingClient slingClient, String parentPath) throws
Exception {
         String nodePath = parentPath + "/" + UUID.randomUUID();
-        slingClient.createNode(nodePath, "propName", "propValue");
-        return nodePath;
+        return slingClient.createNode(nodePath, "propName", "propValue");
     }
 
 
     public static String agentRootUrl() {
-        return REPLICATION_ROOT_PATH + "/agent";
+        return REPLICATION_ROOT_PATH + "/agents";
     }
 
     public static String agentUrl(String agentName) {

Modified: sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReverseReplicationTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReverseReplicationTest.java?rev=1615901&r1=1615900&r2=1615901&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReverseReplicationTest.java
(original)
+++ sling/trunk/contrib/extensions/replication/it/src/test/java/org/apache/sling/replication/it/ReverseReplicationTest.java
Tue Aug  5 09:40:52 2014
@@ -4,9 +4,7 @@ package org.apache.sling.replication.it;
 import org.apache.sling.replication.communication.ReplicationActionType;
 import org.junit.Test;
 
-import static org.apache.sling.replication.it.ReplicationUtils.assertExists;
-import static org.apache.sling.replication.it.ReplicationUtils.createRandomNode;
-import static org.apache.sling.replication.it.ReplicationUtils.replicate;
+import static org.apache.sling.replication.it.ReplicationUtils.*;
 
 public class ReverseReplicationTest extends ReplicationIntegrationTestBase {
     @Test
@@ -17,4 +15,14 @@ public class ReverseReplicationTest exte
 
         assertExists(authorClient, nodePath);
     }
+
+
+    @Test
+    public void testDeleteContent() throws Exception {
+        String nodePath = createRandomNode(authorClient, "/content");
+        assertExists(authorClient, nodePath);
+        replicate(publish, "reverse", ReplicationActionType.DELETE, nodePath);
+
+        assertNotExits(authorClient, nodePath);
+    }
 }



Mime
View raw message