@Test
 public void testUpdate() throws Exception {
   repository.create(policy);
   policy.setLabel("new-policy");
   repository.update(policy);
   ResourcePolicy anotherInstance = repository.findById(policy.getId());
   assertEquals("new-policy", anotherInstance.getLabel());
 }
 @Test
 public void testCreateComponentPolicy() throws Exception {
   repository.create(policy);
   for (ComponentPolicy cpuPolicy : cpuPolicies) {
     cpuPolicy.setResourcePolicyId(policy.getId());
     repository.createComponentPolicy(cpuPolicy);
   }
   ResourcePolicy newPolicy = repository.findById(policy.getId());
   assertNotNull(newPolicy.getComponents());
   assertEquals(1, newPolicy.getComponents().length);
 }
  @Test
  public void testUpdateComponentPolicy() throws Exception {
    repository.create(policy);
    for (ComponentPolicy cpuPolicy : cpuPolicies) {
      cpuPolicy.setResourcePolicyId(policy.getId());
      repository.createComponentPolicy(cpuPolicy);
    }
    cpuPolicies[0].setCriteria("new-criteria");
    repository.updateComponentPolicy(cpuPolicies[0]);

    ResourcePolicy newPolicy = repository.findById(policy.getId());
    assertNotNull(newPolicy.getComponents());
    assertEquals(1, newPolicy.getComponents().length);
    assertEquals("new-criteria", newPolicy.getComponents()[0].getCriteria());
  }
 @Test
 public void testDeleteById() throws Exception {
   repository.create(policy);
   repository.deleteById(policy.getId());
   policy.setId(null);
 }
 @Test
 public void testCreate() throws Exception {
   repository.create(policy);
   assertNotNull(policy.getId());
 }