Skip to content

Commit

Permalink
Merge pull request #5606 from thc202/automation/move-job-alert-tests
Browse files Browse the repository at this point in the history
automation: let job report alert tests support
  • Loading branch information
kingthorin committed Jul 25, 2024
2 parents e8fb7cb + dfe2fc2 commit 0132d38
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ public void logTestsToProgress(AutomationProgress progress) {
tests.forEach(t -> t.logToProgress(progress));
}

public boolean supportsAlertTests() {
return false;
}

public boolean supportsMonitorTests() {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import org.parosproxy.paros.view.View;
import org.zaproxy.addon.automation.AutomationEventPublisher;
import org.zaproxy.addon.automation.AutomationJob;
import org.zaproxy.addon.automation.jobs.ActiveScanJob;
import org.zaproxy.addon.automation.jobs.PassiveScanWaitJob;
import org.zaproxy.addon.automation.tests.AbstractAutomationTest;
import org.zaproxy.addon.automation.tests.AutomationAlertTest;
import org.zaproxy.addon.automation.tests.AutomationMonitorTest;
Expand Down Expand Up @@ -60,7 +58,7 @@ public AddTestDialog(AutomationJob job) {
}
testNames.add(Constant.messages.getString(URL_PRESENCE_TEST_NAME));

if (job instanceof PassiveScanWaitJob || job instanceof ActiveScanJob) {
if (job.supportsAlertTests()) {
testNames.add(Constant.messages.getString(ALERT_TEST_NAME));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public ActiveScanJob() {
data = new Data(this, this.parameters, this.policyDefinition);
}

@Override
public boolean supportsAlertTests() {
return true;
}

private ExtensionActiveScan getExtAScan() {
if (extAScan == null) {
extAScan =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public PassiveScanWaitJob() {
this.data = new Data(this, parameters);
}

@Override
public boolean supportsAlertTests() {
return true;
}

@Override
public void runJob(AutomationEnvironment env, AutomationProgress progress) {
ExtensionPassiveScan extPScan = getExtPassiveScan();
Expand Down

0 comments on commit 0132d38

Please sign in to comment.