public Builder fromSoftwareLicense(SoftwareLicense in) { return this .id(in.getId()) .softwareDescription(in.getSoftwareDescription()) .softwareDescriptionId(in.getSoftwareDescriptionId()); } }
public String getReferenceCodeOrId(VirtualGuest from) { String val = from.getSoftwareLicense() != null && from.getSoftwareLicense().getSoftwareDescription() != null ? from.getSoftwareLicense().getSoftwareDescription().getReferenceCode() : from.getId() + ""; return val; } }
public Builder fromSoftwareLicense(SoftwareLicense in) { return this .id(in.getId()) .softwareDescription(in.getSoftwareDescription()) .softwareDescriptionId(in.getSoftwareDescriptionId()); } }
public String getReferenceCodeOrId(VirtualGuest from) { String val = from.getSoftwareLicense() != null && from.getSoftwareLicense().getSoftwareDescription() != null ? from.getSoftwareLicense().getSoftwareDescription().getReferenceCode() : from.getId() + ""; return val; } }
public Builder fromSoftwareLicense(SoftwareLicense in) { return this .id(in.getId()) .softwareDescription(in.getSoftwareDescription()) .softwareDescriptionId(in.getSoftwareDescriptionId()); } }
public String getReferenceCodeOrId(VirtualGuest from) { String val = from.getSoftwareLicense() != null && from.getSoftwareLicense().getSoftwareDescription() != null ? from.getSoftwareLicense().getSoftwareDescription().getReferenceCode() : from.getId() + ""; return val; } }
public Builder fromSoftwareLicense(SoftwareLicense in) { return this .id(in.getId()) .softwareDescription(in.getSoftwareDescription()) .softwareDescriptionId(in.getSoftwareDescriptionId()); } }
final SoftwareLicense defaultSoftwareLicense = SoftwareLicense.builder().softwareDescription(SoftwareDescription.builder().build()).build(); SoftwareLicense softwareLicense = fromNullable(operatingSystem.getSoftwareLicense()).or(defaultSoftwareLicense); Optional<String> optOSReferenceCode = fromNullable(softwareLicense.getSoftwareDescription().getReferenceCode()); Optional<String> optVersion = fromNullable(softwareLicense.getSoftwareDescription().getVersion()); Optional<String> optLongDescription = fromNullable(softwareLicense.getSoftwareDescription().getLongDescription()); OsFamily osFamily = OsFamily.UNRECOGNIZED; String osVersion = UNRECOGNIZED;
final SoftwareLicense defaultSoftwareLicense = SoftwareLicense.builder().softwareDescription(SoftwareDescription.builder().build()).build(); SoftwareLicense softwareLicense = fromNullable(operatingSystem.getSoftwareLicense()).or(defaultSoftwareLicense); Optional<String> optOSReferenceCode = fromNullable(softwareLicense.getSoftwareDescription().getReferenceCode()); Optional<String> optVersion = fromNullable(softwareLicense.getSoftwareDescription().getVersion()); Optional<String> optLongDescription = fromNullable(softwareLicense.getSoftwareDescription().getLongDescription()); OsFamily osFamily = OsFamily.UNRECOGNIZED; String osVersion = UNRECOGNIZED;
final SoftwareLicense defaultSoftwareLicense = SoftwareLicense.builder().softwareDescription(SoftwareDescription.builder().build()).build(); SoftwareLicense softwareLicense = fromNullable(operatingSystem.getSoftwareLicense()).or(defaultSoftwareLicense); Optional<String> optOSReferenceCode = fromNullable(softwareLicense.getSoftwareDescription().getReferenceCode()); Optional<String> optVersion = fromNullable(softwareLicense.getSoftwareDescription().getVersion()); Optional<String> optLongDescription = fromNullable(softwareLicense.getSoftwareDescription().getLongDescription()); OsFamily osFamily = OsFamily.UNRECOGNIZED; String osVersion = UNRECOGNIZED;
SoftwareLicense softwareLicense = checkNotNull(operatingSystem.getSoftwareLicense(), "softwareLicense"); String operatingSystemReferenceCode = softwareLicense.getSoftwareDescription().getReferenceCode(); OsFamily osFamily = osFamily().apply(operatingSystemReferenceCode); if (osFamily == OsFamily.UNRECOGNIZED) { logger.debug("Cannot determine os family for item: %s", operatingSystem); String osVersion = OperatingSystems.version().apply(softwareLicense.getSoftwareDescription().getVersion()); if (osVersion == null) { logger.debug("Cannot determine os version for item: %s", operatingSystem); .description(softwareLicense.getSoftwareDescription().getLongDescription()) .family(osFamily) .version(osVersion)
String referenceCode = softwareLicense.getSoftwareDescription().getReferenceCode(); logger.debug("Cannot determine os bits for item: %s", from); String osVersion = OperatingSystems.version().apply(softwareLicense.getSoftwareDescription().getVersion()); if (osVersion == null) { logger.debug("Cannot determine os version for item: %s", from); .description(softwareLicense.getSoftwareDescription().getLongDescription()) .family(osFamily) .version(osVersion)
@Test public void testOperatingSystemToImage() { OperatingSystem operatingSystem = OperatingSystem.builder() .id("UBUNTU_12_64") .softwareLicense(SoftwareLicense.builder() .softwareDescription(SoftwareDescription.builder() .version("12.04-64 Minimal for CCI") .referenceCode("UBUNTU_12_64") .longDescription("Ubuntu Linux 12.04 LTS Precise Pangolin - Minimal Install (64 bit)") .build()) .build()) .build(); Image image = new OperatingSystemToImage().apply(operatingSystem); assertEquals(image.getId(), operatingSystem.getId()); String referenceCode = operatingSystem.getSoftwareLicense().getSoftwareDescription().getReferenceCode(); assertEquals(image.getDescription(), referenceCode); assertTrue(image.getOperatingSystem().getFamily().toString().equalsIgnoreCase("UBUNTU")); assertEquals(image.getOperatingSystem().getVersion(), "12.04"); assertEquals(image.getOperatingSystem().is64Bit(), true); assertEquals(image.getStatus(), Image.Status.AVAILABLE); }