test_class.declarator: workerManager
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private WorkerManager workerManager;
test_class.type: WorkerManager
test_class.var_name: workerManager
test_class.declarator: outBuffer
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private OutboundBuffer outBuffer;
test_class.type: OutboundBuffer
test_class.var_name: outBuffer
test_class.declarator: inBuffer
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private InBuffer inBuffer;
test_class.type: InBuffer
test_class.var_name: inBuffer
test_class.declarator: workerMonitors
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private WorkerMonitors workerMonitors;
test_class.type: WorkerMonitors
test_class.var_name: workerMonitors
test_class.file: worker/worker-manager/score-worker-manager-impl/src/test/java/io/cloudslang/worker/management/monitor/WorkerMonitorsImplTest.java
test_class.identifier: WorkerMonitorsImplTest
test_case.body: @Test
      public void testWorkerMonitors() {
          when(workerManager.getWorkerUuid()).thenReturn("1");
          when(workerManager.getExecutionThreadsCount()).thenReturn(5);
          when(inBuffer.getCapacity()).thenReturn(55);
          when(outBuffer.getCapacity()).thenReturn(66);
  
  
          Map<WorkerMonitorInfoEnum, Serializable> monitorInfo = workerMonitors.getMonitorInfo();
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.TOTAL_MEMORY));
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.FREE_MEMORY));
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.MAX_MEMORY));
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.WORKER_ID));
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.EXECUTION_THREADS_AMOUNT));
          assertEquals(5, monitorInfo.get(WorkerMonitorInfoEnum.EXECUTION_THREADS_AMOUNT));
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.OUTBUFFER_CAPACITY));
          assertEquals(66, monitorInfo.get(WorkerMonitorInfoEnum.OUTBUFFER_CAPACITY));
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.INBUFFER_CAPACITY));
          assertEquals(55, monitorInfo.get(WorkerMonitorInfoEnum.INBUFFER_CAPACITY));
  
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_START_TIME));
          assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_END_TIME));
  
          Long firstStart = (Long) monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_START_TIME);
          Long firstEnd = (Long) monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_END_TIME);
  
          try {
              Thread.sleep(50);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
          monitorInfo = workerMonitors.getMonitorInfo();
  
          Long secondStart = (Long) monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_START_TIME);
          Long secondEnd = (Long) monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_END_TIME);
  
          assertFalse(firstStart.equals(secondStart));
          assertFalse(firstEnd.equals(secondEnd));
      }
test_case.class_method_signature: WorkerMonitorsImplTest.testWorkerMonitors()
test_case.full_signature: @Test public void testWorkerMonitors()
test_case.identifier: testWorkerMonitors
test_case.invocations: thenReturn when getWorkerUuid thenReturn when getExecutionThreadsCount thenReturn when getCapacity thenReturn when getCapacity getMonitorInfo assertNotNull get assertNotNull get assertNotNull get assertNotNull get assertNotNull get assertEquals get assertNotNull get assertEquals get assertNotNull get assertEquals get assertNotNull get assertNotNull get get get sleep printStackTrace getMonitorInfo get get assertFalse equals assertFalse equals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testWorkerMonitors()
focal_class.declarator: monitorStartTime
focal_class.modifier: private
focal_class.original_string: private long monitorStartTime;
focal_class.type: long
focal_class.var_name: monitorStartTime
focal_class.declarator: workerManager
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private WorkerManager workerManager;
focal_class.type: WorkerManager
focal_class.var_name: workerManager
focal_class.declarator: outBuffer
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private OutboundBuffer outBuffer;
focal_class.type: OutboundBuffer
focal_class.var_name: outBuffer
focal_class.declarator: inBuffer
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private InBuffer inBuffer;
focal_class.type: InBuffer
focal_class.var_name: inBuffer
focal_class.declarator: monitors
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private List<WorkerMonitor> monitors;
focal_class.type: List<WorkerMonitor>
focal_class.var_name: monitors
focal_class.file: worker/worker-manager/score-worker-manager-impl/src/main/java/io/cloudslang/worker/management/monitor/WorkerMonitorsImpl.java
focal_class.identifier: WorkerMonitorsImpl
focal_class.interfaces: implements WorkerMonitors
focal_class.class_method_signature: WorkerMonitorsImpl.init()
focal_class.full_signature: @PostConstruct public void init()
focal_class.identifier: init
focal_class.modifiers: @PostConstruct public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: WorkerMonitorsImpl.getMonitorInfo()
focal_class.full_signature: @Override public synchronized Map<WorkerMonitorInfoEnum, Serializable> getMonitorInfo()
focal_class.identifier: getMonitorInfo
focal_class.modifiers: @Override public synchronized
focal_class.parameters: ()
focal_class.return: Map<WorkerMonitorInfoEnum, Serializable>
focal_class.signature: Map<WorkerMonitorInfoEnum, Serializable> getMonitorInfo()
focal_class.class_method_signature: WorkerMonitorsImpl.resetMonitor()
focal_class.full_signature: private synchronized void resetMonitor()
focal_class.identifier: resetMonitor
focal_class.modifiers: private synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void resetMonitor()
focal_method.body: @Override
      public synchronized Map<WorkerMonitorInfoEnum, Serializable> getMonitorInfo() {
          try {
              Map<WorkerMonitorInfoEnum, Serializable> monitorInfo = Maps.newHashMap();
  
              Runtime runtime = Runtime.getRuntime();
              monitorInfo.put(WorkerMonitorInfoEnum.TOTAL_MEMORY, runtime.totalMemory());
              monitorInfo.put(WorkerMonitorInfoEnum.FREE_MEMORY, runtime.freeMemory());
              monitorInfo.put(WorkerMonitorInfoEnum.MAX_MEMORY, runtime.maxMemory());
  
              monitorInfo.put(WorkerMonitorInfoEnum.WORKER_ID, workerManager.getWorkerUuid());
  
              monitorInfo.put(WorkerMonitorInfoEnum.EXECUTION_THREADS_AMOUNT, workerManager.getExecutionThreadsCount());
  
              monitorInfo.put(WorkerMonitorInfoEnum.OUTBUFFER_CAPACITY, outBuffer.getCapacity());
  
              monitorInfo.put(WorkerMonitorInfoEnum.INBUFFER_CAPACITY, inBuffer.getCapacity());
  
              for (WorkerMonitor monitor : monitors) {
                  monitor.captureMonitorInfo(monitorInfo);
              }
  
              monitorInfo.put(WorkerMonitorInfoEnum.MONITOR_START_TIME, monitorStartTime);
              monitorInfo.put(WorkerMonitorInfoEnum.MONITOR_END_TIME, System.currentTimeMillis());
  
              return monitorInfo;
          } finally {
              resetMonitor();
          }
      }
focal_method.class_method_signature: WorkerMonitorsImpl.getMonitorInfo()
focal_method.full_signature: @Override public synchronized Map<WorkerMonitorInfoEnum, Serializable> getMonitorInfo()
focal_method.identifier: getMonitorInfo
focal_method.invocations: newHashMap getRuntime put totalMemory put freeMemory put maxMemory put getWorkerUuid put getExecutionThreadsCount put getCapacity put getCapacity captureMonitorInfo put put currentTimeMillis resetMonitor
focal_method.modifiers: @Override public synchronized
focal_method.parameters: ()
focal_method.return: Map<WorkerMonitorInfoEnum, Serializable>
focal_method.signature: Map<WorkerMonitorInfoEnum, Serializable> getMonitorInfo()