manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1583963 - in /manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr: HttpPosterTest.java SolrConnectorTest.java
Date Wed, 02 Apr 2014 11:05:25 GMT
Author: kwright
Date: Wed Apr  2 11:05:25 2014
New Revision: 1583963

URL: http://svn.apache.org/r1583963
Log:
Update tests so they should work again (but they still don't)

Modified:
    manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java
    manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/SolrConnectorTest.java

Modified: manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java?rev=1583963&r1=1583962&r2=1583963&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java
(original)
+++ manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java
Wed Apr  2 11:05:25 2014
@@ -83,6 +83,13 @@ public class HttpPosterTest
     String[] acls = new String[]{ "acl1", "acl2" };
     String[] denyAcls = new String[]{ "denyAcl1", "denyAcl2" };
 
+    Map<String,String[]> aclsMap = new HashMap<String,String[]>();
+    Map<String,String[]> denyAclsMap = new HashMap<String,String[]>();
+    aclsMap.put("share",shareAcls);
+    aclsMap.put("document",acls);
+    denyAclsMap.put("share",shareDenyAcls);
+    denyAclsMap.put("document",denyAcls);
+
     Logging.ingest = mock( Logger.class );
     when( Logging.ingest.isDebugEnabled() ).thenReturn( false );
     initRepositoryDocumentMock( shareAcls, shareDenyAcls, acls, denyAcls );
@@ -103,13 +110,13 @@ public class HttpPosterTest
     HttpPoster.IngestThread mockIngestionThread=mock(HttpPoster.IngestThread.class);
     Mockito.doThrow(new RuntimeException()).when( mockIngestionThread ).run();
 
-    whenNew( HttpPoster.IngestThread.class).withArguments("Document Id", document, streamParam,
true, sourceTargets,shareAcls,
-      shareDenyAcls, acls, denyAcls,commitWithin).thenReturn(mockIngestionThread);
+    whenNew( HttpPoster.IngestThread.class).withArguments("Document Id", document, streamParam,
true, sourceTargets,
+      aclsMap, denyAclsMap, commitWithin).thenReturn(mockIngestionThread);
     httpPosterToTest.indexPost("Document Id", document, streamParam,
       sourceTargets,true, "AuthorityString",act);
 
-    verifyNew(HttpPoster.IngestThread.class).withArguments("Document Id", document, streamParam,
true, sourceTargets, shareAcls,
-      shareDenyAcls, acls, denyAcls, commitWithin );
+    verifyNew(HttpPoster.IngestThread.class).withArguments("Document Id", document, streamParam,
true, sourceTargets,
+      aclsMap, denyAclsMap, commitWithin );
   }
 
   private void initRepositoryDocumentMock( String[] shareAcls, String[] shareDenyAcls, String[]
acls,
@@ -118,7 +125,9 @@ public class HttpPosterTest
   {
     document = mock( RepositoryDocument.class );
     List<String> fields = getFields();
+    List<String> securityTypes = getSecurityTypes();
     Iterator<String> fieldsIterator = fields.iterator();
+    Iterator<String> securityTypesIterator = securityTypes.iterator();
     when( document.getFields() ).thenReturn( fieldsIterator );
     when( document.getFieldAsStrings( "cm:description" ) ).thenReturn( new String[]{ "description"
} );
     when( document.getFieldAsStrings( "cm:name" ) ).thenReturn( new String[]{ "name" } );
@@ -126,10 +135,11 @@ public class HttpPosterTest
     when( document.getFieldAsStrings( "extraMetadata1" ) ).thenReturn( new String[]{ "value1"
} );
     when( document.getFieldAsStrings( "extraMetadata2" ) ).thenReturn( new String[]{ "value2"
} );
     when( document.getFieldAsStrings( "extraMetadata3" ) ).thenReturn( new String[]{ "value3"
} );
-    when( document.getACL()).thenReturn(acls);
-    when( document.getShareACL()).thenReturn(shareAcls);
-    when( document.getShareDenyACL()).thenReturn( shareDenyAcls );
-    when( document.getDenyACL()).thenReturn(denyAcls);
+    when( document.securityTypesIterator()).thenReturn(securityTypesIterator);
+    when( document.getSecurityACL( "document" ) ).thenReturn(acls);
+    when( document.getSecurityACL( "share" ) ).thenReturn(shareAcls);
+    when( document.getSecurityDenyACL( "document" ) ).thenReturn(shareAcls);
+    when( document.getSecurityDenyACL( "share" ) ).thenReturn(shareDenyAcls);
   }
 
   /**
@@ -184,6 +194,14 @@ public class HttpPosterTest
     return fields;
   }
 
+  private List<String> getSecurityTypes()
+  {
+    List<String> securityTypes = new ArrayList<String>();
+    securityTypes.add( "document" );
+    securityTypes.add( "share" );
+    return securityTypes;
+  }
+  
   /**
    * returns a testing mapping map
    *

Modified: manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/SolrConnectorTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/SolrConnectorTest.java?rev=1583963&r1=1583962&r2=1583963&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/SolrConnectorTest.java
(original)
+++ manifoldcf/branches/CONNECTORS-856/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/SolrConnectorTest.java
Wed Apr  2 11:05:25 2014
@@ -64,7 +64,7 @@ public class SolrConnectorTest extends T
     Map<String,List<String>> expectedStreamParams = getStreamTypeMap();
 
     connectorToTest.poster=poster;
-    String outputDescription = "1+stream.type=text/plain=+3+cm:description=cm_description_s=+cm:name=cm_name_s=+cm:title=cm_title_s=+1+keepAllMetadata=true=+";
+    String outputDescription = "1+stream.type=text/plain=+3+cm:description=cm_description_s=+cm:name=cm_name_s=+cm:title=cm_title_s=++";
     connectorToTest.addOrReplaceDocument("Document Id", outputDescription,document,"",act);
     verify(poster).indexPost(eq("Document Id"),eq(document),eq(expectedStreamParams),eq(expectedSourceTargets),eq(true),eq(""),eq(act));
   }



Mime
View raw message