Jagger
 All Classes Namespaces Files Functions Variables Groups Pages
boolean com.griddynamics.jagger.engine.e1.collector.ConsistencyValidator< Q, E, R >.validate ( query,
endpoint,
result,
long  duration 
)
virtual

Returns true if invocation result equals calibration result.

Author
Dmitry Kotlyarov
Parameters
query- the query of current invocation
endpoint- the endpoint of current invocation
result- the result of invocation
duration- the duration of invocation
Returns
true if invocation result equals calibration result

Implements com.griddynamics.jagger.engine.e1.collector.ResponseValidator< Q, E, R >.

81  {
82  if (getExpected().isEmpty()) {
83  return false;
84  }
85 
86  CalibrationInfo<Q, E, R> info = null;
87  for (CalibrationInfo<Q, E, R> expected : getExpected()) {
88  if (match(CalibrationInfo.create(query, endpoint, result), expected)) {
89  info = expected;
90  break;
91  }
92  }
93 
94  if (info == null) {
95  log.warn("Cannot find calibration info for query {} and endpoint {}", query, endpoint);
96  return false;
97  }
98 
99  return resultEquivalence.equivalent(info.getResult(), result);
100  }