Package com.cyara.apisamples
Class EligibleCampaignRun
java.lang.Object
com.cyara.apisamples.EligibleCampaignRun
public class EligibleCampaignRun
extends java.lang.Object
Used to create a scheduled campaign run with test cases that have the
same frequency and fall under the same runtimes. While this
class in and of itself doesn't create a campaign or insert
itself into one, we use it in
SchedulePulseCampaigns
to build and schedule campaigns with the most efficient combinations and schedules
This is not an official Cyara product and is not officially supported. It is used for demonstration and training purposes. For assistance, contact chris.ryan@cyara.com
- Version:
- 1.0
- Author:
- Chris Ryan
- See Also:
SchedulePulseCampaigns
,EligibleTestCase
-
Field Summary
Fields Modifier and Type Field Description private java.util.Date
actualOneAndDoneEndDate
private int
campaignFreq
private java.util.Date
campaignRunEndDate
private java.util.Date
campaignRunStartDate
private int
eligibleRunId
private java.util.ArrayList<EligibleTestCase>
eligibleTestCases
private int
requiredPortsForFrequencyRun
private int
runDuration
private boolean
runsMultipleTimes
-
Constructor Summary
Constructors Constructor Description EligibleCampaignRun(java.util.Date campaignRunStartDate, java.util.Date campaignRunEndDate, java.util.ArrayList<EligibleTestCase> eligibleTestCases, int campaignFreq, int requiredPortsForFrequencyRun, int runDuration, boolean runsMultipleTimes, java.util.Date actualOneAndDoneEndDate, int eligibleRunId)
The constructor to create an EligibleCampaignRun object -
Method Summary
Modifier and Type Method Description java.util.Date
getActualOneAndDoneEndDate()
This is only used if the campaign doesn't run multiple times, implying it's for a regression monitoring suite.int
getCampaignFrequency()
How often this campaign run should execute.(package private) java.util.ArrayList<EligibleTestCase>
getEligibleTestCases()
When building out this run, all the test cases that have the same frequency and have overlapping runtimes are grouped together.java.util.Date
getEndDate()
The common end time for this scheduled campaign run based on the eligible test cases this run hasint
getId()
Retrieve the unique ID for this campaign run.int
getRequiredPortsForFrequencyRun()
The amount of ports this campaign run needs to run fast enough for the campaignFreqint
getRunDuration()
When building out this run, all the test cases that have the same frequency and have overlapping runtimes are grouped together.boolean
getRunsMultipleTimes()
Campaigns can have a schedule of 5 minutes per day for a large set of test cases, especially when doing a regression monitoring suite.java.util.Date
getStartDate()
The common start time for this scheduled campaign run based on the eligible test cases this run hasjava.lang.String
toString()
-
Field Details
-
campaignRunStartDate
private java.util.Date campaignRunStartDate -
campaignRunEndDate
private java.util.Date campaignRunEndDate -
eligibleTestCases
-
campaignFreq
private int campaignFreq -
requiredPortsForFrequencyRun
private int requiredPortsForFrequencyRun -
runDuration
private int runDuration -
runsMultipleTimes
private boolean runsMultipleTimes -
actualOneAndDoneEndDate
private java.util.Date actualOneAndDoneEndDate -
eligibleRunId
private int eligibleRunId
-
-
Constructor Details
-
EligibleCampaignRun
public EligibleCampaignRun(java.util.Date campaignRunStartDate, java.util.Date campaignRunEndDate, java.util.ArrayList<EligibleTestCase> eligibleTestCases, int campaignFreq, int requiredPortsForFrequencyRun, int runDuration, boolean runsMultipleTimes, java.util.Date actualOneAndDoneEndDate, int eligibleRunId)The constructor to create an EligibleCampaignRun object- Parameters:
campaignRunStartDate
- The mathematically calculated scheduled start time for this campaign runcampaignRunEndDate
- The mathematically calculated scheduled end time for this campaign runeligibleTestCases
- The collection of test cases that will be run together as part of this runcampaignFreq
- The Run Every for this campaign, is the same as each EligibleTestCase frequencyrequiredPortsForFrequencyRun
- The mathematically calculated smallest number of ports to achieve your campaignFreqrunDuration
- The mathematically calculated number of minutes this campaign takes to run with the campaignFreq and calculated requiredPortsForFrequencyRunrunsMultipleTimes
- If this campaign will execute more than once for this runtimeactualOneAndDoneEndDate
- If the campaign doesn't run multiple times, it could be a regression monitoring suite, so we calculate when the one run actually endseligibleRunId
- The unique ID we gave this run
-
-
Method Details
-
getCampaignFrequency
public int getCampaignFrequency()How often this campaign run should execute. Used when combining other eligible campaign runs together and when creating the campaign- Returns:
- The Run Every for this campaign run
- Since:
- 1.0
-
getId
public int getId()Retrieve the unique ID for this campaign run. Used to group together runs with the same configurations.- Returns:
- The unique ID we gave this run
- Since:
- 1.0
-
getStartDate
public java.util.Date getStartDate()The common start time for this scheduled campaign run based on the eligible test cases this run has- Returns:
- The time the run's schedule starts for this campaign run
- Since:
- 1.0
-
getEndDate
public java.util.Date getEndDate()The common end time for this scheduled campaign run based on the eligible test cases this run has- Returns:
- The time the run's schedule end for this campaign run
- Since:
- 1.0
-
getRequiredPortsForFrequencyRun
public int getRequiredPortsForFrequencyRun()The amount of ports this campaign run needs to run fast enough for the campaignFreq- Returns:
- The mathematically calculated smallest number of ports to achieve your campaignFreq
- Since:
- 1.0
-
getEligibleTestCases
java.util.ArrayList<EligibleTestCase> getEligibleTestCases()When building out this run, all the test cases that have the same frequency and have overlapping runtimes are grouped together. This is that group- Returns:
- The collection of test cases that will be run together as part of this run
- Since:
- 1.0
-
getRunDuration
public int getRunDuration()When building out this run, all the test cases that have the same frequency and have overlapping runtimes are grouped together. This is that group- Returns:
- The mathematically calculated number of minutes this campaign takes to run with the campaignFreq and calculated requiredPortsForFrequencyRun
- Since:
- 1.0
-
getRunsMultipleTimes
public boolean getRunsMultipleTimes()Campaigns can have a schedule of 5 minutes per day for a large set of test cases, especially when doing a regression monitoring suite. In Cyara, a campaign schedule just means when the campaign can launch.We use this flag to determine if that's the case, and then calculate actualOneAndDoneEndDate
- Returns:
- If this campaign will execute more than once for this runtime
- Since:
- 1.0
-
getActualOneAndDoneEndDate
public java.util.Date getActualOneAndDoneEndDate()This is only used if the campaign doesn't run multiple times, implying it's for a regression monitoring suite. Typically, a Pulse campaign is expected to end before the schedule run time ends.But in Cyara, a campaign schedule just means when the campaign can launch. So the schedule run time end doesn't represent a hard stop. Thus, if this run is a regression monitoring suite and lasts longer than the schedule, we need to account for the ports this run will still be using and until when. This is that when.
- Returns:
- The amount of time this campaign is actually going to run for
- Since:
- 1.0
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-