@Test public void testExecute() { KettleLogStore.init(); Result previousResult = new Result(); JobEntryMailValidator validator = new JobEntryMailValidator(); Result result = validator.execute( previousResult, 0 ); assertNotNull( result ); }
public Result execute( Result previousResult, int nr ) { Result result = previousResult; result.setNrErrors( 1 ); result.setResult( false ); String realEmailAddress = environmentSubstitute( emailAddress ); if ( Utils.isEmpty( realEmailAddress ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailEmpty" ) ); return result; } String realSender = environmentSubstitute( emailSender ); if ( smtpCheck ) { if ( Utils.isEmpty( realSender ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailSenderEmpty" ) ); return result; } } String realDefaultSMTP = environmentSubstitute( defaultSMTP ); int timeOut = Const.toInt( environmentSubstitute( timeout ), 0 ); String[] mailsCheck = realEmailAddress.split( " " ); boolean exitloop = false; boolean mailIsValid = false; String MailError = null; for ( int i = 0; i < mailsCheck.length && !exitloop; i++ ) { String email = mailsCheck[i]; if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.CheckingMail", email ) ); } MailValidationResult resultValidator = MailValidation.isAddressValid( log, email, realSender, realDefaultSMTP, timeOut, smtpCheck ); mailIsValid = resultValidator.isValide(); MailError = resultValidator.getErrorMessage(); if ( log.isDetailed() ) { if ( mailIsValid ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailValid", email ) ); } else { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailNotValid", email ) ); logDetailed( MailError ); } } if ( !resultValidator.isValide() ) { exitloop = true; } } result.setResult( mailIsValid ); if ( mailIsValid ) { result.setNrErrors( 0 ); } return result; }
JobEntryMailValidator extends JobEntryBase implements Cloneable, JobEntryInterface { public Result execute( Result previousResult, int nr ) { Result result = previousResult; result.setNrErrors( 1 ); result.setResult( false ); String realEmailAddress = environmentSubstitute( emailAddress ); if ( Utils.isEmpty( realEmailAddress ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailEmpty" ) ); return result; } String realSender = environmentSubstitute( emailSender ); if ( smtpCheck ) { if ( Utils.isEmpty( realSender ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailSenderEmpty" ) ); return result; } } String realDefaultSMTP = environmentSubstitute( defaultSMTP ); int timeOut = Const.toInt( environmentSubstitute( timeout ), 0 ); String[] mailsCheck = realEmailAddress.split( " " ); boolean exitloop = false; boolean mailIsValid = false; String MailError = null; for ( int i = 0; i < mailsCheck.length && !exitloop; i++ ) { String email = mailsCheck[i]; if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.CheckingMail", email ) ); } MailValidationResult resultValidator = MailValidation.isAddressValid( log, email, realSender, realDefaultSMTP, timeOut, smtpCheck ); mailIsValid = resultValidator.isValide(); MailError = resultValidator.getErrorMessage(); if ( log.isDetailed() ) { if ( mailIsValid ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailValid", email ) ); } else { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailNotValid", email ) ); logDetailed( MailError ); } } if ( !resultValidator.isValide() ) { exitloop = true; } } result.setResult( mailIsValid ); if ( mailIsValid ) { result.setNrErrors( 0 ); } return result; } }
JobEntryMailValidator extends JobEntryBase implements Cloneable, JobEntryInterface { public Result execute( Result previousResult, int nr ) { Result result = previousResult; result.setNrErrors( 1 ); result.setResult( false ); String realEmailAddress = environmentSubstitute( emailAddress ); if ( Utils.isEmpty( realEmailAddress ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailEmpty" ) ); return result; } String realSender = environmentSubstitute( emailSender ); if ( smtpCheck ) { if ( Utils.isEmpty( realSender ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailSenderEmpty" ) ); return result; } } String realDefaultSMTP = environmentSubstitute( defaultSMTP ); int timeOut = Const.toInt( environmentSubstitute( timeout ), 0 ); String[] mailsCheck = realEmailAddress.split( " " ); boolean exitloop = false; boolean mailIsValid = false; String MailError = null; for ( int i = 0; i < mailsCheck.length && !exitloop; i++ ) { String email = mailsCheck[i]; if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.CheckingMail", email ) ); } MailValidationResult resultValidator = MailValidation.isAddressValid( log, email, realSender, realDefaultSMTP, timeOut, smtpCheck ); mailIsValid = resultValidator.isValide(); MailError = resultValidator.getErrorMessage(); if ( log.isDetailed() ) { if ( mailIsValid ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailValid", email ) ); } else { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailNotValid", email ) ); logDetailed( MailError ); } } if ( !resultValidator.isValide() ) { exitloop = true; } } result.setResult( mailIsValid ); if ( mailIsValid ) { result.setNrErrors( 0 ); } return result; } JobEntryMailValidator( String n, String scr );  JobEntryMailValidator(); }
JobEntryMailValidator extends JobEntryBase implements Cloneable, JobEntryInterface { public Result execute( Result previousResult, int nr ) { Result result = previousResult; result.setNrErrors( 1 ); result.setResult( false ); String realEmailAddress = environmentSubstitute( emailAddress ); if ( Utils.isEmpty( realEmailAddress ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailEmpty" ) ); return result; } String realSender = environmentSubstitute( emailSender ); if ( smtpCheck ) { if ( Utils.isEmpty( realSender ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailSenderEmpty" ) ); return result; } } String realDefaultSMTP = environmentSubstitute( defaultSMTP ); int timeOut = Const.toInt( environmentSubstitute( timeout ), 0 ); String[] mailsCheck = realEmailAddress.split( " " ); boolean exitloop = false; boolean mailIsValid = false; String MailError = null; for ( int i = 0; i < mailsCheck.length && !exitloop; i++ ) { String email = mailsCheck[i]; if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.CheckingMail", email ) ); } MailValidationResult resultValidator = MailValidation.isAddressValid( log, email, realSender, realDefaultSMTP, timeOut, smtpCheck ); mailIsValid = resultValidator.isValide(); MailError = resultValidator.getErrorMessage(); if ( log.isDetailed() ) { if ( mailIsValid ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailValid", email ) ); } else { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailNotValid", email ) ); logDetailed( MailError ); } } if ( !resultValidator.isValide() ) { exitloop = true; } } result.setResult( mailIsValid ); if ( mailIsValid ) { result.setNrErrors( 0 ); } return result; } JobEntryMailValidator( String n, String scr );  JobEntryMailValidator(); void setSMTPCheck( boolean smtpcheck ); boolean isSMTPCheck(); String getEmailAddress(); void setEmailAddress( String emailAddress ); String getTimeOut(); void setTimeOut( String timeout ); String getDefaultSMTP(); void setDefaultSMTP( String defaultSMTP ); String geteMailSender(); void seteMailSender( String emailSender ); Object clone(); String getXML(); void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
    Repository rep, IMetaStore metaStore ); void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,
    List<SlaveServer> slaveServers ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ); Result execute( Result previousResult, int nr ); boolean evaluates(); @Override void check( List<CheckResultInterface> remarks, JobMeta jobMeta, VariableSpace space,
    Repository repository, IMetaStore metaStore ); }
