test_class.declarator: mockReq
test_class.modifier: @Mock
test_class.original_string: @Mock HttpServletRequest mockReq;
test_class.type: HttpServletRequest
test_class.var_name: mockReq
test_class.declarator: mockResp
test_class.modifier: @Mock
test_class.original_string: @Mock HttpServletResponse mockResp;
test_class.type: HttpServletResponse
test_class.var_name: mockResp
test_class.declarator: mockConfig
test_class.modifier: @Mock
test_class.original_string: @Mock HystrixConfiguration mockConfig;
test_class.type: HystrixConfiguration
test_class.var_name: mockConfig
test_class.declarator: mockPrintWriter
test_class.modifier: @Mock
test_class.original_string: @Mock PrintWriter mockPrintWriter;
test_class.type: PrintWriter
test_class.var_name: mockPrintWriter
test_class.declarator: servlet
test_class.original_string: HystrixConfigSseServlet servlet;
test_class.type: HystrixConfigSseServlet
test_class.var_name: servlet
test_class.declarator: streamOfOnNexts = Observable.interval(100, TimeUnit.MILLISECONDS).map(new Func1<Long, HystrixConfiguration>() {
          @Override
          public HystrixConfiguration call(Long timestamp) {
              return mockConfig;
          }
      })
test_class.modifier: private final
test_class.original_string: private final Observable<HystrixConfiguration> streamOfOnNexts = Observable.interval(100, TimeUnit.MILLISECONDS).map(new Func1<Long, HystrixConfiguration>() {
          @Override
          public HystrixConfiguration call(Long timestamp) {
              return mockConfig;
          }
      });
test_class.type: Observable<HystrixConfiguration>
test_class.var_name: streamOfOnNexts
test_class.declarator: streamOfOnNextThenOnError = Observable.create(new Observable.OnSubscribe<HystrixConfiguration>() {
          @Override
          public void call(Subscriber<? super HystrixConfiguration> subscriber) {
              try {
                  Thread.sleep(100);
                  subscriber.onNext(mockConfig);
                  Thread.sleep(100);
                  subscriber.onError(new RuntimeException("stream failure"));
              } catch (InterruptedException ex) {
                  ex.printStackTrace();
              }
          }
      }).subscribeOn(Schedulers.computation())
test_class.modifier: private final
test_class.original_string: private final Observable<HystrixConfiguration> streamOfOnNextThenOnError = Observable.create(new Observable.OnSubscribe<HystrixConfiguration>() {
          @Override
          public void call(Subscriber<? super HystrixConfiguration> subscriber) {
              try {
                  Thread.sleep(100);
                  subscriber.onNext(mockConfig);
                  Thread.sleep(100);
                  subscriber.onError(new RuntimeException("stream failure"));
              } catch (InterruptedException ex) {
                  ex.printStackTrace();
              }
          }
      }).subscribeOn(Schedulers.computation());
test_class.type: Observable<HystrixConfiguration>
test_class.var_name: streamOfOnNextThenOnError
test_class.declarator: streamOfOnNextThenOnCompleted = Observable.create(new Observable.OnSubscribe<HystrixConfiguration>() {
          @Override
          public void call(Subscriber<? super HystrixConfiguration> subscriber) {
              try {
                  Thread.sleep(100);
                  subscriber.onNext(mockConfig);
                  Thread.sleep(100);
                  subscriber.onCompleted();
              } catch (InterruptedException ex) {
                  ex.printStackTrace();
              }
          }
      }).subscribeOn(Schedulers.computation())
test_class.modifier: private final
test_class.original_string: private final Observable<HystrixConfiguration> streamOfOnNextThenOnCompleted = Observable.create(new Observable.OnSubscribe<HystrixConfiguration>() {
          @Override
          public void call(Subscriber<? super HystrixConfiguration> subscriber) {
              try {
                  Thread.sleep(100);
                  subscriber.onNext(mockConfig);
                  Thread.sleep(100);
                  subscriber.onCompleted();
              } catch (InterruptedException ex) {
                  ex.printStackTrace();
              }
          }
      }).subscribeOn(Schedulers.computation());
test_class.type: Observable<HystrixConfiguration>
test_class.var_name: streamOfOnNextThenOnCompleted
test_class.file: hystrix-contrib/hystrix-metrics-event-stream/src/test/java/com/netflix/hystrix/contrib/sample/stream/HystrixConfigSseServletTest.java
test_class.identifier: HystrixConfigSseServletTest
test_case.body: @Test
      public void testConfigDataWithStreamOnCompleted() throws IOException, InterruptedException {
          servlet = new HystrixConfigSseServlet(streamOfOnNextThenOnCompleted, 10);
          try {
              servlet.init();
          } catch (ServletException ex) {
  
          }
  
          final AtomicInteger writes = new AtomicInteger(0);
  
          when(mockReq.getParameter("delay")).thenReturn("100");
          when(mockResp.getWriter()).thenReturn(mockPrintWriter);
          Mockito.doAnswer(new Answer<Void>() {
              @Override
              public Void answer(InvocationOnMock invocation) throws Throwable {
                  String written = (String) invocation.getArguments()[0];
                  System.out.println("ARG : " + written);
  
                  if (!written.contains("ping")) {
                      writes.incrementAndGet();
                  }
                  return null;
              }
          }).when(mockPrintWriter).print(Mockito.anyString());
  
          Runnable simulateClient = new Runnable() {
              @Override
              public void run() {
                  try {
                      servlet.doGet(mockReq, mockResp);
                  } catch (ServletException ex) {
                      fail(ex.getMessage());
                  } catch (IOException ex) {
                      fail(ex.getMessage());
                  }
              }
          };
  
          Thread t = new Thread(simulateClient);
          t.start();
  
          try {
              Thread.sleep(1000);
              System.out.println(System.currentTimeMillis() + " Woke up from sleep : " + Thread.currentThread().getName());
          } catch (InterruptedException ex) {
              fail(ex.getMessage());
          }
  
          assertEquals(1, writes.get());
          assertEquals(0, servlet.getNumberCurrentConnections());
      }
