Jagger
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
JLoadScenario JLoadScenarioProvider.exampleJaggerLoadScenario ( )

Definition at line 58 of file JLoadScenarioProvider.java.

References com.griddynamics.jagger.user.test.configurations.load.JLoadProfileRps.Builder.build(), com.griddynamics.jagger.user.test.configurations.loadbalancer.JLoadBalancer.Builder.build(), com.griddynamics.jagger.user.test.configurations.JLoadTest.Builder.build(), com.griddynamics.jagger.user.test.configurations.limits.JLimitVsBaseline.builder(), com.griddynamics.jagger.user.test.configurations.limits.JLimitVsRefValue.builder(), com.griddynamics.jagger.user.test.configurations.loadbalancer.JLoadBalancer.builder(), com.griddynamics.jagger.user.test.configurations.JParallelTestsGroup.builder(), com.griddynamics.jagger.user.test.configurations.JLoadScenario.builder(), com.griddynamics.jagger.user.test.configurations.load.JLoadProfileRps.builder(), com.griddynamics.jagger.user.test.configurations.JLoadTest.builder(), com.griddynamics.jagger.user.test.configurations.JTestDefinition.builder(), CustomHttpInvokerProvider.nonVerbose(), com.griddynamics.jagger.user.test.configurations.limits.auxiliary.LowWarnThresh.of(), com.griddynamics.jagger.user.test.configurations.limits.auxiliary.LowErrThresh.of(), com.griddynamics.jagger.user.test.configurations.limits.auxiliary.UpErrThresh.of(), com.griddynamics.jagger.user.test.configurations.limits.auxiliary.RefValue.of(), com.griddynamics.jagger.user.test.configurations.limits.auxiliary.UpWarnThresh.of(), com.griddynamics.jagger.user.test.configurations.termination.auxiliary.IterationsNumber.of(), com.griddynamics.jagger.user.test.configurations.termination.auxiliary.MaxDurationInSeconds.of(), com.griddynamics.jagger.user.test.configurations.auxiliary.Id.of(), com.griddynamics.jagger.user.test.configurations.load.auxiliary.RequestsPerSecond.of(), com.griddynamics.jagger.engine.e1.collector.DefaultResponseValidatorProvider.of(), com.griddynamics.jagger.user.test.configurations.termination.JTerminationCriteriaIterations.of(), com.griddynamics.jagger.user.test.configurations.limits.auxiliary.JMetricName.PERF_LATENCY_PERCENTILE(), com.griddynamics.jagger.user.test.configurations.limits.auxiliary.JMetricName.PERF_SUCCESS_RATE_OK, com.griddynamics.jagger.user.test.configurations.limits.auxiliary.JMetricName.PERF_THROUGHPUT, com.griddynamics.jagger.user.test.configurations.JTestDefinition.Builder.withInvoker(), com.griddynamics.jagger.user.test.configurations.limits.JLimit.Builder.withOnlyErrors(), com.griddynamics.jagger.user.test.configurations.loadbalancer.JLoadBalancer.Builder.withRandomSeed(), and com.griddynamics.jagger.user.test.configurations.load.JLoadProfileRps.Builder.withWarmUpTimeInMilliseconds().

58  {
59 
60  // Example of using JaggerPropertiesProvider
61  String testDefinitionComment = getTestPropertyValue("example.jagger.test.definition.comment");
62 
63  JTestDefinition jTestDefinition = JTestDefinition
64  .builder(Id.of("exampleJaggerTestDefinition"), new EndpointsProvider())
65  // optional
66  .withComment(testDefinitionComment)
68  .withQueryProvider(new QueriesProvider())
69  .withLoadBalancer(JLoadBalancer.builder(ROUND_ROBIN).withRandomSeed(42).build())
70  .addValidator(new ExampleResponseValidatorProvider("we are always good"))
72  .addListener(new NotNullInvocationListener())
73  .build();
74 
75  // Example of using JaggerPropertiesProvider
76  Long iterationsNumber = Long.valueOf(getTestPropertyValue("example.jagger.load.scenario.termination.iterations"));
77  Long maxDurationInSeconds = Long.valueOf(getTestPropertyValue("example.jagger.load.scenario.termination.max.duration.seconds"));
79  .of(IterationsNumber.of(iterationsNumber), MaxDurationInSeconds.of(maxDurationInSeconds));
80 
81  JLoadProfile jLoadProfileRps = JLoadProfileRps
83  .withMaxLoadThreads(10)
85  .build();
86 
87  // For standard metrics use JMetricName.
88  // JLimitVsRefValue is used to compare the results with the referenced value.
90  // the threshold is relative.
91  .withOnlyWarnings(LowWarnThresh.of(0.99), UpWarnThresh.of(1.01))
92  .build();
93 
94  // For standard metrics use JMetricName.
95  // JLimitVsBaseline is used to compare the results with the baseline.
96  // Use 'chassis.engine.e1.reporting.session.comparison.baseline.session.id' to set baseline.
98  // the threshold is relative.
99  .withOnlyErrors(LowErrThresh.of(0.99), UpErrThresh.of(1.00001))
100  .build();
101 
102  // For standard metrics use JMetricName.
103  // JMetricName.PERF_LATENCY_PERCENTILE is used to set limits for latency percentile metrics.
104  JLimit latencyPercentileLimit = JLimitVsRefValue.builder(JMetricName.PERF_LATENCY_PERCENTILE(95D), RefValue.of(0.1D))
105  // the threshold is relative.
106  .withOnlyWarnings(LowWarnThresh.of(0.50), UpWarnThresh.of(1.5))
107  .build();
108 
109 
110  JLoadTest jLoadTest = JLoadTest
111  .builder(Id.of("exampleJaggerLoadTest"), jTestDefinition, jLoadProfileRps, jTerminationCriteria)
112  .addListener(new CollectThreadsTestListener())
113  .withLimits(successRateLimit, throughputLimit, latencyPercentileLimit)
114  .build();
115 
116  JParallelTestsGroup jParallelTestsGroup = JParallelTestsGroup
117  .builder(Id.of("exampleJaggerParallelTestsGroup"), jLoadTest)
118  .addListener(new ExampleTestGroupListener())
119  .build();
120 
121  // For JLoadScenario which is supposed to be executed by Jagger its ID must be set to 'jagger.load.scenario.id.to.execute' property's value
122  return JLoadScenario.builder(Id.of("exampleJaggerLoadScenario"), jParallelTestsGroup)
123  .addListener(new ExampleLoadScenarioListener())
124  .withLatencyPercentiles(Arrays.asList(10D, 25.5D, 42D, 95D))
125  .build();
126  }

Here is the call graph for this function: