@Test public void testGetCounterMerticValue() throws Exception{ PercentageUpTimeHandler perHandler = new PercentageUpTimeHandler(); ComponentTypeEntity cte = daoService.createComponentType(); HealthCheckEntity hce = daoService.createHealthCheckEntity(0,cte,0,"Mesos"); DaillyCompStatusEntity de = daoService.createDailyCompStatus(hce); String[] name= new String[10]; name[0]=hce.getComponent().getParentComponent().getComponentName(); CounterDetailVO counterDetails = new CounterDetailVO(); counterDetails.setEnvironmentCounterId(6); counterDetails.setEnvironmentId(1); counterDetails.setCounterId(1); counterDetails.setCounterMetricTypeId(1); counterDetails.setParameter1("1,2"); counterDetails.setParameter2("Prometheous query"); float uptime = perHandler.getCounterMerticValue(counterDetails, null); }
@Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { String[] environmentCounterIDs = counterDetails.getParameter1().split(","); float upTime = DBQueryUtil.getCCPUpTime(counterDetails.getEnvironmentId(), environmentCounterIDs); if(upTime == 0f){ upTime = 100f; } logger.debug("EnvironmentCounterId=" + counterDetails.getEnvironmentCounterId() + "; UPTime = " + upTime ); return upTime; }
PercentageUpTimeHandler extends CounterMetricHandler { @Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { String[] environmentCounterIDs = counterDetails.getParameter1().split(","); float upTime = DBQueryUtil.getCCPUpTime(counterDetails.getEnvironmentId(), environmentCounterIDs); if(upTime == 0f){ upTime = 100f; } logger.debug("EnvironmentCounterId=" + counterDetails.getEnvironmentCounterId() + "; UPTime = " + upTime ); return upTime; } }
PercentageUpTimeHandler extends CounterMetricHandler { @Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { String[] environmentCounterIDs = counterDetails.getParameter1().split(","); float upTime = DBQueryUtil.getCCPUpTime(counterDetails.getEnvironmentId(), environmentCounterIDs); if(upTime == 0f){ upTime = 100f; } logger.debug("EnvironmentCounterId=" + counterDetails.getEnvironmentCounterId() + "; UPTime = " + upTime ); return upTime; }  }
PercentageUpTimeHandler extends CounterMetricHandler { @Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { String[] environmentCounterIDs = counterDetails.getParameter1().split(","); float upTime = DBQueryUtil.getCCPUpTime(counterDetails.getEnvironmentId(), environmentCounterIDs); if(upTime == 0f){ upTime = 100f; } logger.debug("EnvironmentCounterId=" + counterDetails.getEnvironmentCounterId() + "; UPTime = " + upTime ); return upTime; }  @Override float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails); @Override Logger getLogger(); }
PercentageUpTimeHandler extends CounterMetricHandler { @Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { String[] environmentCounterIDs = counterDetails.getParameter1().split(","); float upTime = DBQueryUtil.getCCPUpTime(counterDetails.getEnvironmentId(), environmentCounterIDs); if(upTime == 0f){ upTime = 100f; } logger.debug("EnvironmentCounterId=" + counterDetails.getEnvironmentCounterId() + "; UPTime = " + upTime ); return upTime; }  @Override float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails); @Override Logger getLogger();  }