You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2016/06/30 17:02:06 UTC

lucene-solr:master: SOLR-8787: Shutdown MiniSolrCloudCluster in a finally block

Repository: lucene-solr
Updated Branches:
  refs/heads/master 6528dacb0 -> 0a15699ca


SOLR-8787: Shutdown MiniSolrCloudCluster in a finally block


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

Branch: refs/heads/master
Commit: 0a15699caa5d7d3a6b72977f90857d0a78a2fd70
Parents: 6528dac
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Thu Jun 30 22:32:23 2016 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Thu Jun 30 22:32:23 2016 +0530

----------------------------------------------------------------------
 .../solr/cloud/TestAuthenticationFramework.java | 31 ++++++++++----------
 1 file changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0a15699c/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
index 6e3c28a..08db692 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
@@ -104,27 +104,28 @@ public class TestAuthenticationFramework extends LuceneTestCase {
   public void testBasics() throws Exception {
 
     MiniSolrCloudCluster miniCluster = createMiniSolrCloudCluster();
-
-    // Should pass
-    collectionCreateSearchDelete(miniCluster);
-
-    MockAuthenticationPlugin.expectedUsername = "solr";
-    MockAuthenticationPlugin.expectedPassword = "s0lrRocks";
-    
-    // Should fail with 401
     try {
+      // Should pass
       collectionCreateSearchDelete(miniCluster);
-      fail("Should've returned a 401 error");
-    } catch (Exception ex) {
-      if (!ex.getMessage().contains("Error 401")) {
+
+      MockAuthenticationPlugin.expectedUsername = "solr";
+      MockAuthenticationPlugin.expectedPassword = "s0lrRocks";
+
+      // Should fail with 401
+      try {
+        collectionCreateSearchDelete(miniCluster);
         fail("Should've returned a 401 error");
+      } catch (Exception ex) {
+        if (!ex.getMessage().contains("Error 401")) {
+          fail("Should've returned a 401 error");
+        }
+      } finally {
+        MockAuthenticationPlugin.expectedUsername = null;
+        MockAuthenticationPlugin.expectedPassword = null;
       }
     } finally {
-      MockAuthenticationPlugin.expectedUsername = null;
-      MockAuthenticationPlugin.expectedPassword = null;
+      miniCluster.shutdown();
     }
-
-    miniCluster.shutdown();
   }
 
   @After