lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject [39/50] [abbrv] lucene-solr git commit: SOLR-445: refactor duplicate test code
Date Tue, 01 Mar 2016 17:07:22 GMT
SOLR-445: refactor duplicate test code


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ad34d3b8
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ad34d3b8
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ad34d3b8

Branch: refs/heads/jira/SOLR-445
Commit: ad34d3b861db1d9033675aad3212750dd7187ffe
Parents: 5fab8bc
Author: Chris Hostetter <hossman@apache.org>
Authored: Mon Feb 29 18:07:16 2016 -0700
Committer: Chris Hostetter <hossman@apache.org>
Committed: Mon Feb 29 18:07:16 2016 -0700

----------------------------------------------------------------------
 .../cloud/TestTolerantUpdateProcessorCloud.java | 28 +++-----------------
 1 file changed, 4 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ad34d3b8/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
index 016a897..410b142 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
@@ -665,34 +665,14 @@ public class TestTolerantUpdateProcessorCloud extends SolrCloudTestCase
{
   }
   
   /** convinience method when the only type of errors you expect are 'add' errors */
-  // nocommit: refactor to be wrapper arround assertUpdateTolerantErrors
   public static void assertUpdateTolerantAddErrors(String assertionMsgPrefix,
                                                    UpdateResponse response,
                                                    String... errorIdsExpected) {
-    @SuppressWarnings("unchecked")
-    List<SimpleOrderedMap<String>> errors = (List<SimpleOrderedMap<String>>)
-      response.getResponseHeader().get("errors");
-    assertNotNull(assertionMsgPrefix + ": Null errors: " + response.toString(), errors);
-    assertEquals(assertionMsgPrefix + ": Num error ids: " + errors.toString(),
-                 errorIdsExpected.length, errors.size());
-
-    Set<String> addErrorIdsExpected = new HashSet<String>(Arrays.asList(errorIdsExpected));
-
-    for (SimpleOrderedMap<String> err : errors) {
-      String assertErrPre = assertionMsgPrefix + ": " + err.toString();
-      
-      assertEquals(assertErrPre + " ... nocommit: this err type not handled yet",
-                   "ADD", err.get("type"));
-      
-      String id = err.get("id");
-      assertNotNull(assertErrPre + " ... null id", id);
-      assertTrue(assertErrPre + " ... unexpected id", addErrorIdsExpected.contains(id));
-
+    ExpectedErr[] expected = new ExpectedErr[errorIdsExpected.length];
+    for (int i = 0; i < expected.length; i++) {
+      expected[i] = addErr(errorIdsExpected[i]);
     }
-
-    // nocommit: retire numErrors, we've already checked errors.size()
-    assertEquals(assertionMsgPrefix + ": numErrors: " + response.toString(),
-                 errorIdsExpected.length, response.getResponseHeader().get("numErrors"));
+    assertUpdateTolerantErrors(assertionMsgPrefix, response, expected);
   }
 
   /** 


Mime
View raw message