@Test public void doKubernetesBackUp() throws Exception { new MockUp<DBQueryUtil>() { @Mock public List<EnvironmentVO> getAllEnvironments() throws SerialException, SQLException{ EnvironmentVO env = new EnvironmentVO(); env.setK8sUrl("http: env.setK8sCred("kubecred"); List<EnvironmentVO> envList = new ArrayList<EnvironmentVO>(); envList.add(env); return envList; } }; MockUp<CommonsUtil> cumock = new MockUp<CommonsUtil>() { @Mock public String getK8sAuthToken(String credentials) { return "k8s_token"; } }; File resourcesDirectory = new File("src/test/data"); MockUp<RestCommunicationHandler> rch = new MockUp<RestCommunicationHandler>() { @Mock public String getResponse(String urlStr, Boolean doAuth, String authType, String encodedAuth){ String filename = null; if (urlStr.indexOf("deployments") > -1) { filename = "/k8sDeployments.txt"; } else { filename = "/k8sIngress.txt"; } String content = null; try { content = new String ( Files.readAllBytes( Paths.get(resourcesDirectory.getAbsolutePath() + filename) ) ); } catch (IOException e) { e.printStackTrace(); } return content; } }; KubernetesBackUpTask.doKubernetesBackUp(); rch.tearDown(); cumock.tearDown(); }
public static void doKubernetesBackUp() throws SQLException { logger.info("************** STARTED KubernetesBackUp **************"); List<EnvironmentVO> environmentVOs = DBQueryUtil.getAllEnvironments(); for(EnvironmentVO eVo : environmentVOs){ logger.info("STARTED KubernetesBackUp : "+eVo.getEnvironmentName()); if(eVo.getK8sUrl() == null){ continue; } loadKubernetesHealthcheck(eVo); logger.info("COMPLETED KubernetesBackUp : "+eVo.getEnvironmentName()); } }
KubernetesBackUpTask { public static void doKubernetesBackUp() throws SQLException { logger.info("************** STARTED KubernetesBackUp **************"); List<EnvironmentVO> environmentVOs = DBQueryUtil.getAllEnvironments(); for(EnvironmentVO eVo : environmentVOs){ logger.info("STARTED KubernetesBackUp : "+eVo.getEnvironmentName()); if(eVo.getK8sUrl() == null){ continue; } loadKubernetesHealthcheck(eVo); logger.info("COMPLETED KubernetesBackUp : "+eVo.getEnvironmentName()); } } }
KubernetesBackUpTask { public static void doKubernetesBackUp() throws SQLException { logger.info("************** STARTED KubernetesBackUp **************"); List<EnvironmentVO> environmentVOs = DBQueryUtil.getAllEnvironments(); for(EnvironmentVO eVo : environmentVOs){ logger.info("STARTED KubernetesBackUp : "+eVo.getEnvironmentName()); if(eVo.getK8sUrl() == null){ continue; } loadKubernetesHealthcheck(eVo); logger.info("COMPLETED KubernetesBackUp : "+eVo.getEnvironmentName()); } } private  KubernetesBackUpTask(); }
KubernetesBackUpTask { public static void doKubernetesBackUp() throws SQLException { logger.info("************** STARTED KubernetesBackUp **************"); List<EnvironmentVO> environmentVOs = DBQueryUtil.getAllEnvironments(); for(EnvironmentVO eVo : environmentVOs){ logger.info("STARTED KubernetesBackUp : "+eVo.getEnvironmentName()); if(eVo.getK8sUrl() == null){ continue; } loadKubernetesHealthcheck(eVo); logger.info("COMPLETED KubernetesBackUp : "+eVo.getEnvironmentName()); } } private  KubernetesBackUpTask(); static void doKubernetesBackUp(); }
KubernetesBackUpTask { public static void doKubernetesBackUp() throws SQLException { logger.info("************** STARTED KubernetesBackUp **************"); List<EnvironmentVO> environmentVOs = DBQueryUtil.getAllEnvironments(); for(EnvironmentVO eVo : environmentVOs){ logger.info("STARTED KubernetesBackUp : "+eVo.getEnvironmentName()); if(eVo.getK8sUrl() == null){ continue; } loadKubernetesHealthcheck(eVo); logger.info("COMPLETED KubernetesBackUp : "+eVo.getEnvironmentName()); } } private  KubernetesBackUpTask(); static void doKubernetesBackUp();  }