congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RunningInstanceToNodeMetadata.apply
Code IndexAdd Tabnine to your IDE (free)

How to use
apply
method
in
org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata

Best Java code snippets using org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata.apply (Showing top 18 results out of 315)

origin: jclouds/legacy-jclouds

private void checkGroupName(RunningInstance instance) {
 assertEquals("groupname", createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
    .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of())
    .apply(instance).getGroup());
}
origin: apache/jclouds

private void checkGroupName(RunningInstance instance) {
 assertEquals("groupname", createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
    .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of())
    .apply(instance).getGroup());
}
origin: jclouds/legacy-jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationNotFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(parser.apply(server).toString(),
    new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
       .publicAddresses(ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68")).imageId("us-east-1/ami-82e4b5c7")
       .id("us-east-1/i-0799056f").providerId("i-0799056f").build().toString());
}
origin: jclouds/legacy-jclouds

@Test
public void testApplyWhereTagDoesntMatchAndLocationFoundAndImageAndHardwareNotFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet.of(provider),
      ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 NodeMetadata expected = new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
      .privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68"))
      .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f")
      .location(provider).build();
 assertEquals(parser.apply(server).toString(), expected.toString());
}
origin: apache/jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationNotFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(parser.apply(server).toString(),
    new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
       .publicAddresses(ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68")).imageId("us-east-1/ami-82e4b5c7")
       .id("us-east-1/i-0799056f").providerId("i-0799056f").build().toString());
}
origin: apache/jclouds

@Test
public void testApplyWhereTagDoesntMatchAndLocationFoundAndImageAndHardwareNotFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet.of(provider),
      ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 NodeMetadata expected = new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
      .privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68"))
      .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f")
      .location(provider).build();
 assertEquals(parser.apply(server).toString(), expected.toString());
}
origin: jclouds/legacy-jclouds

@Test
public void testPrivateIpAddressIncorrectlyInPublicAddressFieldGoesToPrivateAddressCollection() {
 RunningInstance instance = RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small")
      .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").ipAddress("10.1.1.1").build();
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 assertEquals(parser.apply(instance).toString(), new NodeMetadataBuilder().status(Status.RUNNING).backendStatus("running").publicAddresses(
      ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.1.1.1")).id("us-east-1/id").imageId(
      "us-east-1/image").providerId("id").build().toString());
}
origin: jclouds/legacy-jclouds

@Test
public void testPublicIpAddressIncorrectlyInPrivateAddressFieldGoesToPublicAddressCollection() {
 RunningInstance instance = RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small")
      .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").privateIpAddress("1.1.1.1").build();
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 assertEquals(parser.apply(instance).toString(), new NodeMetadataBuilder().status(Status.RUNNING).backendStatus("running").privateAddresses(
      ImmutableSet.<String> of()).publicAddresses(ImmutableSet.of("1.1.1.1")).id("us-east-1/id").imageId(
      "us-east-1/image").providerId("id").build().toString());
}
origin: jclouds/legacy-jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationNotFoundButCredentialsFound()
    throws UnknownHostException {
 LoginCredentials creds = LoginCredentials.builder().user("root").password("abdce").build();
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of(
      "node#us-east-1/i-0799056f", creds));
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(
    parser.apply(server).toString(),
    new NodeMetadataBuilder().status(Status.RUNNING).backendStatus("running").hostname("ip-10-243-42-70")
       .publicAddresses(ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68")).credentials(creds)
       .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f").build().toString());
}
origin: apache/jclouds

@Test
public void testPrivateIpAddressIncorrectlyInPublicAddressFieldGoesToPrivateAddressCollection() {
 RunningInstance instance = RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small")
      .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").ipAddress("10.1.1.1").build();
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 assertEquals(parser.apply(instance).toString(), new NodeMetadataBuilder().status(Status.RUNNING).backendStatus("running").publicAddresses(
      ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.1.1.1")).id("us-east-1/id").imageId(
      "us-east-1/image").providerId("id").build().toString());
}
origin: apache/jclouds

@Test
public void testPublicIpAddressIncorrectlyInPrivateAddressFieldGoesToPublicAddressCollection() {
 RunningInstance instance = RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small")
      .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").privateIpAddress("1.1.1.1").build();
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 assertEquals(parser.apply(instance).toString(), new NodeMetadataBuilder().status(Status.RUNNING).backendStatus("running").privateAddresses(
      ImmutableSet.<String> of()).publicAddresses(ImmutableSet.of("1.1.1.1")).id("us-east-1/id").imageId(
      "us-east-1/image").providerId("id").build().toString());
}
origin: apache/jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationNotFoundButCredentialsFound()
    throws UnknownHostException {
 LoginCredentials creds = LoginCredentials.builder().user("root").password("abdce").build();
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of(
      "node#us-east-1/i-0799056f", creds));
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(
    parser.apply(server).toString(),
    new NodeMetadataBuilder().status(Status.RUNNING).backendStatus("running").hostname("ip-10-243-42-70")
       .publicAddresses(ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68")).credentials(creds)
       .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f").build().toString());
}
origin: jclouds/legacy-jclouds

@Test
public void testHandleMissingAMIs() {
 // Handle the case when the installed AMI no longer can be found in AWS.
 // Create a null-returning function to simulate that the AMI can't be found.
 CacheLoader<RegionAndName, Image> nullReturningFunction = new CacheLoader<RegionAndName, Image>() {
   @Override
   public Image load(@Nullable RegionAndName from) {
    return null;
   }
 };
 LoadingCache<RegionAndName, Image> instanceToImage = CacheBuilder.newBuilder().build(nullReturningFunction);
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small().build()), ImmutableSet
      .of(provider), ImmutableMap.<String, Credentials> of(),
      EC2ComputeServiceDependenciesModule.toPortableNodeStatus, instanceToImage);
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(
    parser.apply(server).toString(),
    new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
       .privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68"))
       .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f")
       .hardware(m1_small().build()).location(provider).build().toString());
}
origin: apache/jclouds

