@Test public void updateApiList() throws JsonProcessingException, SQLException, IOException { new MockUp<DBQueryUtil>() { @Mock public int checkAndInsertComponent(final String appName, final String apiName, final ComponentType compType, final String healthCheckURL, final int environmentId, final long regionID, final HealthCheckType healthCheckType, String platform) { return 40; } @Mock public boolean checkAndUpdateMessage(final int componentId, final int environmentId, final long regionID, final HealthCheckType healthCheckType, final Status currentStatus, final String marathonMessage) { return true; } @Mock public ComponentVO getComponent(final int componentId) { ComponentVO compVO = new ComponentVO(); compVO.setComponentName("testComp1"); compVO.setComponentDesc("testDesc1"); compVO.setParentComponentId(8); compVO.setParentComponentName("Test1"); compVO.setComponentTypeId(2); compVO.setDelInd(0); return compVO; } }; List<EnvironmentVO> envList = envTestData.getEnvironmentList(); MarathonConfigProcessor.updateApiList(envList); }
public static void updateApiList(List<EnvironmentVO> environmentVOs) throws JsonProcessingException, SQLException, IOException{ for(EnvironmentVO eVo : environmentVOs){ if(eVo.getMarathonJson() != null && !eVo.getMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getMarathonJson(), eVo.getEnvironmentId(), Region.WEST_REGION.getRegionId()); } if(eVo.getEastMarathonJson() != null && !eVo.getEastMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getEastMarathonJson(), eVo.getEnvironmentId(), Region.EAST_REGION.getRegionId()); } } }
MarathonConfigProcessor { public static void updateApiList(List<EnvironmentVO> environmentVOs) throws JsonProcessingException, SQLException, IOException{ for(EnvironmentVO eVo : environmentVOs){ if(eVo.getMarathonJson() != null && !eVo.getMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getMarathonJson(), eVo.getEnvironmentId(), Region.WEST_REGION.getRegionId()); } if(eVo.getEastMarathonJson() != null && !eVo.getEastMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getEastMarathonJson(), eVo.getEnvironmentId(), Region.EAST_REGION.getRegionId()); } } } }
MarathonConfigProcessor { public static void updateApiList(List<EnvironmentVO> environmentVOs) throws JsonProcessingException, SQLException, IOException{ for(EnvironmentVO eVo : environmentVOs){ if(eVo.getMarathonJson() != null && !eVo.getMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getMarathonJson(), eVo.getEnvironmentId(), Region.WEST_REGION.getRegionId()); } if(eVo.getEastMarathonJson() != null && !eVo.getEastMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getEastMarathonJson(), eVo.getEnvironmentId(), Region.EAST_REGION.getRegionId()); } } } private  MarathonConfigProcessor(); }
MarathonConfigProcessor { public static void updateApiList(List<EnvironmentVO> environmentVOs) throws JsonProcessingException, SQLException, IOException{ for(EnvironmentVO eVo : environmentVOs){ if(eVo.getMarathonJson() != null && !eVo.getMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getMarathonJson(), eVo.getEnvironmentId(), Region.WEST_REGION.getRegionId()); } if(eVo.getEastMarathonJson() != null && !eVo.getEastMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getEastMarathonJson(), eVo.getEnvironmentId(), Region.EAST_REGION.getRegionId()); } } } private  MarathonConfigProcessor(); static void updateApiList(List<EnvironmentVO> environmentVOs); @SuppressWarnings("deprecation") static void updateComponentFromMarathonConfig(String json, int environmentId, long regionId); static void compareAPILists(List<ComponentVO> oldAPIComponentVOs, List<ComponentVO> newAPIComponentVOs, int enviromentId, long regionId); }
MarathonConfigProcessor { public static void updateApiList(List<EnvironmentVO> environmentVOs) throws JsonProcessingException, SQLException, IOException{ for(EnvironmentVO eVo : environmentVOs){ if(eVo.getMarathonJson() != null && !eVo.getMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getMarathonJson(), eVo.getEnvironmentId(), Region.WEST_REGION.getRegionId()); } if(eVo.getEastMarathonJson() != null && !eVo.getEastMarathonJson().equals("")){ updateComponentFromMarathonConfig(eVo.getEastMarathonJson(), eVo.getEnvironmentId(), Region.EAST_REGION.getRegionId()); } } } private  MarathonConfigProcessor(); static void updateApiList(List<EnvironmentVO> environmentVOs); @SuppressWarnings("deprecation") static void updateComponentFromMarathonConfig(String json, int environmentId, long regionId); static void compareAPILists(List<ComponentVO> oldAPIComponentVOs, List<ComponentVO> newAPIComponentVOs, int enviromentId, long regionId);  }