@Test public void testGetPSServiceStatus() throws Exception { List<ComponentService> services = new LinkedList(); ComponentService cs = new ComponentService(PS, PS, PS); services.add(cs); Map<String, Boolean> result = fixture.getServiceStatus(services); assertNotNull(result); assertEquals(1, result.size()); assertNotNull(result.get(PS)); }
public Map<String, Boolean> getServiceStatus(List<ComponentService> services) { Map<String, Boolean> serviceStatus = new HashMap<String, Boolean>(); for (ComponentService service : services) { Result rs = new Result(); try { rs = CommandExecutor.executeCommand("pgrep -l " + service.getName()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } serviceStatus.put(service.getRole(), false); if (rs.getExitVal() == 0) { serviceStatus.put(service.getRole(), true); } LOGGER.info("Service Status " + serviceStatus); } return serviceStatus; }
PSServiceStatusProvider extends ServiceProvider { public Map<String, Boolean> getServiceStatus(List<ComponentService> services) { Map<String, Boolean> serviceStatus = new HashMap<String, Boolean>(); for (ComponentService service : services) { Result rs = new Result(); try { rs = CommandExecutor.executeCommand("pgrep -l " + service.getName()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } serviceStatus.put(service.getRole(), false); if (rs.getExitVal() == 0) { serviceStatus.put(service.getRole(), true); } LOGGER.info("Service Status " + serviceStatus); } return serviceStatus; } }
PSServiceStatusProvider extends ServiceProvider { public Map<String, Boolean> getServiceStatus(List<ComponentService> services) { Map<String, Boolean> serviceStatus = new HashMap<String, Boolean>(); for (ComponentService service : services) { Result rs = new Result(); try { rs = CommandExecutor.executeCommand("pgrep -l " + service.getName()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } serviceStatus.put(service.getRole(), false); if (rs.getExitVal() == 0) { serviceStatus.put(service.getRole(), true); } LOGGER.info("Service Status " + serviceStatus); } return serviceStatus; }  }
PSServiceStatusProvider extends ServiceProvider { public Map<String, Boolean> getServiceStatus(List<ComponentService> services) { Map<String, Boolean> serviceStatus = new HashMap<String, Boolean>(); for (ComponentService service : services) { Result rs = new Result(); try { rs = CommandExecutor.executeCommand("pgrep -l " + service.getName()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } serviceStatus.put(service.getRole(), false); if (rs.getExitVal() == 0) { serviceStatus.put(service.getRole(), true); } LOGGER.info("Service Status " + serviceStatus); } return serviceStatus; }  Map<String, Boolean> getServiceStatus(List<ComponentService> services); }
PSServiceStatusProvider extends ServiceProvider { public Map<String, Boolean> getServiceStatus(List<ComponentService> services) { Map<String, Boolean> serviceStatus = new HashMap<String, Boolean>(); for (ComponentService service : services) { Result rs = new Result(); try { rs = CommandExecutor.executeCommand("pgrep -l " + service.getName()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } serviceStatus.put(service.getRole(), false); if (rs.getExitVal() == 0) { serviceStatus.put(service.getRole(), true); } LOGGER.info("Service Status " + serviceStatus); } return serviceStatus; }  Map<String, Boolean> getServiceStatus(List<ComponentService> services);  }