Search in sources :

Example 1 with MailerResultCollector

use of org.apache.jmeter.reporters.MailerResultCollector in project jmeter by apache.

the class MailerVisualizer method clearData.

/**
     * Clears any stored sampling-informations.
     */
@Override
public synchronized void clearData() {
    if (getModel() != null) {
        MailerModel model = ((MailerResultCollector) getModel()).getMailerModel();
        model.clear();
        updateVisualizer(model);
    }
}
Also used : MailerResultCollector(org.apache.jmeter.reporters.MailerResultCollector) MailerModel(org.apache.jmeter.reporters.MailerModel)

Example 2 with MailerResultCollector

use of org.apache.jmeter.reporters.MailerResultCollector in project jmeter by apache.

the class MailerVisualizer method actionPerformed.

// ////////////////////////////////////////////////////////////
//
// Implementation of the ActionListener-Interface.
//
// ////////////////////////////////////////////////////////////
/**
     * Reacts on an ActionEvent (like pressing a button).
     *
     * @param e
     *            The ActionEvent with information about the event and its
     *            source.
     */
@Override
public void actionPerformed(ActionEvent e) {
    if (e.getSource() == testerButton) {
        ResultCollector testElement = getModel();
        modifyTestElement(testElement);
        try {
            MailerModel model = ((MailerResultCollector) testElement).getMailerModel();
            model.sendTestMail();
            //$NON-NLS-1$
            displayMessage(JMeterUtils.getResString("mail_sent"), false);
        } catch (AddressException ex) {
            log.error("Invalid mail address ", ex);
            displayMessage(//$NON-NLS-1$
            JMeterUtils.getResString("invalid_mail_address") + "\n" + ex.getMessage(), //$NON-NLS-1$
            true);
        } catch (MessagingException ex) {
            log.error("Couldn't send mail...", ex);
            displayMessage(//$NON-NLS-1$
            JMeterUtils.getResString("invalid_mail") + "\n" + ex.getMessage(), //$NON-NLS-1$
            true);
        }
    }
}
Also used : MailerResultCollector(org.apache.jmeter.reporters.MailerResultCollector) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) MailerModel(org.apache.jmeter.reporters.MailerModel) MailerResultCollector(org.apache.jmeter.reporters.MailerResultCollector) ResultCollector(org.apache.jmeter.reporters.ResultCollector)

Example 3 with MailerResultCollector

use of org.apache.jmeter.reporters.MailerResultCollector in project jmeter by apache.

the class MailerVisualizer method modifyTestElement.

/**
     * {@inheritDoc}
     */
@Override
public void modifyTestElement(TestElement c) {
    super.modifyTestElement(c);
    MailerModel mailerModel = ((MailerResultCollector) c).getMailerModel();
    mailerModel.setFailureLimit(failureLimitField.getText());
    mailerModel.setFailureSubject(failureSubjectField.getText());
    mailerModel.setFromAddress(fromField.getText());
    mailerModel.setSmtpHost(smtpHostField.getText());
    mailerModel.setSmtpPort(smtpPortField.getText());
    mailerModel.setLogin(smtpLoginField.getText());
    mailerModel.setPassword(smtpPasswordField.getText());
    mailerModel.setMailAuthType(authTypeCombo.getSelectedItem().toString());
    mailerModel.setSuccessLimit(successLimitField.getText());
    mailerModel.setSuccessSubject(successSubjectField.getText());
    mailerModel.setToAddress(addressField.getText());
}
Also used : MailerResultCollector(org.apache.jmeter.reporters.MailerResultCollector) MailerModel(org.apache.jmeter.reporters.MailerModel)

Example 4 with MailerResultCollector

use of org.apache.jmeter.reporters.MailerResultCollector in project jmeter by apache.

the class MailerVisualizer method createTestElement.

/**
     * Makes MailerVisualizer storable.
     */
@Override
public TestElement createTestElement() {
    ResultCollector model = getModel();
    if (model == null) {
        model = new MailerResultCollector();
        setModel(model);
    }
    modifyTestElement(model);
    return model;
}
Also used : MailerResultCollector(org.apache.jmeter.reporters.MailerResultCollector) MailerResultCollector(org.apache.jmeter.reporters.MailerResultCollector) ResultCollector(org.apache.jmeter.reporters.ResultCollector)

Aggregations

MailerResultCollector (org.apache.jmeter.reporters.MailerResultCollector)4 MailerModel (org.apache.jmeter.reporters.MailerModel)3 ResultCollector (org.apache.jmeter.reporters.ResultCollector)2 MessagingException (javax.mail.MessagingException)1 AddressException (javax.mail.internet.AddressException)1