use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.
the class LicenseTest method nonExpiredLicenseTest.
/**
* Positive test for a non expired license. License date is current day plus
* 1 day. Compares date to current day.
*/
@Test
public void nonExpiredLicenseTest() {
LicenseFeature license = new LicenseFeature();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 1);
Date nowPlusOneDay = cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat(LicenseManager.EXPIRE_DATE_FORMAT);
license.setDateExpires(sdf.format(nowPlusOneDay));
license.setExpired(LicenseManagerImpl.isExpired(license.getDateExpires()));
Assert.assertFalse(license.isExpired());
}
use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.
the class OpenSourceLicenseManagerImpl method getLicense.
/**
* Returns a full license object complete with features.
*
* @return
*/
public License getLicense() throws Exception {
License license = new License();
LicenseFeature licenseFeature = new LicenseFeature();
licenseFeature.setDateExpires(null);
licenseFeature.setExpired(false);
licenseFeature.setStorageCapacity("1152921504606846976");
licenseFeature.setProductId("R27WRZ98BBF6XS");
licenseFeature.setSerial("R27WRZ98BBF6XS");
String subModelId = LicenseFeature.NEW_MANAGED_LICENSE_SUBMODEL;
licenseFeature.setModelId(LicenseConstants.VIPR_CONTROLLER + LicenseFeature.MODELID_DELIMETER + subModelId);
licenseFeature.setDateIssued("01/10/2014");
licenseFeature.setLicenseIdIndicator("U");
licenseFeature.setVersion("2.0");
licenseFeature.setNotice("Distributed under the Apache License, Version 2.0");
licenseFeature.setTrialLicense(false);
licenseFeature.setLicensed(true);
license.addLicenseFeature(licenseFeature);
license.setLicenseText(LICENSE_TEXT);
return license;
}
use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.
the class OpenSourceLicensingServiceImpl method getLicense.
@Override
public License getLicense() throws Exception {
_log.info("Received GET /license request");
// Changing invalid 01/01/12006 license expiration date to null
License license = _licenseManager.getLicense();
if (license != null && license.getLicenseFeatures() != null) {
for (LicenseFeature feature : license.getLicenseFeatures()) {
if (LicenseConstants.LICENSE_EXPIRATION_DATE.equals(feature.getDateExpires())) {
feature.setDateExpires(null);
}
if (feature.getStorageCapacity().equals(LicenseInfo.VALUE_NOT_SET)) {
feature.setStorageCapacity(null);
}
}
}
return license;
}
use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.
the class ApiTestBase method isControllerLicensed.
protected boolean isControllerLicensed() {
License license = rSys.path("/license").get(License.class);
List<LicenseFeature> features = license.getLicenseFeatures();
if (features == null) {
return false;
}
for (LicenseFeature feature : features) {
if (feature.getModelId().startsWith("ViPR_Controller") && feature.isLicensed()) {
return true;
}
}
return false;
}
Aggregations