Package com.abiquo.server.core.infrastructure.network

Examples of com.abiquo.server.core.infrastructure.network.VLANNetworkDto


      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, new Object());
   }

   public void testBindNetworkRef() throws IOException {
      VLANNetworkDto network = NetworkResources.privateNetworkPut();
      BindNetworkRefToPayload binder = new BindNetworkRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, network);
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + network.getEditLink().getHref()
            + "\" rel=\"internalnetwork\"/></links>"), LinksDto.class);
   }
View Full Code Here


      binder.bindToRequest(request, network);
   }

   @Test(expectedExceptions = NoSuchElementException.class)
   public void testBindNetworkConfigurationRefWithoutVirtualMachine() throws SecurityException, NoSuchMethodException {
      VLANNetworkDto network = NetworkResources.privateNetworkPut();

      Invokable<?, ?> method = method(TestNetworkConfig.class, "withoutVirtualMachine", VLANNetworkDto.class);
      GeneratedHttpRequest request = GeneratedHttpRequest.builder()
            .invocation(Invocation.create(method, ImmutableList.<Object> of(network))).method(HttpMethod.GET)
            .endpoint(URI.create("http://localhost")).build();
View Full Code Here

      binder.bindToRequest(request, network);
   }

   public void testBindNetworkConfigurationRef() throws SecurityException, NoSuchMethodException, IOException {
      VirtualMachineDto vm = CloudResources.virtualMachinePut();
      VLANNetworkDto network = NetworkResources.privateNetworkPut();

      Invokable<?, ?> method = method(TestNetworkConfig.class, "withAll", VirtualMachineDto.class, VLANNetworkDto.class);
      GeneratedHttpRequest request = GeneratedHttpRequest.builder()
            .invocation(Invocation.create(method, ImmutableList.<Object> of(vm, network))).method(HttpMethod.GET)
            .endpoint(URI.create("http://localhost")).build();

      BindNetworkConfigurationRefToPayload binder = new BindNetworkConfigurationRefToPayload(new JAXBParser("false"));

      String configLink = vm.searchLink("configurations").getHref() + "/" + network.getId();

      GeneratedHttpRequest newRequest = binder.bindToRequest(request, network);
      assertPayloadEquals(newRequest.getPayload(), withHeader("<links><link href=\"" + configLink
            + "\" rel=\"network_configuration\"/></links>"), LinksDto.class);
   }
View Full Code Here

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, new Object());
   }

   public void testBindUnmanagedNetworkIpRef() throws IOException {
      VLANNetworkDto network = NetworkResources.unmanagedNetworkPut();
      RESTLink ipsLink = network.searchLink("ips");
      BindUnmanagedIpRefToPayload binder = new BindUnmanagedIpRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, network);
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + ipsLink.getHref()
            + "\" rel=\"unmanagedip\"/></links>"), LinksDto.class);
View Full Code Here

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

      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.addLink(new RESTLink("ips", "http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips"));

      PagedIterable<PrivateIpDto> privateIps = api.listPrivateNetworkIps(vlan);
      List<PrivateIpDto> ips = privateIps.concat().toList();

      assertEquals(ips.size(), 2);
View Full Code Here

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

      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.addLink(new RESTLink("ips", "http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips"));

      IpOptions options = IpOptions.builder().startWith(1).build();
      PaginatedCollection<PrivateIpDto, PrivateIpsDto> ips = api.listPrivateNetworkIps(vlan, options);

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

   public void testSetGatewayNetwork() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(CloudApi.class, "setGatewayNetwork", VirtualMachineDto.class,
            VLANNetworkDto.class);

      VirtualMachineDto vm = CloudResources.virtualMachinePut();
      VLANNetworkDto network = NetworkResources.privateNetworkPut();

      GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(vm, network)));

      String configLink = vm.searchLink("configurations").getHref() + "/" + network.getId();

      assertRequestLineEquals(
            request,
            "PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/network/configurations HTTP/1.1");
      assertNonPayloadHeadersEqual(request, "");
View Full Code Here

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

      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/datacenters/1/network/1/ips"));

      PagedIterable<PublicIpDto> publicIps = api.listPublicIps(vlan);
      List<PublicIpDto> ips = publicIps.concat().toList();

      assertEquals(ips.size(), 4);
View Full Code Here

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

      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/datacenters/1/network/1/ips"));

      IpOptions options = IpOptions.builder().startWith(3).build();
      PaginatedCollection<PublicIpDto, PublicIpsDto> ips = api.listPublicIps(vlan, options);

      assertEquals(ips.size(), 2);
View Full Code Here

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

      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/enterprises/2/limits/2/externalnetworks/2/ips"));

      PagedIterable<ExternalIpDto> publicIps = api.listExternalIps(vlan);
      List<ExternalIpDto> ips = publicIps.concat().toList();

      assertEquals(ips.size(), 4);
View Full Code Here

TOP

Related Classes of com.abiquo.server.core.infrastructure.network.VLANNetworkDto

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.