@Test public void testCreateServers() throws Exception { List<ServerInfo> newServerList = ImmutableList.of( new ServerInfo.Builder() .name("New Server") .memory(new BigInteger("5368709120")) .cpu(3000) .vncPassword("new_password") .build(), new ServerInfo.Builder() .name("Test Server") .memory(new BigInteger("5368709120")) .cpu(3000) .vncPassword("test_password") .build()); createdServers = api.createServers(newServerList); assertEquals(newServerList.size(), createdServers.size()); for (int i = 0; i < newServerList.size(); i++) { checkServer(newServerList.get(i), createdServers.get(i)); } }
.memory(BigInteger.valueOf(vm.getMinRam()).multiply(BigInteger.valueOf(1024 * 1024))) .vncPassword("cloudml") .cpu(vm.getMinCores() * 2600) .nics(ImmutableList.of(nic)) .meta(m)
.cpu((int) hardware.getProcessors().get(0).getSpeed()) .memory(BigInteger.valueOf(hardware.getRam()).multiply(BigInteger.valueOf(1024 * 1024))) .drives(ImmutableList.of(drive.toServerDrive(1, "0:1", options.getDeviceEmulationType())))
.cpu(1000) .cpusInsteadOfCores(false) .drives(ImmutableList.of(
.cpu((int) hardware.getProcessors().get(0).getSpeed()) .memory(BigInteger.valueOf(hardware.getRam()).multiply(BigInteger.valueOf(1024 * 1024))) .drives(ImmutableList.of(drive.toServerDrive(1, "0:1", options.getDeviceEmulationType())))
.uuid("a19a425f-9e92-42f6-89fb-6361203071bb") .name("jclouds-cloudsigma-test_acc_full_server") .cpu(1000) .memory(new BigInteger("268435456")) .status(ServerStatus.STOPPED)
@Test public void testEditServer() throws Exception { String uuid = "a19a425f-9e92-42f6-89fb-6361203071bb"; CloudSigma2Api api = requestSendsResponse( putBuilder() .endpoint(endpoint + "servers/" + uuid + "/") .payload(payloadFromResourceWithContentType("/servers-create-request.json", MediaType.APPLICATION_JSON)) .build(), responseBuilder() .payload(payloadFromResourceWithContentType("/servers-single.json", MediaType.APPLICATION_JSON)) .build()); ServerInfo result = api.editServer(uuid, new ServerInfo.Builder() .name("testServerAcc") .cpu(100) .memory(new BigInteger("536870912")) .vncPassword("testserver") .build()); assertNotNull(result); }
@Test public void testCreateServer() throws Exception { CloudSigma2Api api = requestSendsResponse( postBuilder() .endpoint(endpoint + "servers/") .payload(payloadFromResourceWithContentType("/servers-create-request.json" , MediaType.APPLICATION_JSON)) .build(), responseBuilder() .payload(payloadFromResourceWithContentType("/servers-single.json", MediaType.APPLICATION_JSON)) .build()); ServerInfo result = api.createServer(new ServerInfo.Builder() .cpu(100) .memory(new BigInteger("536870912")) .name("testServerAcc") .vncPassword("testserver") .build()); assertNotNull(result); }
@Test(dependsOnMethods = {"testCreateServer"}) public void testEditServer() throws Exception { ServerInfo serverInfo = new ServerInfo.Builder() .name("Edited Server") .memory(new BigInteger("5368709120")) .cpu(2000) .vncPassword("edited_password") .build(); checkServer(serverInfo, api.editServer(createdServer.getUuid(), serverInfo)); }
@Test public void testCreateServer() throws Exception { ServerInfo serverInfo = new ServerInfo.Builder() .name("New Server") .memory(new BigInteger("5368709120")) .cpu(3000) .vncPassword("new_password") .drives(ImmutableList.of(api.listDrives().concat().get(0).toServerDrive(1, "0:1", DeviceEmulationType.IDE))) .build(); createdServer = api.createServer(serverInfo); checkServer(serverInfo, createdServer); }