Package org.jclouds.abiquo.domain.enterprise

Examples of org.jclouds.abiquo.domain.enterprise.Role$Builder


      assertNotNull(storagePool.getUUID());
   }

   protected void createUsers() {
      Iterable<Role> roles = administrationService.listRoles();
      Role userRole = find(roles, role("USER"));
      Role enterpriseAdminRole = find(roles, role("ENTERPRISE_ADMIN"));

      user = User.builder(context.getApiContext(), enterprise, userRole).name(randomName(), randomName())
            .nick("jclouds").authType("ABIQUO").description(randomName()).email(randomName() + "@abiquo.com")
            .locale("en_US").password("user").build();

      user.save();
      assertNotNull(user.getId());
      assertEquals(userRole.getId(), user.getRole().getId());

      enterpriseAdmin = User.builder(context.getApiContext(), enterprise, enterpriseAdminRole)
            .name(randomName(), randomName()).nick("jclouds-admin").authType("ABIQUO").description(randomName())
            .email(randomName() + "@abiquo.com").locale("en_US").password("admin").build();

      enterpriseAdmin.save();
      assertNotNull(enterpriseAdmin.getId());
      assertEquals(enterpriseAdminRole.getId(), enterpriseAdmin.getRole().getId());
   }
View Full Code Here


*/
@Test(groups = "api", testName = "RoleLiveApiTest")
public class RoleLiveApiTest extends BaseAbiquoApiLiveApiTest {

   public void testUpdate() {
      Role role = Role.builder(env.context.getApiContext()).name("dummyRoleUpdateRole").blocked(false).build();
      role.save();

      role.setName("UPDATED_ROLE");
      role.update();

      // Recover the updated role
      RoleDto updated = env.adminApi.getRole(role.getId());

      assertEquals(updated.getName(), "UPDATED_ROLE");

      role.delete();
   }
View Full Code Here

      role.delete();
   }

   public void testCreateRepeated() {
      Role repeated = Role.Builder.fromRole(env.role).build();

      try {
         repeated.save();
         fail("Should not be able to create roles with the same name");
      } catch (AbiquoException ex) {
         assertHasError(ex, Status.CONFLICT, "ROLE-7");
      }
   }
View Full Code Here

         assertHasError(ex, Status.CONFLICT, "ROLE-7");
      }
   }

   public void testCreateEnterpriseRole() {
      final Role entRole = Role.Builder.fromRole(env.role).build();
      entRole.setName(entRole.getName() + "enterprise");
      entRole.setEnterprise(env.enterprise);
      entRole.save();

      find(env.enterprise.listRoles(), new Predicate<Role>() {
         @Override
         public boolean apply(Role input) {
            return input.getName().equals(entRole.getName());
         }
      });
   }
View Full Code Here

*/
@Test(groups = "api", testName = "RoleLiveApiTest")
public class RoleLiveApiTest extends BaseAbiquoApiLiveApiTest {

   public void testUpdate() {
      Role role = Role.builder(env.context.getApiContext()).name("dummyRoleUpdateRole").blocked(false).build();
      role.save();

      role.setName("UPDATED_ROLE");
      role.update();

      // Recover the updated role
      RoleDto updated = env.adminApi.getRole(role.getId());

      assertEquals(updated.getName(), "UPDATED_ROLE");

      role.delete();
   }
View Full Code Here

      role.delete();
   }

   public void testCreateRepeated() {
      Role repeated = Role.Builder.fromRole(env.role).build();

      try {
         repeated.save();
         fail("Should not be able to create roles with the same name");
      } catch (AbiquoException ex) {
         assertHasError(ex, Status.CONFLICT, "ROLE-7");
      }
   }
View Full Code Here

         assertHasError(ex, Status.CONFLICT, "ROLE-7");
      }
   }

   public void testCreateEnterpriseRole() {
      final Role entRole = Role.Builder.fromRole(env.role).build();
      entRole.setName(entRole.getName() + "enterprise");
      entRole.setEnterprise(env.enterprise);
      entRole.save();

      find(env.enterprise.listRoles(), new Predicate<Role>() {
         @Override
         public boolean apply(Role input) {
            return input.getName().equals(entRole.getName());
         }
      });
   }
View Full Code Here

      assertNotNull(storagePool.getUUID());
   }

   protected void createUsers() {
      Iterable<Role> roles = administrationService.listRoles();
      Role userRole = find(roles, role("USER"));
      Role enterpriseAdminRole = find(roles, role("ENTERPRISE_ADMIN"));

      user = User.builder(context.getApiContext(), enterprise, userRole).name(randomName(), randomName())
            .nick("jclouds").authType("ABIQUO").description(randomName()).email(randomName() + "@abiquo.com")
            .locale("en_US").password("user").build();

      user.save();
      assertNotNull(user.getId());
      assertEquals(userRole.getId(), user.getRole().getId());

      enterpriseAdmin = User.builder(context.getApiContext(), enterprise, enterpriseAdminRole)
            .name(randomName(), randomName()).nick("jclouds-admin").authType("ABIQUO").description(randomName())
            .email(randomName() + "@abiquo.com").locale("en_US").password("admin").build();

      enterpriseAdmin.save();
      assertNotNull(enterpriseAdmin.getId());
      assertEquals(enterpriseAdminRole.getId(), enterpriseAdmin.getRole().getId());
   }
View Full Code Here

      assertNotNull(storagePool.getUUID());
   }

   protected void createUsers() {
      Role userRole = administrationService.findRole(RolePredicates.name("USER"));
      Role enterpriseAdminRole = administrationService.findRole(RolePredicates.name("ENTERPRISE_ADMIN"));

      user = User.builder(context.getApiContext(), enterprise, userRole).name(randomName(), randomName())
            .nick("jclouds").authType("ABIQUO").description(randomName()).email(randomName() + "@abiquo.com")
            .locale("en_US").password("user").build();

      user.save();
      assertNotNull(user.getId());
      assertEquals(userRole.getId(), user.getRole().getId());

      enterpriseAdmin = User.builder(context.getApiContext(), enterprise, enterpriseAdminRole)
            .name(randomName(), randomName()).nick("jclouds-admin").authType("ABIQUO").description(randomName())
            .email(randomName() + "@abiquo.com").locale("en_US").password("admin").build();

      enterpriseAdmin.save();
      assertNotNull(enterpriseAdmin.getId());
      assertEquals(enterpriseAdminRole.getId(), enterpriseAdmin.getRole().getId());
   }
View Full Code Here

*/
@Test(groups = "api", testName = "RoleLiveApiTest")
public class RoleLiveApiTest extends BaseAbiquoApiLiveApiTest {

   public void testUpdate() {
      Role role = Role.builder(env.context.getApiContext()).name("dummyRoleUpdateRole").blocked(false).build();
      role.save();

      role.setName("UPDATED_ROLE");
      role.update();

      // Recover the updated role
      RoleDto updated = env.adminApi.getRole(role.getId());

      assertEquals(updated.getName(), "UPDATED_ROLE");

      role.delete();
   }
View Full Code Here

TOP

Related Classes of org.jclouds.abiquo.domain.enterprise.Role$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.