DeploymentMetaData { static String getBuildStampFromEnv() { String buildStamp = PropertyUtil.getProperty(PropertyUtil.HAWKULAR_APM_BUILDSTAMP); if (null != buildStamp && !buildStamp.isEmpty()) { return buildStamp; } String buildName = PropertyUtil.getProperty(PropertyUtil.OPENSHIFT_BUILD_NAME); if (null != buildName && !buildName.isEmpty()) { String buildNamespace = PropertyUtil.getProperty(PropertyUtil.OPENSHIFT_BUILD_NAMESPACE); if (null == buildNamespace || buildNamespace.isEmpty()) { return buildName; } else { return String.format("%s.%s", buildNamespace, buildName); } } return null; } DeploymentMetaData(String serviceName, String buildStamp); String getServiceName(); void setServiceName(String serviceName); String getBuildStamp(); void setBuildStamp(String buildStamp); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void retrieveBuildStamp_overrideOpenShiftProperty() { System.setProperty(PropertyUtil.OPENSHIFT_BUILD_NAME, "hawkular-apm-1"); System.setProperty(PropertyUtil.HAWKULAR_APM_BUILDSTAMP, "hawkular-apm-2"); assertEquals("hawkular-apm-2", DeploymentMetaData.getBuildStampFromEnv()); System.getProperties().remove(PropertyUtil.OPENSHIFT_BUILD_NAME); System.getProperties().remove(PropertyUtil.HAWKULAR_APM_BUILDSTAMP); }