manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1556689 - in /manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr: HttpPosterTest.java IngestThreadTest.java
Date Thu, 09 Jan 2014 00:56:39 GMT
Author: kwright
Date: Thu Jan  9 00:56:38 2014
New Revision: 1556689

URL: http://svn.apache.org/r1556689
Log:
Various test fixes

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

Modified: manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java?rev=1556689&r1=1556688&r2=1556689&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java
(original)
+++ manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/HttpPosterTest.java
Thu Jan  9 00:56:38 2014
@@ -65,7 +65,7 @@ public class HttpPosterTest
     throws Exception
   {
 
-    httpPosterToTest = spy(new HttpPoster( "zkHost", "collection1", 5000, 500, "update",
"removePath", "statusPath",
+    httpPosterToTest = spy(new HttpPoster( "localhost", "collection1", 5000, 500, "update",
"removePath", "statusPath",
                  "allowAttributeName", "denyAttributeName", "idAttributeName",
                  "modifiedDateAttributeName", "createdDateAttributeName", "indexedDateAttributeName",
                  "fileNameAttributeName", "mimeTypeAttributeName", new Long( 5000 ), "true"));
@@ -104,16 +104,16 @@ public class HttpPosterTest
     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);
+      shareDenyAcls, acls, denyAcls,commitWithin).thenReturn(mockIngestionThread);
     httpPosterToTest.indexPost("Document Id", document, streamParam,
-                  sourceTargets,true, "AuthorityString",act);
+      sourceTargets,true, "AuthorityString",act);
 
     verifyNew(HttpPoster.IngestThread.class).withArguments("Document Id", document, streamParam,
true, sourceTargets, shareAcls,
-                                 shareDenyAcls, acls, denyAcls, commitWithin );
+      shareDenyAcls, acls, denyAcls, commitWithin );
   }
 
   private void initRepositoryDocumentMock( String[] shareAcls, String[] shareDenyAcls, String[]
acls,
-                       String[] denyAcls )
+    String[] denyAcls )
     throws IOException
   {
     document = mock( RepositoryDocument.class );

Modified: manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/IngestThreadTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/IngestThreadTest.java?rev=1556689&r1=1556688&r2=1556689&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/IngestThreadTest.java
(original)
+++ manifoldcf/branches/CONNECTORS-840/connectors/solr/connector/src/test/java/org/apache/manifoldcf/agents/output/solr/IngestThreadTest.java
Thu Jan  9 00:56:38 2014
@@ -55,6 +55,7 @@ public class IngestThreadTest
   extends TestCase
 {
 
+  HttpPoster.IngestThread ingestThreadToTestKeepAllMetadata;
   HttpPoster.IngestThread ingestThreadToTest;
 
   HttpPoster poster;
@@ -96,9 +97,12 @@ public class IngestThreadTest
     String[] denyAcls = new String[]{ "denyAcl1", "denyAcl2" };
     String commitWithin = "true";
 
-    ingestThreadToTest = spy(
+    ingestThreadToTestKeepAllMetadata = spy(
       poster.new IngestThread( "document id", document, streamParam, true, sourceTargets,
shareAcls,
                    shareDenyAcls, acls, denyAcls, commitWithin ) );
+    ingestThreadToTest = spy(
+      poster.new IngestThread( "document id", document, streamParam, false, sourceTargets,
shareAcls,
+                   shareDenyAcls, acls, denyAcls, commitWithin ) );
 
   }
 
@@ -106,8 +110,8 @@ public class IngestThreadTest
   public void testIndexPostNotKeepMetadata()
     throws Exception
   {
-    this.indexPostNotKeepMetadata( true );
-    this.indexPostNotKeepMetadata( false );
+    this.indexPostNotKeepMetadata( ingestThreadToTestKeepAllMetadata, true );
+    this.indexPostNotKeepMetadata( ingestThreadToTest, false );
 
   }
 
@@ -117,11 +121,9 @@ public class IngestThreadTest
    * @param keep
    * @throws Exception
    */
-  private void indexPostNotKeepMetadata( Boolean keep )
+  private void indexPostNotKeepMetadata( HttpPoster.IngestThread it, boolean keep )
     throws Exception
   {
-    ingestThreadToTest.setKeepAllMetadata( keep );
-
     ContentStreamUpdateRequest contentStreamUpdateRequest = mock( ContentStreamUpdateRequest.class
);
     whenNew( ContentStreamUpdateRequest.class ).withArguments( anyString() ).thenReturn(
       contentStreamUpdateRequest );
@@ -129,7 +131,7 @@ public class IngestThreadTest
     when( contentStreamUpdateRequest.process( any( SolrServer.class ) ) ).thenReturn( mockResponse
);
     doCallRealMethod().when( contentStreamUpdateRequest ).setParams( any( ModifiableSolrParams.class
) );
     doCallRealMethod().when( contentStreamUpdateRequest ).getParams();
-    ingestThreadToTest.run();
+    it.run();
     verifyNew( ContentStreamUpdateRequest.class, atLeastOnce() ).withArguments( anyString()
);
 
     ModifiableSolrParams expectedParams = initExpectedSolrParams( keep );
@@ -166,7 +168,7 @@ public class IngestThreadTest
    * @return
    * @throws UnsupportedEncodingException
    */
-  private ModifiableSolrParams initExpectedSolrParams( Boolean test2 )
+  private ModifiableSolrParams initExpectedSolrParams( boolean test2 )
     throws UnsupportedEncodingException
   {
     ModifiableSolrParams expectedParams = new ModifiableSolrParams();



Mime
View raw message