@Override public Set<? extends NodeMetadata> listNodesDetailsMatching(Predicate<? super NodeMetadata> filter) { NodeMetadata result = new NodeMetadataBuilder() .id(nodeId) .credentials(LoginCredentials.builder().identity("dummy").credential("dummy").build()) .loginPort(22) .status(Status.RUNNING) .publicAddresses(ImmutableList.of(nodePublicAddress)) .privateAddresses(ImmutableList.of(nodePrivateAddress)) .build(); return ImmutableSet.copyOf(Iterables.filter(ImmutableList.of(result), filter)); } @Override
@Override public Set<? extends NodeMetadata> listNodesDetailsMatching(Predicate<? super NodeMetadata> filter) { NodeMetadata result = new NodeMetadataBuilder() .id(nodeId) .credentials(LoginCredentials.builder().identity("dummy").credential("dummy").build()) .loginPort(22) .status(Status.RUNNING) .publicAddresses(ImmutableList.of(nodePublicAddress)) .privateAddresses(ImmutableList.of(nodePrivateAddress)) .build(); return ImmutableSet.copyOf(Iterables.filter(ImmutableList.of(result), filter)); } @Override
@Override public NodeMetadata apply(Container container) { String name = cleanUpName(container.name()); String group = nodeNamingConvention.extractGroup(name); NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(container.id()) .name(name) .group(group) .hostname(container.config().hostname()) // TODO Set up hardware .hardware(new HardwareBuilder() .id("") .ram(container.config().memory()) .processor(new Processor(container.config().cpuShares(), container.config().cpuShares())) .build()); builder.status(toPortableStatus.apply(container.state())); builder.loginPort(loginPortForContainer.apply(container).or(NO_LOGIN_PORT)); builder.publicAddresses(getPublicIpAddresses(container)); builder.privateAddresses(getPrivateIpAddresses(container)); builder.location(Iterables.getOnlyElement(locations.get())); String imageId = container.image(); builder.imageId(imageId); if (images.get().containsKey(imageId)) { Image image = images.get().get(imageId); builder.operatingSystem(image.getOperatingSystem()); } return builder.build(); }
@Override public NodeMetadata apply(Container container) { String name = cleanUpName(container.name()); String group = nodeNamingConvention.extractGroup(name); NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(container.id()) .name(name) .group(group) .hostname(container.config().hostname()) // TODO Set up hardware .hardware(new HardwareBuilder() .id("") .ram(container.config().memory()) .processor(new Processor(container.config().cpuShares(), container.config().cpuShares())) .build()); builder.status(toPortableStatus.apply(container.state())); builder.loginPort(loginPortForContainer.apply(container).or(NO_LOGIN_PORT)); builder.publicAddresses(getPublicIpAddresses(container)); builder.privateAddresses(getPrivateIpAddresses(container)); builder.location(Iterables.getOnlyElement(locations.get())); String imageId = container.image(); builder.imageId(imageId); if (images.get().containsKey(imageId)) { Image image = images.get().get(imageId); builder.operatingSystem(image.getOperatingSystem()); } return builder.build(); }
@Override public NodeMetadata apply(Container container) { String name = cleanUpName(container.name()); String group = nodeNamingConvention.extractGroup(name); NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(container.id()) .name(name) .group(group) .hostname(container.config().hostname()) // TODO Set up hardware .hardware(new HardwareBuilder() .id("") .ram(container.config().memory()) .processor(new Processor(container.config().cpuShares(), container.config().cpuShares())) .build()); builder.status(toPortableStatus.apply(container.state())); builder.loginPort(loginPortForContainer.apply(container).or(NO_LOGIN_PORT)); builder.publicAddresses(getPublicIpAddresses(container)); builder.privateAddresses(getPrivateIpAddresses(container)); builder.location(Iterables.getOnlyElement(locations.get())); String imageId = container.image(); builder.imageId(imageId); if (images.get().containsKey(imageId)) { Image image = images.get().get(imageId); builder.operatingSystem(image.getOperatingSystem()); } return builder.build(); }
@Override public NodeMetadata apply(Container container) { String name = cleanUpName(container.name()); String group = nodeNamingConvention.extractGroup(name); NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(container.id()) .name(name) .group(group) .hostname(container.config().hostname()) // TODO Set up hardware .hardware(new HardwareBuilder() .id("") .ram(container.config().memory()) .processor(new Processor(container.config().cpuShares(), container.config().cpuShares())) .build()); builder.status(toPortableStatus.apply(container.state())); builder.loginPort(loginPortForContainer.apply(container).or(NO_LOGIN_PORT)); builder.publicAddresses(getPublicIpAddresses(container)); builder.privateAddresses(getPrivateIpAddresses(container)); builder.location(Iterables.getOnlyElement(locations.get())); String imageId = container.image(); builder.imageId(imageId); if (images.get().containsKey(imageId)) { Image image = images.get().get(imageId); builder.operatingSystem(image.getOperatingSystem()); } return builder.build(); }
private NodeMetadata newNodeMetadata() { return new NodeMetadataBuilder() .id("id") .backendStatus("backendStatus") .credentials(credential) .group("group") .hostname("hostname") .loginPort(22) .name("DefaultConnectivityResolverTest") .publicAddresses(ImmutableList.of("10.0.0.1", "10.0.0.2")) .privateAddresses(ImmutableList.of("192.168.0.1", "192.168.0.2")) .status(NodeMetadata.Status.RUNNING) .tags(ImmutableList.<String>of()) .userMetadata(ImmutableMap.<String, String>of()) .build(); }
@Override protected NodeMetadata newNode(String group, Template template) { NodeMetadata result = new NodeMetadataBuilder() .id("myid") .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build()) .loginPort(22) .status(Status.RUNNING) .publicAddresses(ImmutableList.of("173.194.32.123")) .privateAddresses(ImmutableList.of("172.168.10.11")) .build(); return result; } };
@Override protected NodeMetadata newNode(String group, Template template) { NodeMetadata result = new NodeMetadataBuilder() .id("myNodeId") .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build()) .loginPort(serverSocket.getLocalPort()) .status(Status.RUNNING) .publicAddresses(ImmutableList.of(serverSocket.getInetAddress().getHostAddress())) .privateAddresses(ImmutableList.of("1.2.3.4")) .imageId(template.getImage().getId()) .tags(template.getOptions().getTags()) .hardware(includeNodeHardwareMetadata ? template.getHardware() : null) .group(template.getOptions().getGroups().isEmpty() ? "myGroup" : Iterables.get(template.getOptions().getGroups(), 0)) .build(); return result; } };
@Override protected NodeMetadata newNode(String group, Template template) { NodeMetadata result = new NodeMetadataBuilder() .id("myid") .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build()) .loginPort(22) .status(Status.RUNNING) .publicAddresses(publicAddresses) .privateAddresses(privateAddresses) .build(); return result; } };
@Override protected NodeMetadata newNode(String group, Template template) { NodeMetadata result = new NodeMetadataBuilder() .id("myid") .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build()) .loginPort(22) .status(Status.RUNNING) .publicAddresses(publicAddresses) .privateAddresses(privateAddresses) .build(); return result; } };
protected AbstractNodeCreator newNodeCreator(final List<String> publicAddresses, final List<String> privateAddresses) { NodeMetadata node = new NodeMetadataBuilder() .id("myid-1") .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build()) .loginPort(22) .status(Status.RUNNING) .publicAddresses(publicAddresses) .privateAddresses(privateAddresses) .build(); return new SingleNodeCreator(node); }
public static NodeMetadata expectedNodeMetadataFromResource(int id, String resource, Location location, int loginPort) { return new NodeMetadataBuilder() .ids("cluster-" + id) .group("hadoop") .name("cluster-" + id) .loginPort(loginPort) .hostname("cluster-" + id + ".mydomain.com") .location(location) .userMetadata(ImmutableMap.of("Name", "foo")) .tags(ImmutableSet.of("vanilla")) .status(Status.RUNNING) .operatingSystem( OperatingSystem.builder().description("redhat").family(OsFamily.RHEL).arch("x86").version("5.3") .build()) .publicAddresses(ImmutableSet.of("cluster-" + id + ".mydomain.com")) .credentials( LoginCredentials.builder().user("myUser").privateKey(NodesFromYamlTest.key).password("happy bear") .authenticateSudo(true).build()).build(); }
@Override protected NodeMetadata newNode(String group, Template template) { int suffix = counter.getAndIncrement(); org.jclouds.domain.Location region = new LocationBuilder() .scope(LocationScope.REGION) .id("us-east-1") .description("us-east-1") .parent(new LocationBuilder() .scope(LocationScope.PROVIDER) .id("aws-ec2") .description("aws-ec2") .build()) .build(); NodeMetadata result = new NodeMetadataBuilder() .id("mynodeid"+suffix) .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build()) .loginPort(22) .status(Status.RUNNING) .publicAddresses(ImmutableList.of("173.194.32."+suffix)) .privateAddresses(ImmutableList.of("172.168.10."+suffix)) .location(region) .build(); return result; } }
builder.ids(from.getId()); builder.name(from.getName()); builder.loginPort(from.getLoginPort()); builder.hostname(from.getHostname()); builder.location(findLocationWithId(from.getLocationId()));
public static NodeMetadataBuilder fromNodeMetadata(NodeMetadata node) { return new NodeMetadataBuilder().providerId(node.getProviderId()).name(node.getName()).id(node.getId()).location( node.getLocation()).uri(node.getUri()).userMetadata(node.getUserMetadata()).tags(node.getTags()).group( node.getGroup()).hardware(node.getHardware()).imageId(node.getImageId()).operatingSystem( node.getOperatingSystem()).status(node.getStatus()).backendStatus(node.getBackendStatus()).loginPort( node.getLoginPort()).publicAddresses(node.getPublicAddresses()).privateAddresses( node.getPrivateAddresses()).credentials(node.getCredentials()).hostname(node.getHostname()); }
public static NodeMetadataBuilder fromNodeMetadata(NodeMetadata node) { return new NodeMetadataBuilder().providerId(node.getProviderId()).name(node.getName()).id(node.getId()).location( node.getLocation()).uri(node.getUri()).userMetadata(node.getUserMetadata()).tags(node.getTags()).group( node.getGroup()).hardware(node.getHardware()).imageId(node.getImageId()).operatingSystem( node.getOperatingSystem()).status(node.getStatus()).backendStatus(node.getBackendStatus()).loginPort( node.getLoginPort()).publicAddresses(node.getPublicAddresses()).privateAddresses( node.getPrivateAddresses()).credentials(node.getCredentials()).hostname(node.getHostname()); }
public static NodeMetadataBuilder fromNodeMetadata(NodeMetadata node) { return new NodeMetadataBuilder().providerId(node.getProviderId()).name(node.getName()).id(node.getId()).location( node.getLocation()).uri(node.getUri()).userMetadata(node.getUserMetadata()).tags(node.getTags()).group( node.getGroup()).hardware(node.getHardware()).imageId(node.getImageId()).operatingSystem( node.getOperatingSystem()).status(node.getStatus()).backendStatus(node.getBackendStatus()).loginPort( node.getLoginPort()).publicAddresses(node.getPublicAddresses()).privateAddresses( node.getPrivateAddresses()).credentials(node.getCredentials()).hostname(node.getHostname()); }
public static NodeMetadataBuilder fromNodeMetadata(NodeMetadata node) { return new NodeMetadataBuilder().providerId(node.getProviderId()).name(node.getName()).id(node.getId()).location( node.getLocation()).uri(node.getUri()).userMetadata(node.getUserMetadata()).tags(node.getTags()).group( node.getGroup()).hardware(node.getHardware()).imageId(node.getImageId()).operatingSystem( node.getOperatingSystem()).status(node.getStatus()).backendStatus(node.getBackendStatus()).loginPort( node.getLoginPort()).publicAddresses(node.getPublicAddresses()).privateAddresses( node.getPrivateAddresses()).credentials(node.getCredentials()).hostname(node.getHostname()); }
builder.ids(from.getId()); builder.name(from.getName()); builder.loginPort(from.getLoginPort()); builder.hostname(from.getHostname()); builder.location(findLocationWithId(from.getLocationId()));