Package com.abiquo.server.core.enterprise

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


      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


   }

   /*********************** Enterprise Limits ********************** */

   public void testCreateLimits() throws SecurityException, NoSuchMethodException, IOException {
      EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
      DatacenterDto datacenter = InfrastructureResources.datacenterPut();
      DatacenterLimitsDto limits = EnterpriseResources.datacenterLimitsPost();

      Invokable<?, ?> method = method(EnterpriseApi.class, "createLimits", EnterpriseDto.class, DatacenterDto.class,
            DatacenterLimitsDto.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(enterprise, datacenter, limits)));

      String limitsUri = enterprise.searchLink("limits").getHref();
      String requestURI = String.format("POST %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId());

      assertRequestLineEquals(request, requestURI);
      assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterLimitsDto.BASE_MEDIA_TYPE + "\n");
      assertPayloadEquals(request, withHeader(EnterpriseResources.datacenterLimitsPostPayload()),
View Full Code Here

      checkFilters(request);
   }

   public void testGetLimits() throws SecurityException, NoSuchMethodException, IOException {
      EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
      DatacenterDto datacenter = InfrastructureResources.datacenterPut();

      Invokable<?, ?> method = method(EnterpriseApi.class, "getLimits", EnterpriseDto.class, DatacenterDto.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(enterprise, datacenter)));

      String limitsUri = enterprise.searchLink("limits").getHref();
      String requestURI = String.format("GET %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId());

      assertRequestLineEquals(request, requestURI);
      assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersLimitsDto.BASE_MEDIA_TYPE + "\n");
      assertPayloadEquals(request, null, null, false);
View Full Code Here

      checkFilters(request);
   }

   public void testUpdateLimits() throws SecurityException, NoSuchMethodException, IOException {
      EnterpriseDto enterprise = EnterpriseResources.enterprisePut();

      Invokable<?, ?> method = method(EnterpriseApi.class, "updateLimits", DatacenterLimitsDto.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(EnterpriseResources.datacenterLimitsPut(enterprise))));
View Full Code Here

      checkFilters(request);
   }

   public void testDeleteLimits() throws SecurityException, NoSuchMethodException {
      EnterpriseDto enterprise = EnterpriseResources.enterprisePut();

      Invokable<?, ?> method = method(EnterpriseApi.class, "deleteLimits", DatacenterLimitsDto.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(EnterpriseResources.datacenterLimitsPut(enterprise))));
View Full Code Here

      checkFilters(request);
   }

   public void testCreateUser() throws SecurityException, NoSuchMethodException, IOException {
      EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
      UserDto user = EnterpriseResources.userPost();

      Invokable<?, ?> method = method(EnterpriseApi.class, "createUser", EnterpriseDto.class, UserDto.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(enterprise, user)));
View Full Code Here

      checkFilters(request);
   }

   public void testCreateTemplateDefinitionList() throws SecurityException, NoSuchMethodException, IOException {
      EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
      TemplateDefinitionListDto template = EnterpriseResources.templateListPost();

      Invokable<?, ?> method = method(EnterpriseApi.class, "createTemplateDefinitionList", EnterpriseDto.class,
            TemplateDefinitionListDto.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
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

    *      EnterpriseResource- RetrieveanEnterprise</a>
    * @return Enterprise of this virtual machine.
    */
   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.