JobEntryMailValidator extends JobEntryBase implements Cloneable, JobEntryInterface { public Result execute( Result previousResult, int nr ) { Result result = previousResult; result.setNrErrors( 1 ); result.setResult( false ); String realEmailAddress = environmentSubstitute( emailAddress ); if ( Utils.isEmpty( realEmailAddress ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailEmpty" ) ); return result; } String realSender = environmentSubstitute( emailSender ); if ( smtpCheck ) { if ( Utils.isEmpty( realSender ) ) { logError( BaseMessages.getString( PKG, "JobEntryMailValidator.Error.EmailSenderEmpty" ) ); return result; } } String realDefaultSMTP = environmentSubstitute( defaultSMTP ); int timeOut = Const.toInt( environmentSubstitute( timeout ), 0 ); String[] mailsCheck = realEmailAddress.split( " " ); boolean exitloop = false; boolean mailIsValid = false; String MailError = null; for ( int i = 0; i < mailsCheck.length && !exitloop; i++ ) { String email = mailsCheck[i]; if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.CheckingMail", email ) ); } MailValidationResult resultValidator = MailValidation.isAddressValid( log, email, realSender, realDefaultSMTP, timeOut, smtpCheck ); mailIsValid = resultValidator.isValide(); MailError = resultValidator.getErrorMessage(); if ( log.isDetailed() ) { if ( mailIsValid ) { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailValid", email ) ); } else { logDetailed( BaseMessages.getString( PKG, "JobEntryMailValidator.MailNotValid", email ) ); logDetailed( MailError ); } } if ( !resultValidator.isValide() ) { exitloop = true; } } result.setResult( mailIsValid ); if ( mailIsValid ) { result.setNrErrors( 0 ); } return result; } JobEntryMailValidator( String n, String scr );  JobEntryMailValidator(); void setSMTPCheck( boolean smtpcheck ); boolean isSMTPCheck(); String getEmailAddress(); void setEmailAddress( String emailAddress ); String getTimeOut(); void setTimeOut( String timeout ); String getDefaultSMTP(); void setDefaultSMTP( String defaultSMTP ); String geteMailSender(); void seteMailSender( String emailSender ); Object clone(); String getXML(); void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
    Repository rep, IMetaStore metaStore ); void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,
    List<SlaveServer> slaveServers ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ); Result execute( Result previousResult, int nr ); boolean evaluates(); @Override void check( List<CheckResultInterface> remarks, JobMeta jobMeta, VariableSpace space,
    Repository repository, IMetaStore metaStore );  }