/** override due to call to coordinator service. */ public void setLicenseInfo(LicenseInfoExt licenseInfo) { lastExpirationEventDate = licenseInfo.getLastLicenseExpirationDateEventDate(); lastHeartbeatEventDate = licenseInfo.getLastHeartbeatEventDate(); registrationEventDate = licenseInfo.getLastRegistrationEventDate(); capacityExceededEventDate = licenseInfo.getLastCapacityExceededEventDate(); }
/** override due to call to coordinator service.. */ public LicenseInfoExt getLicenseInfo() { LicenseInfoExt licenseInfo = new LicenseInfoExt(); licenseInfo.setLastLicenseExpirationDateEventDate(lastExpirationEventDate); licenseInfo.setLastRegistrationEventDate(registrationEventDate); licenseInfo.setLastHeartbeatEventDate(lastHeartbeatEventDate); licenseInfo.setLastCapacityExceededEventDate(capacityExceededEventDate); return licenseInfo; }
/** Test case which recognizes that a registration event should not be sent. */ @Test public void testRegistrationEventFalse() throws Exception { MockCallHomeEventManager manager = new MockCallHomeEventManager(); LicenseInfoExt licenseInfo = new LicenseInfoExt(); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); String stringDate = sdf.format(new java.util.Date()); licenseInfo.setLastRegistrationEventDate(stringDate); manager.setLicenseInfo(licenseInfo); Assert.assertFalse(manager.doSendRegistration(licenseInfo)); }
/** 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)); }
/** Test case which recognizes that a license expiration event should be sent. */ @Test public void testLicenseExpirationEventTrue() 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); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); String stringDate = sdf.format(cal.getTime()); licenseInfo.setLastLicenseExpirationDateEventDate(stringDate); manager.setLicenseInfo(licenseInfo); Assert.assertTrue(manager.doSendLicenseExpiration(licenseInfo)); }
/** Call EMC connect service API to generate event files */ public void callEMCHome() { try { if (licenseInfo == null) { _log.warn("License information cannot be null. Returning without sending event."); return; } synchronized (SendEvent.class) { _log.info("callEMCHome(): start "); _fileId = licenseInfo.getProductId(); // Construct main connect home object that holds the Alert file. EmaApiConnectHome alertFile = new EmaApiConnectHome(); // Setup the logging information EmaApiLogType log = new EmaApiLogType(); log.setLogToDirectory(LOG_PATH); log.setLogToFilename(LOG_FILE_NAME + _fileId + ".log"); // build the common identifier section. buildIdentifierSection(alertFile); // build the common identifier section. buildConnectionSection(alertFile); // build the event section buildAlertFile(alertFile, log); _log.info("callEMCHome(): end "); } } catch (APIException api) { throw api; } catch (Exception e) { _log.error("Error occurred while sending event. {}", e); throw APIException.internalServerErrors.sendEventError(e.getMessage()); } }
/** Builds the Identifier element of ConnectHome */ private void buildIdentifierSection(EmaApiConnectHome alertFile) throws EmaException { EmaApiIdentifierType identifier = new EmaApiIdentifierType(); EmaApiNode node = alertFile.getNode(); identifier.setClarifyID(licenseInfo.getProductId()); identifier.setDeviceType(_identifierManager.findDeviceType()); identifier.setDeviceState(_identifierManager.findDeviceState()); identifier.setModel(licenseInfo.getModelId()); identifier.setOS(_identifierManager.findOS()); identifier.setOSVER(_identifierManager.findOSVersion()); identifier.setVendor("EMC"); identifier.setSiteName(""); identifier.setSerialNumber(licenseInfo.getProductId()); identifier.setUcodeVer(_identifierManager.findPlatform()); identifier.setWWN(licenseInfo.getLicenseTypeIndicator()); node.setIdentifier(identifier); overrideIdentifierData(identifier); }
/** * Build the Device object using the controller license information. * * @param feature * @param device * @throws LocalRepositoryException */ private void buildDevice(LicenseInfoExt licenseInfo, Device device) throws LocalRepositoryException { if (licenseInfo != null) { LocalRepository localRepository = LocalRepository.getInstance(); // this is in the format of node1, node2, etc. We need to get the integer portion. String nodeId = _coordinator.getPropertyInfo().getProperties().get("node_id"); String node; if (nodeId != null) { node = nodeId.substring(4); } else { node = CallHomeConstants.STANDALONE; } device.setSerialNumber(licenseInfo.getProductId() + "-" + node); device.setModelName(getBaseModelId(licenseInfo.getModelId()) + MODEL_NAME_SUFFIX); device.setIpAddress(_networkIpAddress); } }