Examples of MachineDto


Examples of com.abiquo.server.core.infrastructure.MachineDto

   }

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

Examples of com.abiquo.server.core.infrastructure.MachineDto

   }

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

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

Examples of com.abiquo.server.core.infrastructure.MachineDto

   public void testUpdate() {
      env.machine.setName("API Machine");
      env.machine.update();

      // Recover the updated machine
      MachineDto updated = env.infrastructureApi.getMachine(env.rack.unwrap(), env.machine.getId());
      assertEquals(updated.getName(), "API Machine");
   }
View Full Code Here

Examples of com.abiquo.server.core.infrastructure.MachineDto

   public void testCheck() {
      MachineState state = env.machine.check();

      // Recover the machine with same state that has been returned
      MachineDto machine = env.infrastructureApi.getMachine(env.rack.unwrap(), env.machine.getId());
      assertEquals(machine.getState(), state);
   }
View Full Code Here

Examples of com.abiquo.server.core.infrastructure.MachineDto

      String pass = Config.get("abiquo.hypervisor.pass");

      MachineState state = env.datacenter.checkMachineState(ip, type, user, pass);

      // Recover the same machine and compare states
      MachineDto machine = env.infrastructureApi.getMachine(env.rack.unwrap(), env.machine.getId());
      assertEquals(machine.getState(), state);
   }
View Full Code Here

Examples of com.abiquo.server.core.infrastructure.MachineDto

    *      > http://community.abiquo.com/display/ABI20/DatacenterResource#
    *      DatacenterResource- Retrieveremotemachineinformation</a>
    */
   public Machine discoverSingleMachine(final String ip, final HypervisorType hypervisorType, final String user,
         final String password, final int port) {
      MachineDto dto = context
            .getApi()
            .getInfrastructureApi()
            .discoverSingleMachine(target, ip, hypervisorType, user, password,
                  MachineOptions.builder().port(port).build());

      // Credentials are not returned by the API
      dto.setUser(user);
      dto.setPassword(password);

      return wrap(context, Machine.class, dto);
   }
View Full Code Here

Examples of com.abiquo.server.core.infrastructure.MachineDto

         this.rack = rack;
         return this;
      }

      public Machine build() {
         MachineDto dto = new MachineDto();
         dto.setName(name);
         dto.setDescription(description);
         dto.setVirtualRamInMb(virtualRamInMb);
         dto.setVirtualRamUsedInMb(virtualRamUsedInMb);
         dto.setVirtualCpuCores(virtualCpuCores);
         dto.setVirtualCpusUsed(virtualCpusUsed);
         if (port != null) {
            dto.setPort(port);
         }
         dto.setIp(ip);
         dto.setIpService(ipService);
         dto.setType(type);
         dto.setUser(user);
         dto.setPassword(password);
         dto.setIpmiIP(ipmiIp);
         dto.setIpmiPassword(ipmiPassword);
         if (ipmiPort != null) {
            dto.setIpmiPort(ipmiPort);
         }
         dto.setIpmiUser(ipmiUser);
         dto.setState(state);

         DatastoresDto datastoresDto = new DatastoresDto();
         datastoresDto.getCollection().addAll(copyOf(unwrap(datastores)));
         dto.setDatastores(datastoresDto);

         NetworkInterfacesDto networkInterfacesDto = new NetworkInterfacesDto();
         networkInterfacesDto.getCollection().addAll(copyOf(unwrap(networkInterfaces)));
         dto.setNetworkInterfaces(networkInterfacesDto);

         Machine machine = new Machine(context, dto);
         machine.rack = rack;

         return machine;
View Full Code Here

Examples of com.abiquo.server.core.infrastructure.MachineDto

      rack.setNrsq(80);
      return rack;
   }

   public static MachineDto machinePost() {
      MachineDto machine = new MachineDto();
      machine.setName("Kamehameha");
      machine.setVirtualCpuCores(3);
      machine.setDescription("A hawaian machine");
      machine.setVirtualRamInMb(512);
      return machine;
   }
View Full Code Here

Examples of com.abiquo.server.core.infrastructure.MachineDto

            "http://localhost/api/admin/datacenters/1/remoteservices/nodecollector"));
      return remoteService;
   }

   public static MachineDto machinePut() {
      MachineDto machine = machinePost();
      machine.setId(1);
      machine.addLink(new RESTLink("edit", "http://localhost/api/admin/datacenters/1/racks/1/machines/1"));
      machine.addLink(new RESTLink("rack", "http://localhost/api/admin/datacenters/1/racks/1"));
      machine.addLink(new RESTLink("checkstate",
            "http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/checkstate"));
      machine.addLink(new RESTLink("checkipmistate",
            "http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/checkipmistate"));
      machine.addLink(new RESTLink("led", "http://localhost/api/admin/datacenters/1/racks/1/machines/1/led"));
      machine.addLink(new RESTLink("ledoff",
            "http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/ledoff"));
      machine
            .addLink(new RESTLink("ledon", "http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/ledon"));
      machine.addLink(new RESTLink("logicserver",
            "http://localhost/api/admin/datacenters/1/racks/1/machines/1/logicserver"));
      machine.addLink(new RESTLink("poweroff",
            "http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/poweroff"));
      machine.addLink(new RESTLink("poweron",
            "http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/poweron"));
      machine.addLink(new RESTLink("virtualmachines",
            "http://localhost/api/admin/datacenters/1/racks/1/machines/1/virtualmachines"));
      machine.setVirtualCpuCores(5);

      return machine;
   }
View Full Code Here

Examples of com.abiquo.server.core.infrastructure.MachineDto

   public void testGetValue() {
      AppendMachineIdToPath binder = new AppendMachineIdToPath(new ParseMachineId());
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();

      MachineDto machine = new MachineDto();
      machine.setId(5);
      assertEquals(binder.getValue(request, machine), "5");
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.