public void testServerStatus() { CloudSigma2Api api = EasyMock.createMock(CloudSigma2Api.class); expect(api.getServerInfo("one")).andReturn(new ServerInfo.Builder().status(STOPPED).build()); expect(api.getServerInfo("two")).andReturn(new ServerInfo.Builder().status(STOPPING).build()); replay(api); ServerStatusPredicate predicate = new ServerStatusPredicate(api, STOPPED); assertTrue(predicate.apply("one")); assertFalse(predicate.apply("two")); verify(api); }
@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)); } }
org.jclouds.cloudsigma2.domain.ServerInfo serverToCreate = new org.jclouds.cloudsigma2.domain.ServerInfo.Builder() .name(a.getName()) .memory(BigInteger.valueOf(vm.getMinRam()).multiply(BigInteger.valueOf(1024 * 1024)))
meta.put("description", "A full server with description"); input = new ServerInfo.Builder() .cpu(1000) .cpusInsteadOfCores(false)
logger.debug(">> creating server..."); serverInfo = api.createServer(new ServerInfo.Builder() .name(name) .cpu((int) hardware.getProcessors().get(0).getSpeed())
logger.debug(">> creating server..."); serverInfo = api.createServer(new ServerInfo.Builder() .name(name) .cpu((int) hardware.getProcessors().get(0).getSpeed())
.getDefaultEndpoint().get())), ImmutableSet.<String>of()); input = new ServerInfo.Builder() .uuid("a19a425f-9e92-42f6-89fb-6361203071bb") .name("jclouds-cloudsigma-test_acc_full_server")
new ServerInfo.Builder() .cpu(100) .memory(new BigInteger("536870912")) .vncPassword("testserver") .build(), new ServerInfo.Builder() .cpu(100) .memory(new BigInteger("536870912")) .vncPassword("testserver") .build(), new ServerInfo.Builder() .cpu(100) .memory(new BigInteger("536870912"))
public static Builder fromServerInfo(ServerInfo serverInfo) { return new Builder() .uuid(serverInfo.getUuid()) .name(serverInfo.getName()) .resourceUri(serverInfo.getResourceUri()) .owner(serverInfo.getOwner()) .status(serverInfo.getStatus()) .runtime(serverInfo.getRuntime()) .cpusInsteadOfCores(serverInfo.isCpusInsteadOfCores()) .drives(serverInfo.getDrives()) .enableNuma(serverInfo.isNumaEnabled()) .hvRelaxed(serverInfo.isHvRelaxed()) .hvTsc(serverInfo.isHvTsc()) .memory(serverInfo.getMemory()) .meta(serverInfo.getMeta()) .nics(serverInfo.getNics()) .requirements(serverInfo.getRequirements()) .tags(serverInfo.getTags()) .vncPassword(serverInfo.getVncPassword()) .smp(serverInfo.getSmp()); }
public static Builder fromServerInfo(ServerInfo serverInfo) { return new Builder() .uuid(serverInfo.getUuid()) .name(serverInfo.getName()) .resourceUri(serverInfo.getResourceUri()) .owner(serverInfo.getOwner()) .status(serverInfo.getStatus()) .runtime(serverInfo.getRuntime()) .cpusInsteadOfCores(serverInfo.isCpusInsteadOfCores()) .drives(serverInfo.getDrives()) .enableNuma(serverInfo.isNumaEnabled()) .hvRelaxed(serverInfo.isHvRelaxed()) .hvTsc(serverInfo.isHvTsc()) .memory(serverInfo.getMemory()) .meta(serverInfo.getMeta()) .nics(serverInfo.getNics()) .requirements(serverInfo.getRequirements()) .tags(serverInfo.getTags()) .vncPassword(serverInfo.getVncPassword()) .smp(serverInfo.getSmp()); }
public static Builder fromServerInfo(ServerInfo serverInfo) { return new Builder() .uuid(serverInfo.getUuid()) .name(serverInfo.getName()) .resourceUri(serverInfo.getResourceUri()) .owner(serverInfo.getOwner()) .status(serverInfo.getStatus()) .runtime(serverInfo.getRuntime()) .cpusInsteadOfCores(serverInfo.isCpusInsteadOfCores()) .drives(serverInfo.getDrives()) .enableNuma(serverInfo.isNumaEnabled()) .hvRelaxed(serverInfo.isHvRelaxed()) .hvTsc(serverInfo.isHvTsc()) .memory(serverInfo.getMemory()) .meta(serverInfo.getMeta()) .nics(serverInfo.getNics()) .requirements(serverInfo.getRequirements()) .tags(serverInfo.getTags()) .vncPassword(serverInfo.getVncPassword()) .smp(serverInfo.getSmp()); }
@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); }
public static Builder fromServer(Server in) { return new Builder() .uuid(in.getUuid()) .name(in.getName()) .resourceUri(in.getResourceUri()) .owner(in.getOwner()) .status(in.getStatus()) .runtime(in.getRuntime()); }
public static Builder fromServer(Server in) { return new Builder() .uuid(in.getUuid()) .name(in.getName()) .resourceUri(in.getResourceUri()) .owner(in.getOwner()) .status(in.getStatus()) .runtime(in.getRuntime()); }
@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)); }
public static Builder fromServer(Server in) { return new Builder() .uuid(in.getUuid()) .name(in.getName()) .resourceUri(in.getResourceUri()) .owner(in.getOwner()) .status(in.getStatus()) .runtime(in.getRuntime()); }
@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); }