@Test
public void testHandleMissingAMIs() {
 // Handle the case when the installed AMI no longer can be found in AWS.
 // Create a null-returning function to simulate that the AMI can't be found.
 CacheLoader<RegionAndName, Image> nullReturningFunction = new CacheLoader<RegionAndName, Image>() {
   @Override
   public Image load(@Nullable RegionAndName from) {
    return null;
   }
 };
 LoadingCache<RegionAndName, Image> instanceToImage = CacheBuilder.newBuilder().build(nullReturningFunction);
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small().build()), ImmutableSet
      .of(provider), ImmutableMap.<String, Credentials> of(),
      EC2ComputeServiceDependenciesModule.toPortableNodeStatus, instanceToImage);
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(
    parser.apply(server).toString(),
    new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
       .privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68"))
       .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f")
       .hardware(m1_small().build()).location(provider).build().toString());
}
origin: jclouds/legacy-jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageAndLocationFoundAndHardwareNotFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet.of(provider),
      EC2ImageParserTest.convertImages("/amzn_images.xml"), ImmutableMap.<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(
    parser.apply(server).toString(),
    new NodeMetadataBuilder()
       .status(Status.RUNNING).backendStatus("running")
       .hostname("ip-10-243-42-70")
       .privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68"))
       .imageId("us-east-1/ami-82e4b5c7")
       .operatingSystem(
          new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual")
             .description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build())
       .id("us-east-1/i-0799056f").providerId("i-0799056f").location(provider).build().toString());
}
origin: apache/jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageAndLocationFoundAndHardwareNotFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet.of(provider),
      EC2ImageParserTest.convertImages("/amzn_images.xml"), ImmutableMap.<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(
    parser.apply(server).toString(),
    new NodeMetadataBuilder()
       .status(Status.RUNNING).backendStatus("running")
       .hostname("ip-10-243-42-70")
       .privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68"))
       .imageId("us-east-1/ami-82e4b5c7")
       .operatingSystem(
          new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual")
             .description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build())
       .id("us-east-1/i-0799056f").providerId("i-0799056f").location(provider).build().toString());
}
origin: jclouds/legacy-jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small().build()), ImmutableSet
      .of(provider), EC2ImageParserTest.convertImages("/amzn_images.xml"), ImmutableMap
      .<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(
    parser.apply(server).toString(),
    new NodeMetadataBuilder()
       .hostname("ip-10-243-42-70")
       .status(Status.RUNNING).backendStatus("running")
       .privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68"))
       .imageId("us-east-1/ami-82e4b5c7")
       .hardware(m1_small().build())
       .operatingSystem(
          new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual")
             .description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build())
       .id("us-east-1/i-0799056f").providerId("i-0799056f").location(provider).build().toString());
}
origin: apache/jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small().build()), ImmutableSet
      .of(provider), EC2ImageParserTest.convertImages("/amzn_images.xml"), ImmutableMap
      .<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(
    parser.apply(server).toString(),
    new NodeMetadataBuilder()
       .hostname("ip-10-243-42-70")
       .status(Status.RUNNING).backendStatus("running")
       .privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68"))
       .imageId("us-east-1/ami-82e4b5c7")
       .hardware(m1_small().build())
       .operatingSystem(
          new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual")
             .description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build())
       .id("us-east-1/i-0799056f").providerId("i-0799056f").location(provider).build().toString());
}
org.jclouds.ec2.compute.functionsRunningInstanceToNodeMetadataapply

Popular methods of RunningInstanceToNodeMetadata

  • parseHardware
  • addCredentialsForInstance
  • addEBS
  • findLocationWithId
  • getGroupForInstance
  • getHardwareForInstance
  • getLocationForAvailabilityZoneOrRegion
  • parseGroupFrom
  • <init>

Popular in Java

  • Updating database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now