executionTrace = new ExecutionTrace(traceId, execution.getSessionId()); this.pendingTraces.put(traceId, executionTrace);
private ExecutionTrace createValidExecutionTrace() throws InvalidTraceException { final ExecutionTrace execTrace = new ExecutionTrace(AbstractTraceWriterFilterTest.TRACE_ID_VALID_EXEC_TRACE); execTrace.add(this.execFactory.createBookstoreExecution_exec0_0__bookstore_searchBook(AbstractTraceWriterFilterTest.TRACE_ID_VALID_EXEC_TRACE, AbstractTraceWriterFilterTest.SESSION_ID, AbstractTraceWriterFilterTest.HOSTNAME, AbstractTraceWriterFilterTest.INITIAL_TIMESTAMP_VALID_EXEC_TRACE + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry0_0__bookstore_searchBook, AbstractTraceWriterFilterTest.INITIAL_TIMESTAMP_VALID_EXEC_TRACE + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook, false)); // assumed execTrace.toMessageTrace(SystemModelRepository.ROOT_EXECUTION); // just to make sure this trace is really valid return execTrace; }
private ExecutionTrace createExecutionTraceForValidMessageTrace() throws InvalidTraceException { final ExecutionTrace execTrace = new ExecutionTrace(AbstractTraceWriterFilterTest.TRACE_ID_VALID_EXEC_TRACE); execTrace.add(this.execFactory.createBookstoreExecution_exec0_0__bookstore_searchBook(AbstractTraceWriterFilterTest.TRACE_ID_VALID_MSG_TRACE, AbstractTraceWriterFilterTest.SESSION_ID, AbstractTraceWriterFilterTest.HOSTNAME, AbstractTraceWriterFilterTest.INITIAL_TIMESTAMP_VALID_MESSAGE_TRACE + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry0_0__bookstore_searchBook, AbstractTraceWriterFilterTest.INITIAL_TIMESTAMP_VALID_MESSAGE_TRACE + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook, false)); // assumed execTrace.toMessageTrace(SystemModelRepository.ROOT_EXECUTION); // just to make sure this trace is really valid return execTrace; }
/** * Generates an incomplete execution trace representation of the "well-known" bookstore trace. The outer bookstore.searchBook(..) execution with eoi/ess 0/0 is * missing. * * @return * @throws InvalidTraceException * If the trace to reconstruct is somehow invalid. */ private ExecutionTrace genBookstoreTraceWithoutEntryExecution() throws InvalidTraceException { // Create an Execution Trace and add Executions in arbitrary order final ExecutionTrace executionTrace = new ExecutionTrace(TestTraceReconstructionFilter.TRACE_ID, TestTraceReconstructionFilter.SESSION_ID); executionTrace.add(this.exec3_2__catalog_getBook); executionTrace.add(this.exec2_1__crm_getOrders); executionTrace.add(this.exec1_1__catalog_getBook); return executionTrace; }
private ExecutionTrace genValidBookstoreTrace() throws InvalidTraceException { // Create an Execution Trace and add Executions in arbitrary order final ExecutionTrace executionTrace = new ExecutionTrace(TestExecutionTraceBookstore.TRACE_ID, TestExecutionTraceBookstore.SESSION_ID); executionTrace.add(this.exec3_2__catalog_getBook); executionTrace.add(this.exec2_1__crm_getOrders); executionTrace.add(this.exec0_0__bookstore_searchBook); executionTrace.add(this.exec1_1__catalog_getBook); return executionTrace; }
private InvalidExecutionTrace createInvalidExecutionTrace() throws InvalidTraceException { final ExecutionTrace execTrace = new ExecutionTrace(AbstractTraceWriterFilterTest.TRACE_ID_VALID_EXEC_TRACE); execTrace.add(this.execFactory.createBookstoreExecution_exec1_1__catalog_getBook(AbstractTraceWriterFilterTest.TRACE_ID_INVALID_EXEC_TRACE, AbstractTraceWriterFilterTest.SESSION_ID, AbstractTraceWriterFilterTest.HOSTNAME, AbstractTraceWriterFilterTest.INITIAL_TIMESTAMP_INVALID_EXEC_TRACE + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry1_1__catalog_getBook, AbstractTraceWriterFilterTest.INITIAL_TIMESTAMP_INVALID_EXEC_TRACE + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit1_1__catalog_getBook, false)); // assumed try { execTrace.toMessageTrace(SystemModelRepository.ROOT_EXECUTION); Assert.fail("Test invalid: wanted to create an *invalid* trace"); } catch (final InvalidTraceException e) { // NOPMD (EmptyCatchBlock) // that's what we expect here } return new InvalidExecutionTrace(execTrace); }
/** * Generates an execution trace representation of the "well-known" bookstore trace. * * @return * @throws InvalidTraceException * If the internally assembled execution trace is somehow invalid. */ private ExecutionTrace genValidBookstoreTrace() throws InvalidTraceException { // Create an Execution Trace and add Executions in arbitrary order final ExecutionTrace executionTrace = new ExecutionTrace(TestTraceReconstructionFilter.TRACE_ID, TestTraceReconstructionFilter.SESSION_ID); executionTrace.add(this.exec3_2__catalog_getBook); executionTrace.add(this.exec2_1__crm_getOrders); executionTrace.add(this.exec0_0__bookstore_searchBook); executionTrace.add(this.exec1_1__catalog_getBook); executionTrace.toMessageTrace(SystemModelRepository.ROOT_EXECUTION); return executionTrace; }
/** * Generates an execution trace representation of the "well-known" bookstore * trace. * * Borrowed from {@link kieker.test.tools.junit.traceAnalysis.filter.TestTraceReconstructionFilter}. * * @return * @throws InvalidTraceException * If the internally assembled execution trace is somehow invalid. */ private ExecutionTrace genValidBookstoreTrace() throws InvalidTraceException { // Create an Execution Trace and add Executions in arbitrary order final ExecutionTrace executionTrace = new ExecutionTrace(TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID); executionTrace.add(this.exec3_2__catalog_getBook); executionTrace.add(this.exec2_1__crm_getOrders); executionTrace.add(this.exec0_0__bookstore_searchBook); executionTrace.add(this.exec1_1__catalog_getBook); // just to make sure that this trace is valid executionTrace.toMessageTrace(SystemModelRepository.ROOT_EXECUTION); return executionTrace; }
/** * Borrowed from {@link kieker.test.tools.junit.traceAnalysis.filter.TestTraceReconstructionFilter}. * * @throws InvalidTraceException * If the trace to reconstruct is somehow invalid. * * @return An execution trace from the Bookstore example. */ public ExecutionTrace genValidBookstoreTraceNoExitGetOrders() throws InvalidTraceException { final ExecutionTrace executionTrace = new ExecutionTrace(TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID); final long initialTimestamp = 1 * (1000 * 1000); // Manually create Executions for a trace executionTrace.add(this.exec0_0__bookstore_searchBook); executionTrace.add(this.exec1_1__catalog_getBook); executionTrace.add( this.bookstoreExecutionFactory.createBookstoreExecution_exec2_1__crm_getOrders( TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.HOSTNAME, // The assumed entry timestamp is the exit timestamp of the previous call initialTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call2_1__crm_getOrders, // tin // We will only have a (before) call to CRM.getOrder(..), hence the assumed return timestamp is the return time of the wrapping // Bookstore.searchBook(..) execution: initialTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook, // tout false)); // assumed executionTrace.add(this.exec3_2__catalog_getBook); return executionTrace; }
new ExecutionTrace(TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID);
/** * Creates a broken execution trace version of the "well-known" Bookstore * trace leads to an exception. * * The trace is broken in that the eoi/ess values of an execution with eoi/ess * [1,1] are replaced by the eoi/ess values [1,3]. Since ess values must only * increment/decrement by 1, this test must lead to an exception. * * @return * @throws InvalidTraceException * If the internally assembled execution trace is somehow invalid. */ private ExecutionTrace genBrokenBookstoreTraceEssSkip() throws InvalidTraceException { // Create an Execution Trace and add Executions in arbitrary order final ExecutionTrace executionTrace = new ExecutionTrace(TestExecutionTraceBookstore.TRACE_ID, TestExecutionTraceBookstore.SESSION_ID); final Execution exec1_1__catalog_getBook__broken = this.eFactory.genExecution("Catalog", "catalog", "getBook", TestExecutionTraceBookstore.TRACE_ID, // NOCS TestExecutionTraceBookstore.SESSION_ID, 2, 4, 1, 3); // NOCS Assert.assertFalse("Invalid test", exec1_1__catalog_getBook__broken.equals(this.exec1_1__catalog_getBook)); executionTrace.add(this.exec3_2__catalog_getBook); executionTrace.add(this.exec2_1__crm_getOrders); executionTrace.add(this.exec0_0__bookstore_searchBook); executionTrace.add(exec1_1__catalog_getBook__broken); return executionTrace; }
/** * Creates a broken execution trace version of the "well-known" Bookstore * trace leads to an exception. * * The trace is broken in that the eoi/ess values of an execution with eoi/ess * [3,2] are replaced by the eoi/ess values [4,2]. Since eoi values must only * increment by 1, this test must lead to an exception. * * @return * @throws InvalidTraceException * If the internally assembled execution trace is somehow invalid. */ private ExecutionTrace genBrokenBookstoreTraceEoiSkip() throws InvalidTraceException { // Create an Execution Trace and add Executions in arbitrary order final ExecutionTrace executionTrace = new ExecutionTrace(TestExecutionTraceBookstore.TRACE_ID, TestExecutionTraceBookstore.SESSION_ID); final Execution exec3_2__catalog_getBook__broken = this.eFactory.genExecution("Catalog", "catalog", "getBook", TestExecutionTraceBookstore.TRACE_ID, // NOCS TestExecutionTraceBookstore.SESSION_ID, 6, 7, 4, 2); Assert.assertFalse("Invalid test", exec3_2__catalog_getBook__broken.equals(this.exec3_2__catalog_getBook)); executionTrace.add(exec3_2__catalog_getBook__broken); executionTrace.add(this.exec2_1__crm_getOrders); executionTrace.add(this.exec0_0__bookstore_searchBook); executionTrace.add(this.exec1_1__catalog_getBook); return executionTrace; }
/** * Creates a broken execution trace version of the "well-known" Bookstore trace. * * The trace is broken in that the eoi/ess values of an execution with eoi/ess [1,1] are replaced by the eoi/ess values [1,3]. Since ess values must only * increment/decrement by 1, this test must lead to an exception. * * @param executionFactory * The factory to be used to create the executions. * * @return The execution trace in question. * * @throws InvalidTraceException * If the traceIds of the execution trace and the executions are incompatible. */ private ExecutionTrace genBrokenBookstoreTraceEssSkip(final ExecutionFactory executionFactory) throws InvalidTraceException { // Create an Execution Trace and add Executions in arbitrary order final ExecutionTrace executionTrace = new ExecutionTrace(TestTraceReconstructionFilter.TRACE_ID, TestTraceReconstructionFilter.SESSION_ID); final Execution exec1_1__catalog_getBook__broken = executionFactory.genExecution("Catalog", "catalog", "getBook", // NOCS TestTraceReconstructionFilter.TRACE_ID, TestTraceReconstructionFilter.SESSION_ID, 2 * (1000 * 1000), 4 * (1000 * 1000), 1, 3); // NOCS // (MagicNumberCheck) Assert.assertFalse("Invalid test", exec1_1__catalog_getBook__broken.equals(this.exec1_1__catalog_getBook)); executionTrace.add(this.exec3_2__catalog_getBook); executionTrace.add(this.exec2_1__crm_getOrders); executionTrace.add(this.exec0_0__bookstore_searchBook); executionTrace.add(exec1_1__catalog_getBook__broken); return executionTrace; }
final ExecutionTrace executionTrace = new ExecutionTrace(TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID);
@Test public void testValidTraceWithBeforeAndAfterOperationEvents() throws InvalidTraceException, IllegalStateException, AnalysisConfigurationException { // NOPMD // Create an EventRecordTrace, containing only Before- and AfterOperation events. final TraceEventRecords traceEvents = BookstoreEventRecordFactory.validSyncTraceBeforeAfterEvents(this.exec0_0__bookstore_searchBook.getTin(), TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.HOSTNAME); final ExecutionTrace expectedExecutionTrace; { // NOCS // Create an Execution Trace and add Executions in arbitrary order expectedExecutionTrace = new ExecutionTrace(TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID); expectedExecutionTrace.add(this.exec3_2__catalog_getBook_assumed); // assumed because no call event expectedExecutionTrace.add(this.exec2_1__crm_getOrders_assumed); // assumed because no call event expectedExecutionTrace.add(this.exec0_0__bookstore_searchBook); expectedExecutionTrace.add(this.exec1_1__catalog_getBook_assumed); // assumed because no call event // just to make sure that this trace is valid expectedExecutionTrace.toMessageTrace(SystemModelRepository.ROOT_EXECUTION); } this.checkTrace(traceEvents, expectedExecutionTrace); }
new ExecutionTrace(TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID);
@Test public void testValidTraceWithBeforeAndAfterOperationEventsAndAdditionalCallEventsAndGap() throws InvalidTraceException, IllegalStateException, // NOPMD AnalysisConfigurationException { // Create an EventRecordTrace, containing only Before- and AfterOperation events. final TraceEventRecords traceEvents = BookstoreEventRecordFactory.validSyncTraceAdditionalCallEventsGap(this.exec0_0__bookstore_searchBook.getTin(), TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.HOSTNAME); final ExecutionTrace expectedExecutionTrace; { // NOCS expectedExecutionTrace = new ExecutionTrace(TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID); final long initialTimestamp = 1 * (1000 * 1000); // Manually create Executions for a trace expectedExecutionTrace.add(this.exec0_0__bookstore_searchBook); expectedExecutionTrace.add(this.exec1_1__catalog_getBook); expectedExecutionTrace.add( this.bookstoreExecutionFactory.createBookstoreExecution_exec2_1__crm_getOrders( TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.HOSTNAME, // The assumed entry timestamp is the exit timestamp of the previous call initialTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call2_1__crm_getOrders, // tin // We will only have a (before) call to CRM.getOrder(..), hence the assumed return timestamp is the return time of the wrapping // Bookstore.searchBook(..) execution: initialTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook, // tout true)); // assumed, because call is missing expectedExecutionTrace.add(this.exec3_2__catalog_getBook); } this.checkTrace(traceEvents, expectedExecutionTrace); }
new ExecutionTrace(TestTraceEventRecords2ExecutionAndMessageTraceFilter.TRACE_ID, TestTraceEventRecords2ExecutionAndMessageTraceFilter.SESSION_ID);
final ExecutionTrace executionTrace = new ExecutionTrace(traceId, TestTraceEquivalenceFilterAssemblyEquivalence.SESSION_ID);
final ExecutionTrace trace1 = new ExecutionTrace(trace0.getTraceId(), trace0.getSessionId()); for (final Execution execFromTrace0 : trace0.getTraceAsSortedExecutionSet()) { final Execution execToAddToTrace1;