You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by ma...@apache.org on 2014/10/20 22:35:16 UTC

svn commit: r1633221 - /manifoldcf/branches/CONNECTORS-1060/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/tests/APISanityHSQLDBIT.java

Author: maoo
Date: Mon Oct 20 20:35:16 2014
New Revision: 1633221

URL: http://svn.apache.org/r1633221
Log:
broke tests of alfresco-webscript connector, exception on DB foreign key

Modified:
    manifoldcf/branches/CONNECTORS-1060/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/tests/APISanityHSQLDBIT.java

Modified: manifoldcf/branches/CONNECTORS-1060/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/tests/APISanityHSQLDBIT.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1060/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/tests/APISanityHSQLDBIT.java?rev=1633221&r1=1633220&r2=1633221&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1060/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/tests/APISanityHSQLDBIT.java (original)
+++ manifoldcf/branches/CONNECTORS-1060/connectors/alfresco-webscript/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfrescowebscript/tests/APISanityHSQLDBIT.java Mon Oct 20 20:35:16 2014
@@ -215,7 +215,87 @@ public class APISanityHSQLDBIT extends B
           throw new Exception(resultNode.getValue());
       }
 
-      //@TODO - Test Job execution
+
+      // Create a job.
+      ConfigurationNode jobObject = new ConfigurationNode("job");
+
+      child = new ConfigurationNode("description");
+      child.setValue("Test Job");
+      jobObject.addChild(jobObject.getChildCount(),child);
+
+      child = new ConfigurationNode("repository_connection");
+      child.setValue("Alfresco Connection");
+      jobObject.addChild(jobObject.getChildCount(),child);
+
+      // Revamped way of adding output connection
+      child = new ConfigurationNode("pipelinestage");
+      ConfigurationNode pipelineChild = new ConfigurationNode("stage_id");
+      pipelineChild.setValue("0");
+      child.addChild(child.getChildCount(),pipelineChild);
+      pipelineChild = new ConfigurationNode("stage_isoutput");
+      pipelineChild.setValue("true");
+      child.addChild(child.getChildCount(),pipelineChild);
+      pipelineChild = new ConfigurationNode("stage_connectionname");
+      pipelineChild.setValue("Null Connection");
+      child.addChild(child.getChildCount(),pipelineChild);
+      jobObject.addChild(jobObject.getChildCount(),child);
+
+      child = new ConfigurationNode("run_mode");
+      child.setValue("scan once");
+      jobObject.addChild(jobObject.getChildCount(),child);
+
+      child = new ConfigurationNode("start_mode");
+      child.setValue("manual");
+      jobObject.addChild(jobObject.getChildCount(),child);
+
+      child = new ConfigurationNode("hopcount_mode");
+      child.setValue("accurate");
+      jobObject.addChild(jobObject.getChildCount(),child);
+
+      child = new ConfigurationNode("document_specification");
+      jobObject.addChild(jobObject.getChildCount(),child);
+
+//Job configuration
+//      ConfigurationNode sn = new ConfigurationNode("startpoint");
+//      sn.setAttribute("luceneQuery",ALFRESCO_TEST_QUERY);
+//
+//      child.addChild(child.getChildCount(),sn);
+
+
+      requestObject = new Configuration();
+      requestObject.addChild(0,jobObject);
+
+      result = performAPIPostOperationViaNodes("jobs",200,requestObject);
+
+      String jobIDString = null;
+      i = 0;
+      while (i < result.getChildCount())
+      {
+        ConfigurationNode resultNode = result.findChild(i++);
+
+        System.out.println("Type: "+resultNode.getType());
+        System.out.println("Value: "+resultNode.getValue());
+        System.out.println("Attributes: "+resultNode.getAttributes());
+
+        if (resultNode.getType().equals("error"))
+          throw new Exception(resultNode.getValue());
+        else if (resultNode.getType().equals("job_id"))
+          jobIDString = resultNode.getValue();
+      }
+      if (jobIDString == null)
+        throw new Exception("Missing job_id from return!");
+
+      // Now, start the job, and wait until it completes.
+      startJob(jobIDString);
+      waitJobInactive(jobIDString, 360000L);
+
+      // Check to be sure we actually processed the right number of documents.
+      // The test data area has 3 documents and one directory, and we have to count the root directory too.
+      long count;
+      count = getJobDocumentsProcessed(jobIDString);
+
+      if (count != 67)
+        throw new ManifoldCFException("Wrong number of documents processed - expected 67, got "+new Long(count).toString());
     }
     catch (Exception e)
     {