1 package com.griddynamics.jagger.user.test.configurations;
3 import com.google.common.collect.Lists;
4 import com.griddynamics.jagger.engine.e1.Provider;
5 import com.griddynamics.jagger.engine.e1.collector.loadscenario.ExampleLoadScenarioListener;
6 import com.griddynamics.jagger.engine.e1.collector.loadscenario.LoadScenarioListener;
7 import com.griddynamics.jagger.user.test.configurations.auxiliary.Id;
9 import java.util.ArrayList;
10 import java.util.Collections;
11 import java.util.List;
12 import java.util.Objects;
13 import java.util.stream.Collectors;
35 private final String id;
36 private final List<JParallelTestsGroup> testGroups;
37 private final List<Double> percentileValues;
38 private final List<Provider<LoadScenarioListener>> listeners;
41 this.
id = builder.id.
value();
42 this.testGroups = builder.testGroups;
43 this.percentileValues = builder.percentileValues;
44 this.listeners = builder.listeners;
55 return new Builder(
id, testGroups);
67 List<JParallelTestsGroup> jParallelTestsGroupList =
new ArrayList<>();
68 jParallelTestsGroupList.add(testGroup);
69 Collections.addAll(jParallelTestsGroupList, testGroups);
71 return new Builder(
id, jParallelTestsGroupList);
76 private final List<JParallelTestsGroup> testGroups;
77 private List<Double> percentileValues;
78 private List<Provider<LoadScenarioListener>> listeners = Lists.newArrayList();
80 public Builder(
Id id, List<JParallelTestsGroup> testGroups) {
82 this.testGroups = testGroups;
91 Objects.requireNonNull(percentileValues);
92 percentileValues.stream().filter(percentile -> percentile <= 0.0 || percentile >= 100.0)
94 .ifPresent(badPercentile -> {
95 throw new IllegalArgumentException(
"Percentile value must be > 0 and < 100. Provided value is " + badPercentile);
98 this.percentileValues = percentileValues;
112 this.listeners.add(listener);
126 this.listeners.addAll(listeners);
138 throw new IllegalStateException(
"JParallelTestsGroup ids inside one JLoadScenario are not all unique");
155 return percentileValues;