Class SchedulePulseCampaigns

java.lang.Object
com.cyara.apisamples.SchedulePulseCampaigns

public class SchedulePulseCampaigns
extends java.lang.Object
A program to completely automate the creation and scheduling of your Pulse campaigns. Will calculate the most efficient schedule and the most efficient port usage.

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.1
Author:
Chris Ryan
See Also:
EligibleCampaignRun, EligibleTestCase
  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) static java.lang.String pulseFolder  
    (package private) static int pulsePlanId  
  • Constructor Summary

    Constructors 
    Constructor Description
    SchedulePulseCampaigns()  
  • Method Summary

    Modifier and Type Method Description
    private static void findPortBreaches​(java.util.ArrayList<EligibleCampaignRun> allRuns, int planConcurrency)
    Loops through all the campaign runs and checks for any combination of runs taking place simultaneously that breach the Pulse plan's port count
    private static java.util.ArrayList<java.lang.Integer> getPulseTestCases​(ApiFunctionalities connInfo)
    Loops through all the test case on the account, making the API request to list test cases until we've capture and stored all of them.
    private static int[] getReqPortsForFreq​(java.util.ArrayList<EligibleTestCase> eligibleTestCasesForCurTimeAndFreq, int desiredFreq)
    Loops through all the eligible test cases that will become a campaign run and checks for duration errors, calculates how many ports these test cases will use, how long the run will take, and how many calls will be made.
    private static java.util.ArrayList<java.lang.Integer> getUniqueFrequencies​(java.util.ArrayList<java.lang.String> pulseTestCaseXmls, ApiFunctionalities connInfo)
    Loops through every tracked test case, storing every unique "frequency" field in the description json
    static void main​(java.lang.String[] argv)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • main

      public static void main​(java.lang.String[] argv)
    • findPortBreaches

      private static void findPortBreaches​(java.util.ArrayList<EligibleCampaignRun> allRuns, int planConcurrency)
      Loops through all the campaign runs and checks for any combination of runs taking place simultaneously that breach the Pulse plan's port count
      Parameters:
      allRuns - All the campaign runs (not in campaigns, just the schedule, test cases, frequency, ports, etc.)
      planConcurrency - The number of concurrent calls the Cyara plan supports
      Since:
      1.0
    • getReqPortsForFreq

      private static int[] getReqPortsForFreq​(java.util.ArrayList<EligibleTestCase> eligibleTestCasesForCurTimeAndFreq, int desiredFreq)
      Loops through all the eligible test cases that will become a campaign run and checks for duration errors, calculates how many ports these test cases will use, how long the run will take, and how many calls will be made.
      Parameters:
      eligibleTestCasesForCurTimeAndFreq - All the test cases that are running during the current time when this method is called with the same frequency as desired
      desiredFreq - The frequency that was in the desc json for these test cases
      Returns:
      An int array containing the least number of ports required, the run duration, and the total number of calls for this run
      Since:
      1.0
    • getUniqueFrequencies

      private static java.util.ArrayList<java.lang.Integer> getUniqueFrequencies​(java.util.ArrayList<java.lang.String> pulseTestCaseXmls, ApiFunctionalities connInfo)
      Loops through every tracked test case, storing every unique "frequency" field in the description json
      Parameters:
      pulseTestCaseXmls - The XML of every tracked test case
      connInfo - The controller to the API credentials and methods
      Returns:
      An Integer ArrayList with every unique frequency
      Since:
      1.0
    • getPulseTestCases

      private static java.util.ArrayList<java.lang.Integer> getPulseTestCases​(ApiFunctionalities connInfo)
      Loops through all the test case on the account, making the API request to list test cases until we've capture and stored all of them.
      Parameters:
      connInfo - The controller to the API credentials and methods
      Returns:
      The ArrayList of every test case on the account
      Since:
      1.0