@Test(groups = {"wso2.greg"}) public void ContinuousDelete() throws RegistryException, InterruptedException { int iterations = 100; for (int i = 0; i < iterations; i++) { Resource res1 = registry.newResource(); byte[] r1content = "R2 content".getBytes(); res1.setContent(r1content); String path = "/con-delete/test/" + i + 1; registry.put(path, res1); Resource resource1 = registry.get(path); assertEquals( new String((byte[]) resource1.getContent()), new String((byte[]) res1.getContent()), "File content is not matching"); registry.delete(path); boolean value = false; if (registry.resourceExists(path)) { value = true; } assertFalse(value, "Resource found at the path"); res1.discard(); resource1.discard(); Thread.sleep(100); } }
@Test(groups = {"wso2.greg"}) public void ContinuousUpdate() throws RegistryException, InterruptedException { int iterations = 100; for (int i = 0; i < iterations; i++) { Resource res1 = registry.newResource(); byte[] r1content = "R2 content".getBytes(); res1.setContent(r1content); String path = "/con-delete/test-update/" + i + 1; registry.put(path, res1); Resource resource1 = registry.get(path); assertEquals( new String((byte[]) resource1.getContent()), new String((byte[]) res1.getContent()), "File content is not matching"); Resource resource = new ResourceImpl(); byte[] r1content1 = "R2 content updated".getBytes(); resource.setContent(r1content1); resource.setProperty("abc", "abc"); registry.put(path, resource); Resource resource2 = registry.get(path); assertEquals( new String((byte[]) resource2.getContent()), new String((byte[]) resource.getContent()), "File content is not matching"); resource.discard(); res1.discard(); resource1.discard(); resource2.discard(); Thread.sleep(100); } }