@AfterClass( groups = "wso2.greg", alwaysRun = true, description = "cleaning up the artifacts added") public void tearDown() throws GovernanceException { policyManager.removePolicy(policy.getId()); policy = null; policyManager = null; infoServiceAdminclient = null; governanceRegistry = null; }
private void addPolicy() throws RegistryException, IOException { PolicyManager policyManager = new PolicyManager(governance); String policyFilePath = ProductConstant.getResourceLocations(ProductConstant.GREG_SERVER_NAME) + File.separator + "policy" + File.separator; Policy policy = policyManager.newPolicy( FileManager.readFile(policyFilePath + "UTPolicy.xml").getBytes(), "UTPolicy.xml"); policyManager.addPolicy(policy); policy = policyManager.getPolicy(policy.getId()); Resource resource = governance.get(policy.getPath()); resource.addProperty("abcxyzpqr", "40"); governance.put(policy.getPath(), resource); }
/** tags verification */ @Test(groups = "wso2.greg", description = "tags verification") public void testAddPolicy() throws RemoteException, ResourceAdminServiceExceptionException, GovernanceException, MalformedURLException { policy = policyManager.newPolicy( "https://svn.wso2.org/repos/wso2/carbon/platform/trunk/" + "platform-integration/platform-automated-test-suite/" + "org.wso2.carbon.automation.test.repo/src/main/" + "resources/artifacts/GREG/policy/policy.xml"); policy.addAttribute("version", "1.0.0"); policy.addAttribute("author", "Aparna"); policy.addAttribute("description", "added policy using url"); policyManager.addPolicy(policy); assertFalse(policy.getId().isEmpty()); assertNotNull(policy); assertTrue(policy.getAttribute("author").contentEquals("Aparna")); }