Search in sources :

Example 11 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldPrependAlertSolnCorrectly.

@Test
public void shouldPrependAlertSolnCorrectly() {
    extAlert.setAlertOverrideProperty("1.solution", "-" + NEW_SOLN);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(NEW_SOLN + 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());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Example 12 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldReplaceAlertRefCorrectly.

@Test
public void shouldReplaceAlertRefCorrectly() {
    extAlert.setAlertOverrideProperty("1.reference", NEW_REF);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(ORIGINAL_SOLN, alert1.getSolution());
    assertEquals(ORIGINAL_OTHER, alert1.getOtherInfo());
    assertEquals(NEW_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());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Example 13 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldAppendAlertSolnCorrectly.

@Test
public void shouldAppendAlertSolnCorrectly() {
    extAlert.setAlertOverrideProperty("1.solution", "+" + NEW_SOLN);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(ORIGINAL_SOLN + NEW_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());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Example 14 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldReplaceAlertSolnCorrectly.

@Test
public void shouldReplaceAlertSolnCorrectly() {
    extAlert.setAlertOverrideProperty("1.solution", NEW_SOLN);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(NEW_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());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Example 15 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldPrependAlertDescCorrectly.

@Test
public void shouldPrependAlertDescCorrectly() {
    extAlert.setAlertOverrideProperty("1.description", "-" + NEW_DESC);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(NEW_DESC + 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());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Aggregations

Alert (org.parosproxy.paros.core.scanner.Alert)37 Test (org.junit.Test)15 ArrayList (java.util.ArrayList)7 RecordAlert (org.parosproxy.paros.db.RecordAlert)7 TableAlert (org.parosproxy.paros.db.TableAlert)7 HistoryReference (org.parosproxy.paros.model.HistoryReference)6 SiteNode (org.parosproxy.paros.model.SiteNode)6 ExtensionAlert (org.zaproxy.zap.extension.alert.ExtensionAlert)5 DatabaseException (org.parosproxy.paros.db.DatabaseException)4 TreePath (javax.swing.tree.TreePath)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 Session (org.parosproxy.paros.model.Session)2 SiteMap (org.parosproxy.paros.model.SiteMap)2 AlertNode (org.zaproxy.zap.extension.alert.AlertNode)2 Component (java.awt.Component)1 Dimension (java.awt.Dimension)1 HeadlessException (java.awt.HeadlessException)1 Point (java.awt.Point)1 MouseEvent (java.awt.event.MouseEvent)1 Enumeration (java.util.Enumeration)1