Package com.abiquo.server.core.enterprise

Examples of com.abiquo.server.core.enterprise.EnterpriseDto


   }

   @Test(expectedExceptions = NullPointerException.class)
   public void testInvalidId() {
      Function<Object, String> parser = new ParseEnterpriseId();
      parser.apply(new EnterpriseDto());
   }
View Full Code Here


   }

   public void testValidId() {
      Function<Object, String> parser = new ParseEnterpriseId();

      EnterpriseDto enterprise = new EnterpriseDto();
      enterprise.setId(5);
      assertEquals(parser.apply(enterprise), "5");
   }
View Full Code Here

      return wrap(context, Enterprise.class, result.toPagedIterable().concat());
   }

   @Override
   public Enterprise getEnterprise(final Integer enterpriseId) {
      EnterpriseDto enterprise = context.getApi().getEnterpriseApi().getEnterprise(enterpriseId);
      return wrap(context, Enterprise.class, enterprise);
   }
View Full Code Here

   public Enterprise getOwnerEnterprise() {
      if (!isReserved()) {
         return null;
      }

      EnterpriseDto enterprise = context.getApi().getEnterpriseApi()
            .getEnterprise(target.getIdFromLink(ParentLinkName.ENTERPRISE));

      return wrap(context, Enterprise.class, enterprise);
   }
View Full Code Here

                  .payload(
                        payloadFromResourceWithContentType("/payloads/users-lastpage.xml",
                              normalize(UsersDto.MEDIA_TYPE))) //
                  .build());

      EnterpriseDto enterprise = new EnterpriseDto();
      enterprise.addLink(new RESTLink("users", "http://localhost/api/admin/enterprises/1/users"));

      PagedIterable<UserDto> result = api.listUsers(enterprise);
      List<UserDto> all = result.concat().toList();

      assertEquals(all.size(), 3);
View Full Code Here

                  .payload(
                        payloadFromResourceWithContentType("/payloads/users-lastpage.xml",
                              normalize(UsersDto.MEDIA_TYPE))) //
                  .build());

      EnterpriseDto enterprise = new EnterpriseDto();
      enterprise.addLink(new RESTLink("users", "http://localhost/api/admin/enterprises/1/users"));

      UserOptions options = UserOptions.builder().page(1).build();
      PaginatedCollection<UserDto, UsersDto> result = api.listUsers(enterprise, options);

      assertEquals(result.size(), 1);
View Full Code Here

/**
* Enterprise domain utilities.
*/
public class EnterpriseResources {
   public static EnterpriseDto enterprisePost() {
      EnterpriseDto enterprise = new EnterpriseDto();
      enterprise.setName("Kalakaua");
      return enterprise;
   }
View Full Code Here

      enterprise.setName("Kalakaua");
      return enterprise;
   }

   public static EnterpriseDto enterprisePut() {
      EnterpriseDto enterprise = enterprisePost();
      enterprise.setId(1);
      enterprise.addLink(new RESTLink("edit", "http://localhost/api/admin/enterprises/1"));
      enterprise.addLink(new RESTLink("limits", "http://localhost/api/admin/enterprises/1/limits"));
      enterprise.addLink(new RESTLink("users", "http://localhost/api/admin/enterprises/1/users"));
      enterprise.addLink(new RESTLink("properties", "http://localhost/api/admin/enterprises/1/properties"));
      enterprise.addLink(new RESTLink("reservedmachines", "http://localhost/api/admin/enterprises/1/reservedmachines"));
      enterprise.addLink(new RESTLink("datacenterrepositories",
            "http://localhost/api/admin/enterprises/1/datacenterrepositories"));
      enterprise.addLink(new RESTLink("externalnetworks",
            "http://localhost/api/admin/enterprises/1/action/externalnetworks"));
      enterprise.addLink(new RESTLink("virtualmachines",
            "http://localhost/api/admin/enterprises/1/action/virtualmachines"));
      enterprise.addLink(new RESTLink("cloud/virtualdatacenters",
            "http://localhost/api/admin/enterprises/1/action/virtualdatacenters"));
      enterprise.addLink(new RESTLink("virtualappliances",
            "http://localhost/api/admin/enterprises/1/action/virtualappliances"));
      enterprise.addLink(new RESTLink("appslib/templateDefinitionLists",
            "http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists"));

      return enterprise;
   }
View Full Code Here

   public void testUpdate() {
      enterprise.setName("Updated Enterprise");
      enterprise.update();

      // Recover the updated enterprise
      EnterpriseDto updated = env.enterpriseApi.getEnterprise(enterprise.getId());

      assertEquals(updated.getName(), "Updated Enterprise");
   }
View Full Code Here

    *      > http://community.abiquo.com/display/ABI20/Enterprise+Resource#
    *      EnterpriseResource- RetrieveaEnterprise</a>
    */
   public Enterprise getEnterprise() {
      Integer enterpriseId = target.getIdFromLink(ParentLinkName.ENTERPRISE);
      EnterpriseDto dto = context.getApi().getEnterpriseApi().getEnterprise(enterpriseId);
      return wrap(context, Enterprise.class, dto);
   }
View Full Code Here

TOP

Related Classes of com.abiquo.server.core.enterprise.EnterpriseDto

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.