コード例 #1
0
    /** override due to call to coordinator service. */
    public void setLicenseInfo(LicenseInfoExt licenseInfo) {

      lastExpirationEventDate = licenseInfo.getLastLicenseExpirationDateEventDate();
      lastHeartbeatEventDate = licenseInfo.getLastHeartbeatEventDate();
      registrationEventDate = licenseInfo.getLastRegistrationEventDate();
      capacityExceededEventDate = licenseInfo.getLastCapacityExceededEventDate();
    }
コード例 #2
0
 /** 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;
 }
コード例 #3
0
  /** 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));
  }
コード例 #4
0
  /** 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));
  }
コード例 #5
0
  /** 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));
  }
コード例 #6
0
 /** 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());
   }
 }
コード例 #7
0
 /** 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);
 }
コード例 #8
0
  /**
   * 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);
    }
  }