Package com.abiquo.server.core.cloud

Examples of com.abiquo.server.core.cloud.VirtualMachineDto


      virtualAppliance.setName("VA");
      return virtualAppliance;
   }

   public static VirtualMachineDto virtualMachinePost() {
      VirtualMachineDto virtualMachine = new VirtualMachineDto();
      virtualMachine.setName("VM");
      return virtualMachine;
   }
View Full Code Here


            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/price"));
      return virtualAppliance;
   }

   public static VirtualMachineDto virtualMachinePut() {
      VirtualMachineDto virtualMachine = virtualMachinePost();
      virtualMachine.setId(1);
      virtualMachine.addLink(new RESTLink("deploy",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/deploy"));
      virtualMachine.addLink(new RESTLink("disks",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/disks"));
      virtualMachine.addLink(new RESTLink("edit",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1"));
      virtualMachine.addLink(new RESTLink("state",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/state"));
      virtualMachine.addLink(new RESTLink("reset",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/reset"));
      virtualMachine.addLink(new RESTLink("tasks",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks"));
      virtualMachine.addLink(new RESTLink("undeploy",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/undeploy"));
      virtualMachine.addLink(new RESTLink("persistent",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/persistent"));
      virtualMachine.addLink(new RESTLink("virtualappliance",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1"));
      virtualMachine.addLink(new RESTLink("virtualmachinetemplate",
            "http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1"));
      virtualMachine.addLink(new RESTLink("nics",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/network/nics"));
      virtualMachine.addLink(new RESTLink("volumes",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/volumes"));
      virtualMachine
            .addLink(new RESTLink("configurations",
                  "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/network/configurations"));
      return virtualMachine;
   }
View Full Code Here

      binder.bindToRequest(HttpRequest.builder().method("m").endpoint("http://localhost").build(), new Object());
   }

   @Test(expectedExceptions = NullPointerException.class)
   public void testInvalidNullInput() throws SecurityException, NoSuchMethodException {
      VirtualMachineDto vm = CloudResources.virtualMachinePut();

      Invokable<?, ?> method = method(TestNetworkConfig.class, "withAll", VirtualMachineDto.class, VLANNetworkDto.class);
      GeneratedHttpRequest request = GeneratedHttpRequest.builder()
            .invocation(Invocation.create(method, Lists.<Object> newArrayList(vm, null))).method(HttpMethod.GET)
            .endpoint(URI.create("http://localhost")).build();
View Full Code Here

      binder.bindToRequest(request, null);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testInvalidTypeInput() throws SecurityException, NoSuchMethodException {
      VirtualMachineDto vm = CloudResources.virtualMachinePut();
      Object network = new Object();

      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)
View Full Code Here

      BindNetworkConfigurationRefToPayload binder = new BindNetworkConfigurationRefToPayload(new JAXBParser("false"));
      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

TOP

Related Classes of com.abiquo.server.core.cloud.VirtualMachineDto

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.