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.ResponseValidatorProvider;
6 import com.griddynamics.jagger.engine.e1.collector.invocation.InvocationListener;
7 import com.griddynamics.jagger.invoker.Invoker;
8 import com.griddynamics.jagger.invoker.QueryPoolLoadBalancer;
9 import com.griddynamics.jagger.invoker.RandomLoadBalancer;
10 import com.griddynamics.jagger.invoker.RoundRobinLoadBalancer;
11 import com.griddynamics.jagger.invoker.RoundRobinPairSupplierFactory;
12 import com.griddynamics.jagger.invoker.v2.DefaultHttpInvoker;
13 import com.griddynamics.jagger.invoker.v2.DefaultInvokerProvider;
14 import com.griddynamics.jagger.user.test.configurations.auxiliary.Id;
16 import java.util.List;
38 private final String id;
39 private final Iterable endpoints;
41 private final String comment;
42 private final Iterable queries;
43 private final Provider<Invoker> invoker;
44 private final List<ResponseValidatorProvider> validators;
45 private final List<Provider<InvocationListener>> listeners;
46 private final QueryPoolLoadBalancer loadBalancer;
49 this.
id = builder.id.
value();
50 this.endpoints = builder.endpointsProvider;
52 this.comment = (builder.comment == null) ?
"" : builder.comment;
53 this.queries = builder.queries;
54 this.invoker = builder.invoker;
55 this.validators = builder.validators;
56 this.listeners = builder.listeners;
57 this.loadBalancer = builder.loadBalancer;
70 return new Builder(
id, endpointsProvider);
75 private final Iterable endpointsProvider;
77 private String comment =
"";
78 private Iterable queries;
80 private List<ResponseValidatorProvider> validators = Lists.newArrayList();
81 private List<Provider<InvocationListener>> listeners = Lists.newArrayList();
82 private QueryPoolLoadBalancer loadBalancer;
84 private Builder(
Id id, Iterable endpointsProvider) {
86 this.endpointsProvider = endpointsProvider;
87 this.loadBalancer =
new RandomLoadBalancer() {{
88 setPairSupplierFactory(
new RoundRobinPairSupplierFactory());
99 this.comment = comment;
110 this.queries = queryProvider;
123 this.loadBalancer = loadBalancer;
137 this.invoker = invoker;
151 this.validators.addAll(validators);
166 this.validators.add(validator);
183 this.listeners.addAll(listeners);
200 this.listeners.add(listener);