use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.
the class BuildEsrsDevice method build.
/**
* Build the Device object using the ViPR Controller license information.
*
* @return
* @throws LocalRepositoryException
* @throws Exception
*/
public Device build() throws Exception {
Device device = new Device();
LicenseInfoExt licenseInfo = _licenseManager.getLicenseInfoFromCoordinator(LicenseType.CONTROLLER);
buildDevice(licenseInfo, device);
return device;
}
use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.
the class CallHomeServiceImpl method sendHeartbeatEvent.
@Override
public Response sendHeartbeatEvent() {
// if not configured for callhome, do not continue.
_callHomeEventManager.validateSendEvent();
LicenseInfoListExt licenseList = null;
try {
licenseList = _licenseManager.getLicenseInfoListFromCoordinator();
} catch (Exception e) {
throw APIException.internalServerErrors.licenseInfoNotFoundForType("all license types");
}
if (licenseList != null) {
// send heart beat events for each registered license type
for (LicenseInfoExt licenseInfo : licenseList.getLicenseList()) {
if (licenseInfo.isTrialLicense()) {
_log.warn("Cannot send heartbeat event to SYR for trial license {} ", licenseInfo.getLicenseType().toString());
throw APIException.forbidden.permissionDeniedForTrialLicense(licenseInfo.getLicenseType().toString());
}
_callHomeEventsFacade.sendHeartBeatEvent(licenseInfo, getMediaType());
}
}
auditCallhome(OperationTypeEnum.SEND_HEARTBEAT, AuditLogManager.AUDITLOG_SUCCESS, null);
return Response.ok().build();
}
use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.
the class CallHomeEventManagerTest method testLicensExpirationEventNoCallInfoObject.
/**
* test that a license expiration event is sent if no CallInfo object returned from zookeeper.
*/
@Test
public void testLicensExpirationEventNoCallInfoObject() throws Exception {
MockCallHomeEventManager manager = new MockCallHomeEventManager();
LicenseInfoExt licenseInfo = null;
Assert.assertTrue(manager.doSendLicenseExpiration(licenseInfo));
}
use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.
the class CallHomeEventManagerTest method testHeartbeatEventNoCallInfoObject.
/**
* test that a heartbeat event is sent if no CallInfo object returned from zookeeper.
*/
@Test
public void testHeartbeatEventNoCallInfoObject() throws Exception {
MockCallHomeEventManager manager = new MockCallHomeEventManager();
LicenseInfoExt licenseInfo = null;
Assert.assertTrue(manager.doSendHeartBeat(licenseInfo));
}
use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.
the class CallHomeEventManagerTest method testHeartbeatEventFalse.
/**
* Test case which recognizes that a heartbeat event should not be sent.
*/
@Test
public void testHeartbeatEventFalse() throws Exception {
MockCallHomeEventManager manager = new MockCallHomeEventManager();
LicenseInfoExt licenseInfo = new LicenseInfoExt();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, (CallHomeConstants.HEARTBEART_EVENT_THRESHOLD * -1) + 1);
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
String stringDate = sdf.format(cal.getTime());
licenseInfo.setLastHeartbeatEventDate(stringDate);
manager.setLicenseInfo(licenseInfo);
Assert.assertFalse(manager.doSendHeartBeat(licenseInfo));
}
Aggregations