/** * Returns whether this Execution Trace and the passed Object are equal. Two execution traces are equal if the set * of contained executions is equal. * * @param obj * The object to be compared for equality with this. * * @return true if and only if the two objects are equal. */ @Override public boolean equals(final Object obj) { synchronized (this) { if (!(obj instanceof ExecutionTrace)) { return false; } if (this == obj) { return true; } final ExecutionTrace other = (ExecutionTrace) obj; if (this.getTraceId() != other.getTraceId()) { return false; } // Note that we are using a TreeSet which is not using the Object's equals // method but the Set's Comparator, which we defined in this case. return this.set.equals(other.set); } }
@Override public String toString() { final StringBuilder strBuild = new StringBuilder(512); synchronized (this) { strBuild.append("TraceId ").append(this.getTraceId()); strBuild.append(" (minTin=").append(this.minTin); strBuild.append(" (").append(LoggingTimestampConverter.convertLoggingTimestampToUTCString(this.minTin)); strBuild.append("); maxTout=").append(this.maxTout); strBuild.append(" (").append(LoggingTimestampConverter.convertLoggingTimestampToUTCString(this.maxTout)); strBuild.append("); maxEss=").append(this.maxEss).append("):\n"); for (final Execution e : this.set) { strBuild.append('<'); strBuild.append(e.toString()).append(">\n"); } } return strBuild.toString(); }
/** Order traces by tins */ @Override public int compare(final ExecutionTrace t1, final ExecutionTrace t2) { if (t1 == t2) { // NOPMD (no equals) return 0; } final long t1LowestTin = t1.getTraceAsSortedExecutionSet().first().getTin(); final long t2LowestTin = t2.getTraceAsSortedExecutionSet().first().getTin(); // Multiple traces may have an equal tin timestamp value. In order to provide an absolute ordering of the keys, we take the traceId as a second ordering // key. if (t1LowestTin != t2LowestTin) { return t1LowestTin < t2LowestTin ? -1 : 1; // NOCS } return t1.getTraceId() < t2.getTraceId() ? -1 : 1; // NOCS } });
/** * This method represents the input port of this filter. * * @param et * The next execution trace. */ @InputPort(name = INPUT_PORT_NAME_EXECUTION_TRACES, description = "Receives the execution traces to be written", eventTypes = { ExecutionTrace.class }) public void newExecutionTrace(final ExecutionTrace et) { ExecutionTraceWriterFilter.this.ps.println(et.toString()); ExecutionTraceWriterFilter.this.reportSuccess(et.getTraceId()); }
ps.println("Class " + numClasses++ + " ; cardinality: " + e.getValue() + "; # executions: " + t.getLength() + "; representative: " + t.getTraceId() + "; max. stack depth: " + t.getMaxEss());
/** * This method represents the input port of this filter. * * @param et * The next execution trace. */ @InputPort(name = INPUT_PORT_NAME_INVALID_EXECUTION_TRACES, description = "Receives the invalid execution traces to be written", eventTypes = { InvalidExecutionTrace.class }) public void newInvalidExecutionTrace(final InvalidExecutionTrace et) { InvalidExecutionTraceWriterFilter.this.ps.println(et.getInvalidExecutionTraceArtifacts().toString()); InvalidExecutionTraceWriterFilter.this.reportSuccess(et.getInvalidExecutionTraceArtifacts().getTraceId()); }
/** * Processes the pending traces in the timeout queue: Either those, * that timed out are all, if the filter was requested to terminate. * * @throws ExecutionEventProcessingException */ private void processTimeoutQueue() throws ExecutionEventProcessingException { synchronized (this.timeoutMap) { while (!this.timeoutMap.isEmpty() && (this.terminated || ((this.maxTout - this.timeoutMap.first().getMinTin()) > this.maxTraceDuration))) { final ExecutionTrace polledTrace = this.timeoutMap.pollFirst(); final long curTraceId = polledTrace.getTraceId(); this.pendingTraces.remove(curTraceId); this.processExecutionTrace(polledTrace); } } }
} else { // just to make sure this.logger.error("Invalid trace equivalence mode: {}", this.equivalenceMode); this.reportError(et.getTraceId()); return; this.reportSuccess(et.getTraceId()); } catch (final InvalidTraceException ex) { this.logger.error("InvalidTraceException: {}", ex.getMessage()); // do not pass 'ex' to LOG.error because this makes the output verbose (#584) this.reportError(et.getTraceId());
super.deliver(OUTPUT_PORT_NAME_EXECUTION_TRACE, executionTrace); super.deliver(OUTPUT_PORT_NAME_MESSAGE_TRACE, messageTrace); super.reportSuccess(executionTrace.getTraceId()); } catch (final InvalidTraceException ex) { this.logger.warn("Failed to convert to message trace: {}", ex.getMessage()); // do not pass 'ex' to log.warn because this makes the output verbose (#584)
final long curTraceId = executionTrace.getTraceId(); try {
mt = new MessageTrace(this.getTraceId(), this.getSessionId(), mSeq); this.messageTrace.set(mt); return mt;
if (this.getTraceId() != execution.getTraceId()) { throw new InvalidTraceException("TraceId of new record (" + execution.getTraceId() + ") differs from Id of this trace (" + this.getTraceId() + ")");
final ExecutionTrace completingExecutionTrace = new ExecutionTrace(incompleteExecutionTrace.getTraceId(), incompleteExecutionTrace.getSessionId()); Assert.assertTrue("Test invalid (traceIds not matching)", this.exec0_0__bookstore_searchBook.getTraceId() == completingExecutionTrace.getTraceId()); completingExecutionTrace.add(this.exec0_0__bookstore_searchBook);
final ExecutionTrace trace1 = new ExecutionTrace(trace0.getTraceId(), trace0.getSessionId()); for (final Execution execFromTrace0 : trace0.getTraceAsSortedExecutionSet()) { final Execution execToAddToTrace1;