@Parameters({"logwrite-data","logwrite-modulename","logwrite-domain","logwrite-log-level","logwrite-login-id","logwrite-ip-addr","logwrite-host-name","logwrite-message-id","logwrite-number-of-records"}) @Test(groups={"api-adminwrite"}) public void writeAdminLogRecord(String rData,String rModuleName,String rDomain,String rLogLevel,String rLoginId,String rIPAddr,String rHostName,String rMsgId,String rNumRecs) throws AMLogException {
  LogRecord lR=null;
  Level llevel=null;
  int numRecs=0;
  if ((rNumRecs != null) && (rNumRecs.length() > 0)) {
    try {
      numRecs=Integer.parseInt(rNumRecs);
    }
 catch (    NumberFormatException nfe) {
      log(Level.WARNING,"writeAdminLogRecord",nfe.getMessage());
      numRecs=1;
    }
  }
  llevel=getLogLevel(rLogLevel);
  int totalRecs=0;
  SSOToken adminToken=getAdminSSOToken();
  for (int i=(numRecs - 1); i >= 0; i--) {
    lR=new LogRecord(llevel,msgDataPrefix + i + "|"+ rData,adminToken);
    if ((rDomain != null) && (rDomain.length() > 0)) {
      lR.addLogInfo(LogConstants.DOMAIN,rDomain);
    }
    lR.addLogInfo(LogConstants.LOGIN_ID,"amAdmin");
    if ((rIPAddr != null) && (rIPAddr.length() > 0)) {
      lR.addLogInfo(LogConstants.IP_ADDR,rIPAddr);
    }
    if ((rHostName != null) && (rHostName.length() > 0)) {
      lR.addLogInfo(LogConstants.HOST_NAME,rHostName);
    }
    if ((rModuleName != null) && (rModuleName.length() > 0)) {
      lR.addLogInfo(LogConstants.MODULE_NAME,rModuleName);
    }
    if ((rMsgId != null) && (rMsgId.length() > 0)) {
      String msgid=rMsgId + i;
      lR.addLogInfo(LogConstants.MESSAGE_ID,msgid);
    }
    try {
      logger.log(lR,adminToken);
      totalRecs++;
    }
 catch (    AMLogException alex) {
      log(Level.SEVERE,"writeAdminLogRecord",alex.getMessage());
      throw alex;
    }
  }
}

@ Parameters ( { "logwrite-data" , "logwrite-modulename" , "logwrite-domain" , "logwrite-log-level" , "logwrite-login-id" , "logwrite-ip-addr" , "logwrite-host-name" , "logwrite-message-id" , "logwrite-number-of-records" } ) @ Test ( groups = { "api-adminwrite" } ) public void writeAdminLogRecord ( String rData , String rModuleName , String rDomain , String rLogLevel , String rLoginId , String rIPAddr , String rHostName , String rMsgId , String rNumRecs ) throws AMLogException { LogRecord lR = null ; Level llevel = null ; int numRecs = 0 ; if ( ( rNumRecs != null ) && ( rNumRecs . length ( ) > 0 ) ) { try { numRecs = Integer . parseInt ( rNumRecs ) ; } catch ( NumberFormatException nfe ) { log ( Level . WARNING , "writeAdminLogRecord" , nfe . getMessage ( ) ) ; numRecs = 1 ; } } llevel = getLogLevel ( rLogLevel ) ; int totalRecs = 0 ; SSOToken adminToken = getAdminSSOToken ( ) ; for ( int i = ( numRecs - 1 ) ; i >= 0 ; i -- ) { lR = new LogRecord ( llevel , msgDataPrefix + i + "|" + rData , adminToken ) ; if ( ( rDomain != null ) && ( rDomain . length ( ) > 0 ) ) { lR . addLogInfo ( LogConstants . DOMAIN , rDomain ) ; } lR . addLogInfo ( LogConstants . LOGIN_ID , "amAdmin" ) ; if ( ( rIPAddr != null ) && ( rIPAddr . length ( ) > 0 ) ) { lR . addLogInfo ( LogConstants . IP_ADDR , rIPAddr ) ; } if ( ( rHostName != null ) && ( rHostName . length ( ) > 0 ) ) { lR . addLogInfo ( LogConstants . HOST_NAME , rHostName ) ; } if ( ( rModuleName != null ) && ( rModuleName . length ( ) > 0 ) ) { lR . addLogInfo ( LogConstants . MODULE_NAME , rModuleName ) ; } if ( ( rMsgId != null ) && ( rMsgId . length ( ) > 0 ) ) { String msgid = rMsgId + i ; lR . addLogInfo ( LogConstants . MESSAGE_ID , msgid ) ; } try { logger . log ( lR , adminToken ) ; totalRecs ++ ; } catch ( AMLogException alex ) { log ( Level . SEVERE , "writeAdminLogRecord" , alex . getMessage ( ) ) ; throw alex ; } } }
need : only the amadmin ssotoken ( used in logrecord ) , since can ' t ( currently ) use user ssotokens . also means the log delegation can ' t be tested . column values data module_name domain log_level login_id ip_addr host_name message_id number of records to write
