@Override public Hardware build() { return new HardwareImpl(providerId, name, id, location, uri, userMetadata, tags, processors, ram, volumes, supportsImage, hypervisor, deprecated); }
@Override protected ToStringHelper string() { ToStringHelper helper = computeToStringPrefix(); helper.add("processors", processors).add("ram", ram); if (volumes.size() > 0) helper.add("volumes", volumes); helper.add("hypervisor", hypervisor); helper.add("supportsImage", supportsImage); return addComputeToStringSuffix(helper); }
/** * {@inheritDoc} */ @Override public int compareTo(ResourceMetadata<ComputeType> that) { if (that instanceof Hardware) { Hardware thatHardware = Hardware.class.cast(that); return ComparisonChain.start().compare(getCores(this), getCores(thatHardware)).compare(this.getRam(), thatHardware.getRam()) .compare(getSpace(this), getSpace(thatHardware)).result(); } else { return super.compareTo(that); } }
/** * {@inheritDoc} */ @Override public int compareTo(ResourceMetadata<ComputeType> that) { if (that instanceof Hardware) { Hardware thatHardware = Hardware.class.cast(that); return ComparisonChain.start().compare(getCores(this), getCores(thatHardware)).compare(this.getRam(), thatHardware.getRam()) .compare(getSpace(this), getSpace(thatHardware)).result(); } else { return super.compareTo(that); } }
@Override public Hardware build() { return new HardwareImpl(providerId, name, id, location, uri, userMetadata, tags, processors, ram, volumes, supportsImage, hypervisor); }
@Override protected ToStringHelper string() { ToStringHelper helper = computeToStringPrefix(); helper.add("processors", processors).add("ram", ram); if (volumes.size() > 0) helper.add("volumes", volumes); helper.add("hypervisor", hypervisor); helper.add("supportsImage", supportsImage); return addComputeToStringSuffix(helper); }
/** * {@inheritDoc} */ @Override public int compareTo(ResourceMetadata<ComputeType> that) { if (that instanceof Hardware) { Hardware thatHardware = Hardware.class.cast(that); return ComparisonChain.start().compare(getCores(this), getCores(thatHardware)).compare(this.getRam(), thatHardware.getRam()) .compare(getSpace(this), getSpace(thatHardware)).result(); } else { return super.compareTo(that); } }
@Override public Hardware build() { return new HardwareImpl(providerId, name, id, location, uri, userMetadata, tags, processors, ram, volumes, supportsImage, hypervisor); }
@Override protected ToStringHelper string() { ToStringHelper helper = computeToStringPrefix(); helper.add("processors", processors).add("ram", ram); if (!volumes.isEmpty()) helper.add("volumes", volumes); helper.add("hypervisor", hypervisor); helper.add("supportsImage", supportsImage); return addComputeToStringSuffix(helper); }
/** * {@inheritDoc} */ @Override public int compareTo(ResourceMetadata<ComputeType> that) { if (that instanceof Hardware) { Hardware thatHardware = Hardware.class.cast(that); return ComparisonChain.start().compare(getCores(this), getCores(thatHardware)).compare(this.getRam(), thatHardware.getRam()) .compare(getSpace(this), getSpace(thatHardware)).result(); } else { return super.compareTo(that); } }
@Override public Hardware build() { return new HardwareImpl(providerId, name, id, location, uri, userMetadata, tags, processors, ram, volumes, supportsImage, hypervisor, deprecated); }
@Override protected ToStringHelper string() { ToStringHelper helper = computeToStringPrefix(); helper.add("processors", processors).add("ram", ram); if (!volumes.isEmpty()) helper.add("volumes", volumes); helper.add("hypervisor", hypervisor); helper.add("supportsImage", supportsImage); return addComputeToStringSuffix(helper); }
private Cluster newCluster(int numberOfWorkers) { DnsResolver fakeDnsResolver = new FakeDnsResolver(); NodeMetadata node = mock(NodeMetadata.class); List<Processor> processors = ImmutableList.of(new Processor(4, 1.0)); Hardware hardware = new HardwareImpl(null, null, "id", null, null, ImmutableMap.<String,String>of(), ImmutableSet.<String>of(), processors, 1024, ImmutableList.<Volume>of(), null, "xen"); when(node.getHardware()).thenReturn(hardware); Builder<Instance> instances = ImmutableSet.<Instance>builder(); Instance master = new Instance(new Credentials("", ""), ImmutableSet.of(HadoopNameNodeClusterActionHandler.ROLE, HadoopJobTrackerClusterActionHandler.ROLE), "10.0.0.1", "10.0.0.1", "1", node, fakeDnsResolver); instances.add(master); for (int i = 0; i < numberOfWorkers; i++) { int id = i + 2; instances.add(new Instance(new Credentials("", ""), ImmutableSet.of(HadoopDataNodeClusterActionHandler.ROLE, HadoopTaskTrackerClusterActionHandler.ROLE), "10.0.0." + id, "10.0.0." + id, id + "", node, fakeDnsResolver)); } return new Cluster(instances.build()); }
new HardwareImpl( "myHardwareProviderId", "myHardwareName",