/** * Retrieves the IDs (or does updates) like:<br> * id - activation key id in DB<br> * environment_id - id of the environment<br> * template_id - id of the template (could be null)<br> * subscriptions - array of pool_ids (could be null) */ private void updateIDs() { SSHCommandResult res; // retrieve environment_id if (this.environment != null) { KatelloEnvironment env = new KatelloEnvironment(this.environment, null, this.org, KatelloEnvironment.LIBRARY); res = env.cli_info(); Assert.assertTrue( res.getExitCode().intValue() == 0, "Check - return code (environment info)"); this.environment_id = KatelloCli.grepCLIOutput("Id", res.getStdout()); } // retrieve template_id for an environment if (this.template != null) { KatelloTemplate tmpl = new KatelloTemplate(template, null, this.org, null); res = tmpl.info(this.environment); Assert.assertTrue(res.getExitCode().intValue() == 0, "Check - return code (template info)"); this.template_id = KatelloCli.grepCLIOutput("Id", res.getStdout()); } // retrieve id if (this.name != null) { res = info(); this.id = KatelloCli.grepCLIOutput("Id", res.getStdout()); } }
@BeforeClass(description = "Generate unique objects") public void setUp() { String uid = KatelloUtils.getUniqueID(); org_name = "org" + uid; provider_name = "provider" + uid; product_name = "product" + uid; repo_name = "repo" + uid; env_name = "env" + uid; // Create org: KatelloOrg org = new KatelloOrg(this.org_name, "Package tests"); exec_result = org.cli_create(); Assert.assertTrue(exec_result.getExitCode() == 0, "Check - return code"); // Create provider: KatelloProvider prov = new KatelloProvider(provider_name, org_name, "Package provider", null); exec_result = prov.create(); Assert.assertTrue(exec_result.getExitCode() == 0, "Check - return code"); // Create product: KatelloProduct prod = new KatelloProduct(product_name, org_name, provider_name, null, null, null, null, null); exec_result = prod.create(); Assert.assertTrue(exec_result.getExitCode() == 0, "Check - return code"); exec_result = prod.cli_list(); product_Id = KatelloCli.grepCLIOutput("ID", getOutput(exec_result).trim(), 1); KatelloRepo repo = new KatelloRepo(repo_name, org_name, product_name, REPO_INECAS_ZOO3, null, null); exec_result = repo.create(); Assert.assertTrue(exec_result.getExitCode() == 0, "Check - return code"); KatelloEnvironment env = new KatelloEnvironment(env_name, null, org_name, KatelloEnvironment.LIBRARY); exec_result = env.cli_create(); Assert.assertTrue(exec_result.getExitCode() == 0, "Check - return code"); prov.synchronize(); content_view = KatelloUtils.promoteRepoToEnvironment(org_name, product_name, repo_name, env_name); }