1 package com.griddynamics.jagger.user.test.configurations;
3 import com.griddynamics.jagger.engine.e1.Provider;
4 import com.griddynamics.jagger.engine.e1.collector.loadscenario.ExampleLoadScenarioListener;
5 import com.griddynamics.jagger.engine.e1.collector.loadscenario.LoadScenarioListener;
6 import com.griddynamics.jagger.user.test.configurations.auxiliary.Id;
8 import com.google.common.collect.Lists;
10 import java.util.ArrayList;
11 import java.util.Collections;
12 import java.util.List;
13 import java.util.Objects;
14 import java.util.stream.Collectors;
36 private final String id;
37 private final List<JParallelTestsGroup> testGroups;
38 private final List<Double> percentileValues;
39 private final List<Provider<LoadScenarioListener>> listeners;
42 this.
id = builder.id.
value();
43 this.testGroups = builder.testGroups;
44 this.percentileValues = builder.percentileValues;
45 this.listeners = builder.listeners;
56 return new Builder(
id, testGroups);
68 List<JParallelTestsGroup> jParallelTestsGroupList =
new ArrayList<>();
69 jParallelTestsGroupList.add(testGroup);
70 Collections.addAll(jParallelTestsGroupList, testGroups);
72 return new Builder(
id, jParallelTestsGroupList);
77 private final List<JParallelTestsGroup> testGroups;
78 private List<Double> percentileValues;
79 private List<Provider<LoadScenarioListener>> listeners = Lists.newArrayList();
81 public Builder(
Id id, List<JParallelTestsGroup> testGroups) {
83 this.testGroups = testGroups;
92 Objects.requireNonNull(percentileValues);
93 percentileValues.stream().filter(percentile -> percentile <= 0.0 || percentile >= 100.0)
95 .ifPresent(badPercentile -> {
96 throw new IllegalArgumentException(
"Percentile value must be > 0 and < 100. Provided value is " + badPercentile);
99 this.percentileValues = percentileValues;
113 this.listeners.add(listener);
127 this.listeners.addAll(listeners);
139 throw new IllegalStateException(
"JParallelTestsGroup ids inside one JLoadScenario are not all unique");
156 return percentileValues;