test_case.class_method_signature: HystrixConfigSseServletTest.testConfigDataWithStreamOnCompleted()
test_case.full_signature: @Test public void testConfigDataWithStreamOnCompleted()
test_case.identifier: testConfigDataWithStreamOnCompleted
test_case.invocations: init thenReturn when getParameter thenReturn when getWriter print when doAnswer getArguments println contains incrementAndGet anyString doGet fail getMessage fail getMessage start sleep println currentTimeMillis getName currentThread fail getMessage assertEquals get assertEquals getNumberCurrentConnections
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testConfigDataWithStreamOnCompleted()
focal_class.declarator: serialVersionUID = -3599771169762858235L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = -3599771169762858235L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: concurrentConnections = new AtomicInteger(0)
focal_class.modifier: private static
focal_class.original_string: private static AtomicInteger concurrentConnections = new AtomicInteger(0);
focal_class.type: AtomicInteger
focal_class.var_name: concurrentConnections
focal_class.declarator: maxConcurrentConnections = DynamicPropertyFactory.getInstance().getIntProperty("hystrix.config.stream.maxConcurrentConnections", 5)
focal_class.modifier: private static
focal_class.original_string: private static DynamicIntProperty maxConcurrentConnections = DynamicPropertyFactory.getInstance().getIntProperty("hystrix.config.stream.maxConcurrentConnections", 5);
focal_class.type: DynamicIntProperty
focal_class.var_name: maxConcurrentConnections
focal_class.file: hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/sample/stream/HystrixConfigSseServlet.java
focal_class.identifier: HystrixConfigSseServlet
focal_class.class_method_signature: HystrixConfigSseServlet.HystrixConfigSseServlet()
focal_class.full_signature: public  HystrixConfigSseServlet()
focal_class.identifier: HystrixConfigSseServlet
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  HystrixConfigSseServlet()
focal_class.class_method_signature: HystrixConfigSseServlet.HystrixConfigSseServlet(Observable<HystrixConfiguration> sampleStream, int pausePollerThreadDelayInMs)
focal_class.full_signature:   HystrixConfigSseServlet(Observable<HystrixConfiguration> sampleStream, int pausePollerThreadDelayInMs)
focal_class.identifier: HystrixConfigSseServlet
focal_class.parameters: (Observable<HystrixConfiguration> sampleStream, int pausePollerThreadDelayInMs)
focal_class.signature:  HystrixConfigSseServlet(Observable<HystrixConfiguration> sampleStream, int pausePollerThreadDelayInMs)
focal_class.class_method_signature: HystrixConfigSseServlet.getMaxNumberConcurrentConnectionsAllowed()
focal_class.full_signature: @Override protected int getMaxNumberConcurrentConnectionsAllowed()
focal_class.identifier: getMaxNumberConcurrentConnectionsAllowed
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getMaxNumberConcurrentConnectionsAllowed()
focal_class.class_method_signature: HystrixConfigSseServlet.getNumberCurrentConnections()
focal_class.full_signature: @Override protected int getNumberCurrentConnections()
focal_class.identifier: getNumberCurrentConnections
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getNumberCurrentConnections()
focal_class.class_method_signature: HystrixConfigSseServlet.incrementAndGetCurrentConcurrentConnections()
focal_class.full_signature: @Override protected int incrementAndGetCurrentConcurrentConnections()
focal_class.identifier: incrementAndGetCurrentConcurrentConnections
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int incrementAndGetCurrentConcurrentConnections()
focal_class.class_method_signature: HystrixConfigSseServlet.decrementCurrentConcurrentConnections()
focal_class.full_signature: @Override protected void decrementCurrentConcurrentConnections()
focal_class.identifier: decrementCurrentConcurrentConnections
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void decrementCurrentConcurrentConnections()
focal_class.superclass: extends HystrixSampleSseServlet
focal_method.body: @Override
      protected int getNumberCurrentConnections() {
          return concurrentConnections.get();
      }
focal_method.class_method_signature: HystrixConfigSseServlet.getNumberCurrentConnections()
focal_method.full_signature: @Override protected int getNumberCurrentConnections()
focal_method.identifier: getNumberCurrentConnections
focal_method.invocations: get
focal_method.modifiers: @Override protected
focal_method.parameters: ()
focal_method.return: int
focal_method.signature: int getNumberCurrentConnections()