You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jd...@apache.org on 2012/11/05 19:51:00 UTC

svn commit: r1405919 - /lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java

Author: jdyer
Date: Mon Nov  5 18:51:00 2012
New Revision: 1405919

URL: http://svn.apache.org/viewvc?rev=1405919&view=rev
Log:
SOLR-4019: Fix tests that are invalid due to logging change

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java?rev=1405919&r1=1405918&r2=1405919&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java Mon Nov  5 18:51:00 2012
@@ -84,19 +84,16 @@ public class PingRequestHandlerTest exte
     assertEquals("OK", rsp.getValues().get("status")); 
 
   }
-  @Ignore
   public void testEnablingServer() throws Exception {
 
     assertTrue(! healthcheckFile.exists());
 
     // first make sure that ping responds back that the service is disabled
-
-    try {
-      makeRequest(handler, req());
-      fail("Should have thrown a SolrException because not enabled yet");
-    } catch (SolrException se){
-      assertEquals(SolrException.ErrorCode.SERVICE_UNAVAILABLE.code,se.code());
-    }
+    SolrQueryResponse sqr = makeRequest(handler, req());
+    SolrException se = (SolrException) sqr.getException();
+    assertEquals(
+      "Response should have been replaced with a 503 SolrException.",
+      se.code(), SolrException.ErrorCode.SERVICE_UNAVAILABLE.code);
 
     // now enable
 
@@ -115,7 +112,6 @@ public class PingRequestHandlerTest exte
     assertTrue(healthcheckFile.exists());
 
   }
-  @Ignore
   public void testDisablingServer() throws Exception {
 
     assertTrue(! healthcheckFile.exists());
@@ -133,14 +129,12 @@ public class PingRequestHandlerTest exte
     
     assertFalse(healthcheckFile.exists());
 
-    // now make sure that ping responds back that the service is disabled
-
-    try {
-      makeRequest(handler, req());
-      fail("Should have thrown a SolrException because not enabled yet");
-    } catch (SolrException se){
-      assertEquals(SolrException.ErrorCode.SERVICE_UNAVAILABLE.code,se.code());
-    }
+    // now make sure that ping responds back that the service is disabled    
+    SolrQueryResponse sqr = makeRequest(handler, req());
+    SolrException se = (SolrException) sqr.getException();
+    assertEquals(
+      "Response should have been replaced with a 503 SolrException.",
+      se.code(), SolrException.ErrorCode.SERVICE_UNAVAILABLE.code);
     
     // disable when already disabled shouldn't cause any problems
     makeRequest(handler, req("action", "disable"));