manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1629542 - in /manifoldcf/trunk: ./ connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/ connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connec...
Date Sun, 05 Oct 2014 21:36:24 GMT
Author: kwright
Date: Sun Oct  5 21:36:24 2014
New Revision: 1629542

URL: http://svn.apache.org/r1629542
Log:
Fix for CONNECTORS-1056.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnector.java
    manifoldcf/trunk/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnectorTest.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1629542&r1=1629541&r2=1629542&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Sun Oct  5 21:36:24 2014
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 2.0-dev =====================
 
+CONNECTORS-1056: Use ContentUrlPath attribute for actual URI for
+the document in Alfresco.
+(Maurizio Pillitu, Karl Wright)
+
 CONNECTORS-1062: Livelink connector date stamps etc should be in
 ms since epoch, not in human-readable timezone-dependent dates.
 (Karl Wright)

Modified: manifoldcf/trunk/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnector.java?rev=1629542&r1=1629541&r2=1629542&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnector.java
(original)
+++ manifoldcf/trunk/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnector.java
Sun Oct  5 21:36:24 2014
@@ -308,15 +308,19 @@ public class AlfrescoConnector extends B
         long length;
         byte[] empty = new byte[0];
         String contentUrlPath = (String) properties.get(CONTENT_URL_PROPERTY);
-        if (contentUrlPath != null && !contentUrlPath.isEmpty()) {
-          if (this.enableDocumentProcessing) {
-            if (lSize != null) {
-              stream = alfrescoClient.fetchContent(contentUrlPath);
-              length = lSize.longValue();
-            } else {
-              stream = new ByteArrayInputStream(empty);
-              length = 0L;
+        if (contentUrlPath == null || contentUrlPath.isEmpty()) {
+          activities.noDocument(doc, documentVersion);
+          continue;
+        }
+        
+        if (this.enableDocumentProcessing) {
+          if (lSize != null) {
+            stream = alfrescoClient.fetchContent(contentUrlPath);
+            if (stream == null) {
+              activities.noDocument(doc, documentVersion);
+              continue;
             }
+            length = lSize.longValue();
           } else {
             stream = new ByteArrayInputStream(empty);
             length = 0L;
@@ -330,7 +334,7 @@ public class AlfrescoConnector extends B
           rd.setBinary(stream, length);
           if (Logging.connectors != null && Logging.connectors.isDebugEnabled())
             Logging.connectors.debug(MessageFormat.format("Ingesting with id: {0}, URI {1}
and rd {2}", new Object[]{uuid, nodeRef, rd.getFileName()}));
-          activities.ingestDocumentWithException(doc, documentVersion, nodeRef/*was uuid*/,
rd);
+          activities.ingestDocumentWithException(doc, documentVersion, contentUrlPath, rd);
         } catch (IOException e) {
           handleIOException(e,"reading stream");
         } finally {

Modified: manifoldcf/trunk/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnectorTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnectorTest.java?rev=1629542&r1=1629541&r2=1629542&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnectorTest.java
(original)
+++ manifoldcf/trunk/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/AlfrescoConnectorTest.java
Sun Oct  5 21:36:24 2014
@@ -120,6 +120,7 @@ public class AlfrescoConnectorTest {
     testDocument.put("cm:modified","2014-10-02T16:15:25.124Z");
     testDocument.put("size","115");
     testDocument.put("mimetype","text/plain");
+    testDocument.put("contentUrlPath","http://localhost:8080/foo");
     IProcessActivity activities = mock(IProcessActivity.class);
     when(activities.checkDocumentNeedsReindexing(anyString(),anyString()))
       .thenReturn(true);
@@ -130,12 +131,15 @@ public class AlfrescoConnectorTest {
     IExistingVersions statuses = mock(IExistingVersions.class);
     
     when(client.fetchNode(anyString()))
-    .thenReturn(new AlfrescoResponse(0, 0, "", "",
+      .thenReturn(new AlfrescoResponse(0, 0, "", "",
             Arrays.<Map<String, Object>>asList(testDocument)));
 
     when(client.fetchMetadata(anyString()))
       .thenReturn(testDocument);
     
+    when(client.fetchContent(anyString()))
+      .thenReturn(new java.io.ByteArrayInputStream(new byte[0]));
+
 //    processDocuments(String[] documentIdentifiers, IExistingVersions statuses, Specification
spec,
 //            IProcessActivity activities, int jobMode, boolean usesDefaultAuthority)
     connector.processDocuments(new String[]{TestDocument.uuid}, statuses, new Specification(),
activities, 0, true);
@@ -149,7 +153,7 @@ public class AlfrescoConnectorTest {
             .checkMimeTypeIndexable(eq("text/plain"));
     verify(activities)
             .ingestDocumentWithException(eq(TestDocument.uuid), anyString(),
-                    eq(TestDocument.nodeRef), rd.capture());
+                    eq((String)testDocument.get("contentUrlPath")), rd.capture());
     
     Iterator<String> i = rd.getValue().getFields();
     while(i.hasNext()) {



Mime
View raw message