@Override public boolean apply(VirtualMachine input) { return vmName.equals(input.getDisplayName()); } });
@Override public boolean apply(VirtualMachine input) { return vmName.equals(input.getDisplayName()); } });
@Test(dependsOnMethods = "testCreateVirtualMachine") public void testVirtualMachineUpdate() throws Exception { UpdateVirtualMachineOptions options = UpdateVirtualMachineOptions.Builder.displayName("updated-name"); String job = client.getVirtualMachineApi().updateVirtualMachine(vm.getId(), options); assertTrue(jobComplete.apply(job)); vm = client.getVirtualMachineApi().getVirtualMachine(vm.getId()); assertEquals(vm.getDisplayName(), "updated-name"); }
builder.hostname(from.getDisplayName()); builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(from.getZoneId())).orNull()); if (from.getGroup() != null) { builder.group(from.getGroup()); } else if (from.getDisplayName() != null) { builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getDisplayName()));
builder.hostname(from.getDisplayName()); builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(from.getZoneId())).orNull()); builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getDisplayName())); Image image = FluentIterable.from(images.get()).firstMatch(new Predicate<Image>() { @Override
builder.hostname(from.getDisplayName()); builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(from.getZoneId())).orNull()); builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getDisplayName())); Image image = FluentIterable.from(images.get()).firstMatch(new Predicate<Image>() { @Override
@Test public void testCreateNodeWithGroupEncodedIntoName() { String group = prefix + "-foo"; String name = group + "-node-" + new Random().nextInt(); Template template = view.getComputeService().templateBuilder().build(); if (!client .getTemplateClient() .getTemplateInZone(template.getImage().getId(), template.getLocation().getId()).isPasswordEnabled()) { // TODO: look at SecurityGroupClientLiveTest for how to do this template.getOptions().as(CloudStackTemplateOptions.class).keyPair(keyPairName); } vm = adapter.createNodeWithGroupEncodedIntoName(group, name, template); assertEquals(vm.getNode().getDisplayName(), name); // check to see if we setup a NAT rule (conceding we could check this from // cache) IPForwardingRule rule = getFirst( client.getNATClient().getIPForwardingRulesForVirtualMachine(vm.getNode().getId()), null); String address = rule != null ? rule.getIPAddress() : vm.getNode().getIPAddress(); loginCredentials = prioritizeCredentialsFromTemplate.apply(template, vm.getCredentials()); assert InetAddresses.isInetAddress(address) : vm; HostAndPort socket = HostAndPort.fromParts(address, 22); checkSSH(socket); }
@Test public void testCreateNodeWithGroupEncodedIntoName() { String group = prefix + "-foo"; String name = group + "-node-" + new Random().nextInt(); Template template = view.getComputeService().templateBuilder().build(); if (!client .getTemplateApi() .getTemplateInZone(template.getImage().getId(), template.getLocation().getId()).isPasswordEnabled()) { // TODO: look at SecurityGroupApiLiveTest for how to do this template.getOptions().as(CloudStackTemplateOptions.class).keyPair(keyPairName); } vm = adapter.createNodeWithGroupEncodedIntoName(group, name, template); assertEquals(vm.getNode().getDisplayName(), name); // check to see if we setup a NAT rule (conceding we could check this from // cache) IPForwardingRule rule = getFirst( client.getNATApi().getIPForwardingRulesForVirtualMachine(vm.getNode().getId()), null); String address = rule != null ? rule.getIPAddress() : vm.getNode().getIPAddress(); loginCredentials = prioritizeCredentialsFromTemplate.apply(template, vm.getCredentials()); assert InetAddresses.isInetAddress(address) : vm; HostAndPort socket = HostAndPort.fromParts(address, 22); checkSSH(socket); }
assert vm.getId() != null : vm; assert vm.getName() != null : vm; assert vm.getDisplayName() != null : vm; assert vm.getAccount() != null : vm; assert vm.getDomain() != null : vm;
.cpuSpeed(in.getCpuSpeed()) .cpuUsed(in.getCpuUsedAsString()) .displayName(in.getDisplayName()) .created(in.getCreated()) .domain(in.getDomain())
.cpuSpeed(in.getCpuSpeed()) .cpuUsed(in.getCpuUsedAsString()) .displayName(in.getDisplayName()) .created(in.getCreated()) .domain(in.getDomain())
.cpuSpeed(in.getCpuSpeed()) .cpuUsed(in.getCpuUsedAsString()) .displayName(in.getDisplayName()) .created(in.getCreated()) .domain(in.getDomain())