@Override public String apply(Hardware arg0) { return arg0.getId(); }
@Override public boolean apply(Hardware input) { return input.getId().equals(slashEncoded); } });
@Override public boolean apply(Hardware input) { return input.getId().equals(slug); } });
@Override public boolean apply(Hardware input) { return input.getId().equals(slug); } });
@Override public boolean apply(Hardware hardware) { return id.equals(hardware.getId()); }
@Override public boolean apply(Hardware input) { boolean returnVal = true; if (hardwareId != null) { returnVal = hardwareId.equals(input.getId()); // match our input params so that the later predicates pass. if (returnVal) { fromHardware(input); } } return returnVal; }
@Override public boolean apply(Hardware input) { boolean returnVal = true; if (hardwareId != null) { returnVal = hardwareId.equals(input.getId()); // match our input params so that the later predicates pass. if (returnVal) { fromHardware(input); } } return returnVal; }
@Override public boolean apply(Hardware input) { boolean returnVal = true; if (hardwareId != null) { returnVal = hardwareId.equals(input.getId()); // match our input params so that the later predicates pass. if (returnVal) { fromHardware(input); } } return returnVal; }
protected void printHardwares(ComputeService service, Set<? extends Hardware> hardwares, PrintStream out) { ShellTable table = shellTableFactory.build("hardware"); table.setDisplayData(hardwares); table.display(out, true, true); for (Hardware hardware : hardwares) { for (String cacheKey : ServiceHelper.findCacheKeysForService(service)) { cacheProvider.getProviderCacheForType(Constants.HARDWARE_CACHE).put(cacheKey, hardware.getId()); } } }
public void testHardwareId() { Hardware first = Iterables.get(computeService.listHardwareProfiles(), 0); assert HardwarePredicates.idEquals(first.getId()).apply(first); Hardware second = Iterables.get(computeService.listHardwareProfiles(), 1); assert !HardwarePredicates.idEquals(first.getId()).apply(second); }
@Test(groups={"Live", "Live-sanity"}) public void testJcloudsCreateWithHardwareIdLongForm() throws Exception { obtainMachine(ImmutableMap.of(JcloudsLocation.HARDWARE_ID, N1_STANDARD_1_HARDWARE_ID_LONG_FORM)); assertEquals(template.getHardware().getId(), N1_STANDARD_1_HARDWARE_ID_LONG_FORM, "template="+template); }
@Test public void testTemplateChoiceForInstanceByCChardwareId() throws Exception { Template template = newTemplateBuilder().fastest().build(); assert template != null : "The returned template was null, but it should have a value."; assert CC1_4XLARGE.equals(template.getHardware()) : format( "Incorrect image determined by the template. Expected: %s. Found: %s.", CC1_4XLARGE.getId(), template .getHardware().getId()); }
@Test(groups={"Live", "Live-sanity"}) public void testJcloudsCreateWithHardwareIdShortFormWithNoRegionInLocationSpec() throws Exception { replaceJcloudsLocation(GCE_PROVIDER); obtainMachine(ImmutableMap.of( JcloudsLocation.CLOUD_REGION_ID, GCE_USCENTRAL_REGION_NAME, JcloudsLocation.HARDWARE_ID, N1_STANDARD_1_HARDWARE_ID)); assertEquals(template.getHardware().getId(), N1_STANDARD_1_HARDWARE_ID_LONG_FORM, "template="+template); }
@Test(groups={"Live", "Live-sanity"}) public void testJcloudsCreateWithHardwareIdLongFormWithNoRegion() throws Exception { // Expect it to default to GCE_USCENTRAL_REGION_NAME - // but is that only because that region is hard-coded in the long hardwareId?! replaceJcloudsLocation(GCE_PROVIDER); obtainMachine(ImmutableMap.of(JcloudsLocation.HARDWARE_ID, N1_STANDARD_1_HARDWARE_ID_LONG_FORM)); assertEquals(template.getHardware().getId(), N1_STANDARD_1_HARDWARE_ID_LONG_FORM, "template="+template); }
@Test(groups={"Live", "Live-sanity"}) public void testJcloudsCreateWithHardwareIdLongFormWithNoRegionInLocationSpec() throws Exception { // region will be passed in the obtain() call replaceJcloudsLocation(GCE_PROVIDER); obtainMachine(ImmutableMap.of( JcloudsLocation.CLOUD_REGION_ID, GCE_USCENTRAL_REGION_NAME, JcloudsLocation.HARDWARE_ID, N1_STANDARD_1_HARDWARE_ID_LONG_FORM)); assertEquals(template.getHardware().getId(), N1_STANDARD_1_HARDWARE_ID_LONG_FORM, "template="+template); }
@Override public AtomicReference<NodeMetadata> call() throws Exception { NodeMetadata node = null; logger.debug(">> adding node location(%s) name(%s) image(%s) hardware(%s)", template.getLocation().getId(), name, MoreObjects.firstNonNull(template.getImage().getProviderId(), template.getImage().getId()), MoreObjects.firstNonNull(template.getHardware().getProviderId(), template.getHardware().getId())); node = addNodeWithGroupStrategy.createNodeWithGroupEncodedIntoName(group, name, template); logger.debug("<< %s node(%s)", formatStatus(node), node.getId()); return new AtomicReference<NodeMetadata>(node); }
private void checkTemplate(Template defaultTemplate) { assertEquals(defaultTemplate.getImage().getId(), "RegionOne/15"); assertEquals(defaultTemplate.getImage().getProviderId(), "15"); assertEquals(defaultTemplate.getHardware().getId(), "RegionOne/1"); assertEquals(defaultTemplate.getHardware().getProviderId(), "1"); assertEquals(defaultTemplate.getLocation().getId(), "RegionOne"); assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); }
@SuppressWarnings("unchecked") public static HardwareBuilder fromHardware(Hardware in) { return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name( in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors( List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes())) .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor()); } }
@SuppressWarnings("unchecked") public static HardwareBuilder fromHardware(Hardware in) { return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name( in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors( List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes())) .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor()); } }
@SuppressWarnings("unchecked") public static HardwareBuilder fromHardware(Hardware in) { return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name( in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors( List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes())) .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor()); } }