use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.
the class ExtensionAlertUnitTest method shouldAppendAlertNameCorrectly.
@Test
public void shouldAppendAlertNameCorrectly() {
extAlert.setAlertOverrideProperty("1.name", "+" + NEW_NAME);
Alert alert1 = newAlert(1);
extAlert.applyOverrides(alert1);
// When/Then
assertEquals(ORIGINAL_NAME + NEW_NAME, alert1.getName());
assertEquals(ORIGINAL_DESC, alert1.getDescription());
assertEquals(ORIGINAL_SOLN, alert1.getSolution());
assertEquals(ORIGINAL_OTHER, alert1.getOtherInfo());
assertEquals(ORIGINAL_REF, alert1.getReference());
// Check other alerts are not affected
Alert alert2 = newAlert(2);
extAlert.applyOverrides(alert2);
// When/Then
assertEquals(ORIGINAL_NAME, alert2.getName());
assertEquals(ORIGINAL_DESC, alert2.getDescription());
assertEquals(ORIGINAL_SOLN, alert2.getSolution());
assertEquals(ORIGINAL_OTHER, alert2.getOtherInfo());
assertEquals(ORIGINAL_REF, alert2.getReference());
}
use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.
the class AlertAddDialog method getBtnOk.
/**
* This method initializes btnStart
*
* @return javax.swing.JButton
*/
private JButton getBtnOk() {
if (btnOk == null) {
btnOk = new JButton();
btnOk.setText(Constant.messages.getString("alert.add.button.save"));
btnOk.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
Alert alert = alertViewPanel.getAlert();
try {
ExtensionAlert extAlert = (ExtensionAlert) Control.getSingleton().getExtensionLoader().getExtension(ExtensionAlert.NAME);
if (alert.getAlertId() >= 0) {
// Its an existing alert so save it
if (extAlert != null) {
extAlert.updateAlert(alert);
} else if (historyRef != null) {
// Update history tree
historyRef.updateAlert(alert);
extension.notifyHistoryItemChanged(historyRef);
}
} else {
if (httpMessage != null) {
historyRef = new HistoryReference(Model.getSingleton().getSession(), historyType, httpMessage);
}
alert.setSource(Alert.Source.MANUAL);
// Raise it
if (extAlert != null) {
extAlert.alertFound(alert, historyRef);
} else {
historyRef.addAlert(alert);
extension.notifyHistoryItemChanged(historyRef);
}
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
clearAndCloseDialog();
}
});
}
return btnOk;
}
Aggregations