Search in sources :

Example 11 with LicenseFeature

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());
}
Also used : LicenseFeature(com.emc.vipr.model.sys.licensing.LicenseFeature) Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Test(org.junit.Test)

Example 12 with LicenseFeature

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;
}
Also used : LicenseFeature(com.emc.vipr.model.sys.licensing.LicenseFeature) License(com.emc.vipr.model.sys.licensing.License)

Example 13 with LicenseFeature

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;
}
Also used : LicenseFeature(com.emc.vipr.model.sys.licensing.LicenseFeature) License(com.emc.vipr.model.sys.licensing.License) Override(java.lang.Override)

Example 14 with LicenseFeature

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;
}
Also used : LicenseFeature(com.emc.vipr.model.sys.licensing.LicenseFeature) License(com.emc.vipr.model.sys.licensing.License)

Aggregations

LicenseFeature (com.emc.vipr.model.sys.licensing.LicenseFeature)14 License (com.emc.vipr.model.sys.licensing.License)7 Test (org.junit.Test)4 SimpleDateFormat (java.text.SimpleDateFormat)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 ELMFeatureDetail (com.emc.cams.elm.ELMFeatureDetail)1 ELMLicenseProps (com.emc.cams.elm.ELMLicenseProps)1 ELMLicenseSource (com.emc.cams.elm.ELMLicenseSource)1 ELMLicenseException (com.emc.cams.elm.exception.ELMLicenseException)1 LicenseType (com.emc.storageos.coordinator.client.service.CoordinatorClient.LicenseType)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)1 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)1 LocalRepositoryException (com.emc.storageos.systemservices.exceptions.LocalRepositoryException)1 SysClientException (com.emc.storageos.systemservices.exceptions.SysClientException)1 IOException (java.io.IOException)1 Override (java.lang.Override)1 ParseException (java.text.ParseException)1