private SynchronousCallMessage createCallMessage(final Execution rootExecution, final Execution prevE, final Execution curE) throws InvalidTraceException { final SynchronousCallMessage message; if (prevE.equals(rootExecution)) { // initial execution callMessage message = new SynchronousCallMessage(curE.getTin(), rootExecution, curE); } else if ((prevE.getEss() + 1) == curE.getEss()) { // usual callMessage with senderComponentName and // receiverComponentName message = new SynchronousCallMessage(curE.getTin(), prevE, curE); } else if (prevE.getEss() < curE.getEss()) { // detect ess incrementation by > 1 final InvalidTraceException ex = new InvalidTraceException( "Ess are only allowed to increment by 1 --" + "but found sequence <" + prevE.getEss() + "," + curE.getEss() + ">" + "(Execution: " + curE + ")"); // don't log and throw // LOG.error("Found invalid trace:" + ex.getMessage()); // don't need the stack trace here throw ex; } else { final String errorMessage = "Unexpected trace: " + prevE + " and " + curE; throw new IllegalStateException(errorMessage); } return message; }
while (eSeqIt.hasNext()) { final Execution curE = eSeqIt.next(); if (expectingEntryCall && (curE.getEss() != 0)) { final InvalidTraceException ex = new InvalidTraceException("First execution must have ess " + "0 (found " + curE.getEss() + ")\n Causing execution: " + curE); if ((!prevE.equals(rootExecution)) && (prevE.getEss() >= curE.getEss())) { while (curStack.size() > curE.getEss()) { final AbstractMessage poppedCall = curStack.pop(); prevE = poppedCall.getReceivingExecution();
/** * Checks whether the given executions are equal or not. * * @param r1 * The first execution object. * @param r2 * The second execution object. * * @return true if and only if the executions have the same values. */ private boolean executionsEqual(final Execution r1, final Execution r2) { if (r1 == r2) { // NOPMD (no equals) return true; } if ((r1 == null) || (r2 == null)) { return false; } return (r1.getAllocationComponent().getId() == r2.getAllocationComponent().getId()) && (r1.getOperation().getId() == r2.getOperation().getId()) && (r1.getEoi() == r2.getEoi()) && (r1.getEss() == r2.getEss()); }
/** * Creates a new instance of this class using the given parameters. * * @param t * The execution trace to be stored in this container. */ public ExecutionTraceHashContainerAllocationEquivalence(final ExecutionTrace t) { super(t); final int prime = 31; int result = 1; for (final Execution r : t.getTraceAsSortedExecutionSet()) { result = (prime * result) + r.getOperation().getId(); result = (prime * result) + r.getAllocationComponent().getId(); result = (prime * result) + r.getEoi(); result = (prime * result) + r.getEss(); } // this.hashcodeBuffer = result; }
/** * Checks whether the given executions are equal or not. * * @param r1 * The first execution object. * @param r2 * The second execution object. * * @return true if and only if the executions have the same values. */ private boolean executionsEqual(final Execution r1, final Execution r2) { if (r1 == r2) { // NOPMD (no equals) return true; } if ((r1 == null) || (r2 == null)) { return false; } return (r1.getAllocationComponent().getAssemblyComponent().getId() == r2.getAllocationComponent().getAssemblyComponent().getId()) && (r1.getOperation().getId() == r2.getOperation().getId()) && (r1.getEoi() == r2.getEoi()) && (r1.getEss() == r2.getEss()); }
/** * Creates a new instance of this class using the given parameters. * * @param t * The execution trace to be stored in this container. */ public ExecutionTraceHashContainerAssemblyEquivalence(final ExecutionTrace t) { super(t); final int prime = 31; int result = 1; for (final Execution r : t.getTraceAsSortedExecutionSet()) { result = (prime * result) + r.getOperation().getId(); result = (prime * result) + r.getAllocationComponent().getAssemblyComponent().getId(); result = (prime * result) + r.getEoi(); result = (prime * result) + r.getEss(); } // this.hashCodeBuffer = result; }
/** * This method can be used to debug the {@link java.util.Comparator} provided by {@link ExecutionTrace#createExecutionTraceComparator()}. */ @Test public void testTreeSet() { final SortedSet<Execution> s0 = new TreeSet<>(ExecutionTrace.createExecutionTraceComparator()); final SortedSet<Execution> s1 = new TreeSet<>(ExecutionTrace.createExecutionTraceComparator()); final Execution execFromTrace0 = this.exec0_0__bookstore_searchBook; final Execution long1 = new Execution(execFromTrace0.getOperation(), execFromTrace0.getAllocationComponent(), execFromTrace0.getTraceId(), execFromTrace0.getSessionId(), execFromTrace0.getEoi(), execFromTrace0.getEss(), execFromTrace0.getTin(), execFromTrace0.getTout(), execFromTrace0.isAssumed()); s0.add(execFromTrace0); s1.add(long1); Assert.assertEquals("Expected sets to be equal", s0, s1); }
Assert.assertEquals("tout's differ", opExec.getTout(), exec.getTout()); Assert.assertEquals("eoi's differ", opExec.getEoi(), exec.getEoi()); Assert.assertEquals("ess's differ", opExec.getEss(), exec.getEss()); Assert.assertEquals("Hostnames differ", opExec.getHostname(), exec.getAllocationComponent().getExecutionContainer().getName()); Assert.assertEquals("Session ID's differ", opExec.getSessionId(), exec.getSessionId());
this.exec1_1__catalog_getBook.getEoi() + 100, this.exec1_1__catalog_getBook.getEss() + 100, this.exec1_1__catalog_getBook.getTin() + 100, this.exec1_1__catalog_getBook.getTout(), !this.exec1_1__catalog_getBook.isAssumed());