Package com.abiquo.model.rest

Examples of com.abiquo.model.rest.RESTLink


      DatacentersLimitsDto limits = context.getApi().getEnterpriseApi().listLimits(target);

      return Iterables.find(limits.getCollection(), new Predicate<DatacenterLimitsDto>() {
         @Override
         public boolean apply(final DatacenterLimitsDto input) {
            RESTLink datacenterLink = input.searchLink("datacenter");
            return datacenterLink != null
                  && datacenterLink.getHref().equals(datacenter.unwrap().getEditLink().getHref());
         }
      });
   }
View Full Code Here


* @author Ignasi Barrera
*/
@Test(groups = "unit", testName = "AbiquoApiTest")
public class AbiquoApiTest extends BaseAbiquoApiTest<AbiquoApi> {
   public void testGet() throws SecurityException, NoSuchMethodException, IOException {
      RESTLink link = new RESTLink("edit", "http://foo/bar");
      link.setType(DatacentersDto.BASE_MEDIA_TYPE);

      Invokable<?, ?> method = method(AbiquoApi.class, "get", RESTLink.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(link)));

      assertRequestLineEquals(request, "GET http://foo/bar HTTP/1.1");
View Full Code Here

      binder.getNewEndpoint(null, new Object());
   }

   public void testGetNewEnpoint() {
      BindLinkToPath binder = new BindLinkToPath();
      assertEquals(binder.getNewEndpoint(null, new RESTLink("edit", "http://foo/bar")), "http://foo/bar");
   }
View Full Code Here

   public void setEnterprise(final Enterprise enterprise) {
      checkNotNull(enterprise, ValidationErrors.NULL_RESOURCE + Enterprise.class);
      checkNotNull(enterprise.getId(), ValidationErrors.MISSING_REQUIRED_FIELD + " id in " + Enterprise.class);

      RESTLink link = enterprise.unwrap().searchLink("edit");

      checkNotNull(link, ValidationErrors.MISSING_REQUIRED_LINK);

      target.addLink(new RESTLink("enterprise", link.getHref()));
   }
View Full Code Here

   private void addPrivilege(final Privilege privilege) {
      checkNotNull(privilege, ValidationErrors.NULL_RESOURCE + Privilege.class);
      checkNotNull(privilege.getId(), ValidationErrors.MISSING_REQUIRED_FIELD + " id in " + Privilege.class);

      RESTLink link = privilege.unwrap().searchLink("self");

      // rel would be "privilege" if the object is coming from a privilege list.
      if (link == null) {
         link = privilege.unwrap().searchLink("privilege");
      }

      checkNotNull(link, ValidationErrors.MISSING_REQUIRED_LINK);

      target.addLink(new RESTLink("privilege" + privilege.getId(), link.getHref()));
   }
View Full Code Here

   }

   // Parent access

   public Datacenter getDatacenter() {
      RESTLink link = checkNotNull(target.searchLink(ParentLinkName.DATACENTER), ValidationErrors.MISSING_REQUIRED_LINK
            + " " + ParentLinkName.DATACENTER);

      HttpResponse response = context.getApi().get(link);

      ParseXMLWithJAXB<DatacenterDto> parser = new ParseXMLWithJAXB<DatacenterDto>(context.utils().xml(),
View Full Code Here

         dto.setDefaultNetwork(defaultNetwork);
         dto.setUnmanaged(false);
         dto.setType(NetworkType.PUBLIC);

         NetworkServiceType nst = networkServiceType.or(datacenter.defaultNetworkServiceType());
         dto.addLink(new RESTLink("networkservicetype", nst.unwrap().getEditLink().getHref()));

         PublicNetwork network = new PublicNetwork(context, dto);
         network.datacenter = datacenter;

         return network;
View Full Code Here

      DatacentersLimitsDto limits = context.getApi().getEnterpriseApi().listLimits(target);

      return Iterables.find(limits.getCollection(), new Predicate<DatacenterLimitsDto>() {
         @Override
         public boolean apply(final DatacenterLimitsDto input) {
            RESTLink datacenterLink = input.searchLink("datacenter");
            return datacenterLink != null
                  && datacenterLink.getHref().equals(datacenter.unwrap().getEditLink().getHref());
         }
      });
   }
View Full Code Here

   // Domain operations

   @Override
   public PrivateNetwork getNetwork() {
      RESTLink link = checkNotNull(target.searchLink(ParentLinkName.PRIVATE_NETWORK),
            ValidationErrors.MISSING_REQUIRED_LINK + " " + ParentLinkName.PRIVATE_NETWORK);

      HttpResponse response = context.getApi().get(link);

      ParseXMLWithJAXB<VLANNetworkDto> parser = new ParseXMLWithJAXB<VLANNetworkDto>(context.utils().xml(),
View Full Code Here

         dto.setPublicIPLimits(publicIpsSoft, publicIpsHard);
         dto.setRepositoryHardLimitsInMb(repositoryHard);
         dto.setRepositorySoftLimitsInMb(repositorySoft);

         // Establish the relation with the physical datacenter
         dto.addLink(new RESTLink(ParentLinkName.DATACENTER, checkNotNull(datacenter.unwrap().getEditLink(),
                 "missing edit link").getHref()));

         Limits limits = new Limits(context, dto);

         return limits;
View Full Code Here

TOP

Related Classes of com.abiquo.model.rest.RESTLink

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.