Search in sources :

Example 11 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeEventManagerTest method testLicenExpirationEventFalse.

/**
 * Test case which recognizes that a license expiration event should not be sent.
 */
@Test
public void testLicenExpirationEventFalse() throws Exception {
    MockCallHomeEventManager manager = new MockCallHomeEventManager();
    LicenseInfoExt licenseInfo = new LicenseInfoExt();
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DAY_OF_MONTH, (CallHomeConstants.LICENSE_EXPIRATION_EVENT_THRESHOLD * -1) + 1);
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    String stringDate = sdf.format(cal.getTime());
    licenseInfo.setLastLicenseExpirationDateEventDate(stringDate);
    manager.setLicenseInfo(licenseInfo);
    Assert.assertFalse(manager.doSendLicenseExpiration(licenseInfo));
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 12 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeEventManagerTest method testRegistrationEventTrue.

/**
 * Test case which recognizes that a registration event should be sent.
 */
@Test
public void testRegistrationEventTrue() throws Exception {
    MockCallHomeEventManager manager = new MockCallHomeEventManager();
    LicenseInfoExt licenseInfo = new LicenseInfoExt();
    manager.setLicenseInfo(licenseInfo);
    Assert.assertTrue(manager.doSendRegistration(licenseInfo));
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Test(org.junit.Test)

Example 13 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeEventManagerTest method testRegistrationEventNoCallInfoObject.

/**
 * test that a registration event is sent if no CallInfo object returned from zookeeper.
 */
@Test
public void testRegistrationEventNoCallInfoObject() throws Exception {
    MockCallHomeEventManager manager = new MockCallHomeEventManager();
    LicenseInfoExt licenseInfo = null;
    Assert.assertTrue(manager.doSendLicenseExpiration(licenseInfo));
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Test(org.junit.Test)

Example 14 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeEventManagerTest method testHeartbeatEventTrue.

/**
 * Test case which recognizes that a heartbeat event should be sent.
 */
@Test
public void testHeartbeatEventTrue() 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);
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    String stringDate = sdf.format(cal.getTime());
    licenseInfo.setLastHeartbeatEventDate(stringDate);
    manager.setLicenseInfo(licenseInfo);
    Assert.assertTrue(manager.doSendHeartBeat(licenseInfo));
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 15 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeEventManagerTest method testLicenseExpirationEventNoExpirationDate.

/**
 * test that a license expiration event is sent if no heartbeat date exists in zookeeper.
 */
@Test
public void testLicenseExpirationEventNoExpirationDate() throws Exception {
    MockCallHomeEventManager manager = new MockCallHomeEventManager();
    LicenseInfoExt licenseInfo = new LicenseInfoExt();
    manager.setLicenseInfo(licenseInfo);
    Assert.assertTrue(manager.doSendLicenseExpiration(licenseInfo));
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Test(org.junit.Test)

Aggregations

LicenseInfoExt (com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt)15 Test (org.junit.Test)11 SimpleDateFormat (java.text.SimpleDateFormat)5 Calendar (java.util.Calendar)4 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)3 ForbiddenException (com.emc.storageos.svcs.errorhandling.resources.ForbiddenException)3 LicenseInfoListExt (com.emc.storageos.systemservices.impl.licensing.LicenseInfoListExt)2 LicenseType (com.emc.storageos.coordinator.client.service.CoordinatorClient.LicenseType)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 Operation (com.emc.storageos.db.client.model.Operation)1 SysEvent (com.emc.storageos.db.client.model.SysEvent)1 SendAlertEvent (com.emc.storageos.systemservices.impl.eventhandler.connectemc.SendAlertEvent)1 Device (com.emc.vipr.model.sys.eventhandler.Device)1 URI (java.net.URI)1