Search in sources :

Example 1 with LicenseFeature

use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.

the class Licensing method itemDetails.

public static void itemDetails(String id) {
    License license = LicenseUtils.getLicense();
    LicenseFeature lf = null;
    for (LicenseFeature feature : license.getLicenseFeatures()) {
        if (StringUtils.equalsIgnoreCase(feature.getModelId(), id)) {
            lf = feature;
            break;
        }
    }
    render(lf);
}
Also used : LicenseFeature(com.emc.vipr.model.sys.licensing.LicenseFeature) License(com.emc.vipr.model.sys.licensing.License)

Example 2 with LicenseFeature

use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.

the class LicenseManagerImpl method createLicenseFeatureFromLicenseInfoExt.

/**
 * Create a LicenseFeature object from a LicenseInfoExt from coordinator service.
 *
 * @return LicenseFeature
 */
private LicenseFeature createLicenseFeatureFromLicenseInfoExt(LicenseInfoExt licenseInfo) {
    if (licenseInfo == null) {
        return null;
    }
    LicenseFeature licenseFeature = new LicenseFeature();
    licenseFeature.setDateExpires(licenseInfo.getExpirationDate());
    licenseFeature.setExpired(isExpired(licenseFeature.getDateExpires()));
    licenseFeature.setStorageCapacity(licenseInfo.getStorageCapacity());
    licenseFeature.setProductId(licenseInfo.getProductId());
    licenseFeature.setSerial(licenseInfo.getProductId());
    licenseFeature.setModelId(licenseInfo.getModelId());
    licenseFeature.setDateIssued(licenseInfo.getIssuedDate());
    licenseFeature.setLicenseIdIndicator(licenseInfo.getLicenseTypeIndicator());
    licenseFeature.setVersion(licenseInfo.getVersion());
    licenseFeature.setNotice(licenseInfo.getNotice());
    licenseFeature.setTrialLicense(licenseInfo.isTrialLicense());
    licenseFeature.setLicensed(true);
    return licenseFeature;
}
Also used : LicenseFeature(com.emc.vipr.model.sys.licensing.LicenseFeature)

Example 3 with LicenseFeature

use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.

the class LicensingServiceImpl 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)

Example 4 with LicenseFeature

use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.

the class LicenseTest method noLicenseDefinedTest.

@Test
public void noLicenseDefinedTest() {
    LicenseFeature license = new LicenseFeature();
    Assert.assertFalse(license.isExpired());
    Assert.assertFalse(license.isLicensed());
}
Also used : LicenseFeature(com.emc.vipr.model.sys.licensing.LicenseFeature) Test(org.junit.Test)

Example 5 with LicenseFeature

use of com.emc.vipr.model.sys.licensing.LicenseFeature in project coprhd-controller by CoprHD.

the class LicenseTest method permanentLicenseTest.

/**
 * Positive test for a permanent license.
 */
@Test
public void permanentLicenseTest() {
    LicenseFeature license = new LicenseFeature();
    license.setDateExpires(LicenseManager.PERMANENT_LICENSE);
    license.setExpired(LicenseManagerImpl.isExpired(license.getDateExpires()));
    Assert.assertFalse(license.isExpired());
}
Also used : LicenseFeature(com.emc.vipr.model.sys.licensing.LicenseFeature) Test(org.junit.Test)

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