forked from Netflix/Hystrix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reject requests after servlet shutdown (fixes Netflix#786)
- Loading branch information
lasse.voss
committed
May 5, 2015
1 parent
dc06181
commit bc3e75f
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../com/netflix/hystrix/contrib/metrics/eventstream/HystrixMetricsStreamServletUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.netflix.hystrix.contrib.metrics.eventstream; | ||
|
||
import org.junit.Test; | ||
import org.mockito.Mockito; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.verify; | ||
|
||
public class HystrixMetricsStreamServletUnitTest { | ||
|
||
@Test | ||
public void shutdownServletShouldRejectRequests() throws ServletException, IOException { | ||
|
||
final HystrixMetricsStreamServlet servlet = new HystrixMetricsStreamServlet(); | ||
servlet.shutdown(); | ||
|
||
final HttpServletResponse response = mock(HttpServletResponse.class); | ||
servlet.doGet(mock(HttpServletRequest.class), response); | ||
|
||
verify(response).sendError(503, "Service has been shut down."); | ||
|
||
} | ||
|
||
} |