Skip to content
Snippets Groups Projects
Commit 4c2cabf0 authored by Lars Erik Blümke's avatar Lars Erik Blümke
Browse files

migration and tests of TraceIdFilter

parent 8d8b5609
No related branches found
No related tags found
No related merge requests found
Showing with 918 additions and 7 deletions
......@@ -14,6 +14,16 @@ import teetime.framework.OutputPort;
import teetime.stage.MultipleInstanceOfFilter;
import teetime.stage.basic.merger.Merger;
/**
* Allows to filter Traces about their traceIds.
*
* This class has exactly one input port and two output ports. If the received object
* contains the defined traceID, the object is delivered unmodified to the matchingTraceIdOutputPort otherwise to the mismatchingTraceIdOutputPort.
*
* @author Andre van Hoorn, Jan Waller, Lars Erik Bluemke
*
* @since 1.2
*/
public class TraceIdFilter extends CompositeStage {
private InputPort<IMonitoringRecord> monitoringRecordsCombinedInputPort;
......@@ -37,7 +47,7 @@ public class TraceIdFilter extends CompositeStage {
* @param selectedTraceIds
* Determining which trace IDs should be accepted by this filter.
*/
public TraceIdFilter(final boolean acceptAllTraces, final String[] selectedTraceIds) {
public TraceIdFilter(final boolean acceptAllTraces, final Long[] selectedTraceIds) {
// Initializing the internal filters
this.instanceOfFilter = new MultipleInstanceOfFilter<>();
this.traceMetadataFilter = new TraceMetadataTraceIdFilter(acceptAllTraces, selectedTraceIds);
......
......@@ -6,6 +6,14 @@ import java.util.TreeSet;
import teetime.framework.AbstractConsumerStage;
import teetime.framework.OutputPort;
/**
* Abstract class which describes internal components of {@link TraceIdFilter}. Each concrete component filters the trace ids of a specific record type T.
*
* @author Andre van Hoorn, Jan Waller, Lars Erik Bluemke
*
* @param <T>
* Type parameter for specific record types.
*/
public abstract class AbstractTraceIdFilter<T> extends AbstractConsumerStage<T> {
private final boolean acceptAllTraces;
......@@ -22,12 +30,12 @@ public abstract class AbstractTraceIdFilter<T> extends AbstractConsumerStage<T>
* @param selectedTraceIds
* Determining which trace IDs should be accepted by this filter.
*/
public AbstractTraceIdFilter(final boolean acceptAllTraces, final String[] selectedTraceIds) {
public AbstractTraceIdFilter(final boolean acceptAllTraces, final Long[] selectedTraceIds) {
this.acceptAllTraces = acceptAllTraces;
this.selectedTraceIds = new TreeSet<Long>();
for (final String id : selectedTraceIds) {
this.selectedTraceIds.add(Long.parseLong(id));
for (final Long id : selectedTraceIds) {
this.selectedTraceIds.add(id);
}
}
......
......@@ -2,9 +2,15 @@ package kieker.analysis.plugin.filter.select.traceid.components;
import kieker.common.record.controlflow.OperationExecutionRecord;
/**
* Concrete Implementation of {@link AbstractTraceIdFilter}. Allows to filter {@link OperationExecutionRecord} objects based on their given trace ids.
*
* @author Andre van Hoorn, Jan Waller, Lars Erik Bluemke
*
*/
public class OperationExecutionTraceIdFilter extends AbstractTraceIdFilter<OperationExecutionRecord> {
public OperationExecutionTraceIdFilter(final boolean acceptAllTraces, final String[] selectedTraceIds) {
public OperationExecutionTraceIdFilter(final boolean acceptAllTraces, final Long[] selectedTraceIds) {
super(acceptAllTraces, selectedTraceIds);
}
......
......@@ -2,9 +2,15 @@ package kieker.analysis.plugin.filter.select.traceid.components;
import kieker.common.record.flow.trace.AbstractTraceEvent;
/**
* Concrete Implementation of {@link AbstractTraceIdFilter}. Allows to filter {@link AbstractTraceEvent}s based on their given trace ids.
*
* @author Andre van Hoorn, Jan Waller, Lars Erik Bluemke
*
*/
public class TraceEventTraceIdFilter extends AbstractTraceIdFilter<AbstractTraceEvent> {
public TraceEventTraceIdFilter(final boolean acceptAllTraces, final String[] selectedTraceIds) {
public TraceEventTraceIdFilter(final boolean acceptAllTraces, final Long[] selectedTraceIds) {
super(acceptAllTraces, selectedTraceIds);
}
......
......@@ -2,9 +2,15 @@ package kieker.analysis.plugin.filter.select.traceid.components;
import kieker.common.record.flow.trace.TraceMetadata;
/**
* Concrete Implementation of {@link AbstractTraceIdFilter}. Allows to filter {@link TraceMetadata} objects based on their given trace ids.
*
* @author Andre van Hoorn, Jan Waller, Lars Erik Bluemke
*
*/
public class TraceMetadataTraceIdFilter extends AbstractTraceIdFilter<TraceMetadata> {
public TraceMetadataTraceIdFilter(final boolean acceptAllTraces, final String[] selectedTraceIds) {
public TraceMetadataTraceIdFilter(final boolean acceptAllTraces, final Long[] selectedTraceIds) {
super(acceptAllTraces, selectedTraceIds);
}
......
package kieker.analysis.plugin.filter.select;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static teetime.framework.test.StageTester.test;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import org.junit.Assert;
import org.junit.Test;
import kieker.analysis.plugin.filter.select.traceid.TraceIdFilter;
import kieker.analysis.util.plugin.filter.flow.BookstoreEventRecordFactory;
import kieker.common.record.IMonitoringRecord;
import kieker.common.record.flow.trace.AbstractTraceEvent;
import teetime.framework.AbstractStage;
/**
* @author Andre van Hoorn, Lars Erik Bluemke
*
* @since 1.5
*/
public class TraceIdFilterTest {
private static final String SESSION_ID = "sv7w1ifhK";
private static final String HOSTNAME = "srv098";
/**
* Given a TraceIdFilter that passes traceIds included in a set <i>idsToPass</i>,
* assert that a {@link AbstractTraceEvent} object <i>event</i> with traceId not element of
* <i>idsToPass</i> is NOT passed through the filter.
*/
@Test
public void testAssertIgnoreTraceId() {
final long firstTimestamp = 42353; // any number fits
final long traceIdNotToPass = 11L; // (must NOT be element of idsToPass)
final SortedSet<Long> idsToPass = new TreeSet<Long>();
idsToPass.add(1 + traceIdNotToPass);
idsToPass.add(2 + traceIdNotToPass);
final TraceIdFilter traceidFilter = new TraceIdFilter(false, idsToPass.toArray(new Long[idsToPass.size()]));
final AbstractStage owningStage = traceidFilter.getMonitoringRecordsCombinedInputPort().getOwningStage();
List<IMonitoringRecord> acceptedTraceidOutputs = new ArrayList<IMonitoringRecord>();
List<IMonitoringRecord> notAcceptedTraceidOutputs = new ArrayList<IMonitoringRecord>();
final AbstractTraceEvent[] traceEvents = BookstoreEventRecordFactory
.validSyncTraceBeforeAfterEvents(firstTimestamp, traceIdNotToPass, TraceIdFilterTest.SESSION_ID, TraceIdFilterTest.HOSTNAME)
.getTraceEvents();
for (final AbstractTraceEvent e : traceEvents) {
assertTrue("Testcase invalid", !idsToPass.contains(e.getTraceId()));
}
test(owningStage)
.and().send(traceEvents).to(traceidFilter.getMonitoringRecordsCombinedInputPort())
.and().receive(acceptedTraceidOutputs).from(traceidFilter.getMatchingTraceIdOutputPort())
.and().receive(notAcceptedTraceidOutputs).from(traceidFilter.getMismatchingTraceIdOutputPort())
.start();
if (!acceptedTraceidOutputs.isEmpty()) {
final long passedId = ((AbstractTraceEvent) acceptedTraceidOutputs.get(0)).getTraceId();
fail("Filter passed trace with ID " + passedId + " although traceId not element of " + idsToPass);
}
assertSame(notAcceptedTraceidOutputs.get(0), traceEvents[0]);
}
/**
* Given a TraceIdFilter that passes traceIds included in a set <i>idsToPass</i>,
* assert that a {@link AbstractTraceEvent} object <i>event</i> with traceId not element of
* <i>idsToPass</i> IS passed through the filter.
*/
@Test
public void testAssertPassTraceId() {
final long firstTimestamp = 53222; // any number fits
final long traceIdToPass = 11L; // (must be element of idsToPass)
final SortedSet<Long> idsToPass = new TreeSet<Long>();
idsToPass.add(0 + traceIdToPass);
idsToPass.add(1 + traceIdToPass);
final TraceIdFilter traceidFilter = new TraceIdFilter(false, idsToPass.toArray(new Long[idsToPass.size()]));
final AbstractStage owningStage = traceidFilter.getMonitoringRecordsCombinedInputPort().getOwningStage();
List<IMonitoringRecord> acceptedTraceidOutputs = new ArrayList<IMonitoringRecord>();
List<IMonitoringRecord> notAcceptedTraceidOutputs = new ArrayList<IMonitoringRecord>();
final AbstractTraceEvent[] traceEvents = BookstoreEventRecordFactory
.validSyncTraceBeforeAfterEvents(firstTimestamp, traceIdToPass, TraceIdFilterTest.SESSION_ID, TraceIdFilterTest.HOSTNAME)
.getTraceEvents();
for (final AbstractTraceEvent e : traceEvents) {
Assert.assertTrue("Testcase invalid", idsToPass.contains(e.getTraceId()));
}
test(owningStage)
.and().send(traceEvents).to(traceidFilter.getMonitoringRecordsCombinedInputPort())
.and().receive(acceptedTraceidOutputs).from(traceidFilter.getMatchingTraceIdOutputPort())
.and().receive(notAcceptedTraceidOutputs).from(traceidFilter.getMismatchingTraceIdOutputPort())
.start();
for (final AbstractTraceEvent e : traceEvents) {
assertTrue("Expected event " + e + " to pass the filter", acceptedTraceidOutputs.contains(e));
}
assertSame(acceptedTraceidOutputs.get(0), traceEvents[0]);
// Somehow redundant but records MIGHT be generated randomly ;-)
assertEquals("Unexpected number of output records", acceptedTraceidOutputs.size() + notAcceptedTraceidOutputs.size(), traceEvents.length);
}
/**
* Given a TraceIdFilter that passes all traceIds, assert that an {@link AbstractTraceEvent} object <i>exec</i> is passed through the filter.
*/
@Test
public void testAssertPassTraceIdWhenPassAll() {
final long firstTimestamp = 53222; // any number fits
final long traceIdToPass = 11L; // (must be element of idsToPass)
final TraceIdFilter traceidFilter = new TraceIdFilter(true, new Long[0]); // i.e. pass all
final AbstractStage owningStage = traceidFilter.getMonitoringRecordsCombinedInputPort().getOwningStage();
List<IMonitoringRecord> acceptedTraceidOutputs = new ArrayList<IMonitoringRecord>();
List<IMonitoringRecord> notAcceptedTraceidOutputs = new ArrayList<IMonitoringRecord>();
final AbstractTraceEvent[] traceEvents = BookstoreEventRecordFactory
.validSyncTraceBeforeAfterEvents(firstTimestamp, traceIdToPass, TraceIdFilterTest.SESSION_ID, TraceIdFilterTest.HOSTNAME)
.getTraceEvents();
test(owningStage)
.and().send(traceEvents).to(traceidFilter.getMonitoringRecordsCombinedInputPort())
.and().receive(acceptedTraceidOutputs).from(traceidFilter.getMatchingTraceIdOutputPort())
.and().receive(notAcceptedTraceidOutputs).from(traceidFilter.getMismatchingTraceIdOutputPort())
.start();
for (final AbstractTraceEvent e : traceEvents) {
Assert.assertTrue("Expected event " + e + " to pass the filter", acceptedTraceidOutputs.contains(e));
}
assertSame(acceptedTraceidOutputs.get(0), traceEvents[0]);
// Somehow redundant but records MIGHT be generated randomly ;-)
assertEquals("Unexpected number of output records", acceptedTraceidOutputs.size() + notAcceptedTraceidOutputs.size(), traceEvents.length);
}
}
/***************************************************************************
* Copyright 2015 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.analysis.util.plugin.filter.flow;
import kieker.analysis.plugin.filter.flow.TraceEventRecords;
import kieker.common.record.flow.trace.AbstractTraceEvent;
import kieker.common.record.flow.trace.TraceMetadata;
import kieker.common.record.flow.trace.concurrency.SplitEvent;
import kieker.common.record.flow.trace.operation.AfterOperationEvent;
import kieker.common.record.flow.trace.operation.BeforeOperationEvent;
import kieker.common.record.flow.trace.operation.CallOperationEvent;
import kieker.common.util.record.BookstoreOperationExecutionRecordFactory;
/**
* A starter method for this factory is implemented in kieker.test.tools.junit.traceAnalysis.util.BookstoreEventRecordFactoryStarter.
*
* @author Andre van Hoorn, Holger Knoche, Jan Waller
*
* @since 1.5
*/
public final class BookstoreEventRecordFactory {
// private static final Log LOG = LogFactory.getLog(BookstoreEventRecordFactory.class);
public static final long TSTAMP_OFFSET_entry0_0__bookstore_searchBook = 0; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_call1_1__catalog_getBook = 1; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_entry1_1__catalog_getBook = 2; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_exit1_1__catalog_getBook = 3; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_call2_1__crm_getOrders = 4; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_entry2_1__crm_getOrders = 5; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_call3_2__catalog_getBook = 6; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_entry3_2__catalog_getBook = 7; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_exit3_2__catalog_getBook = 8; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_exit2_1__crm_getOrders = 8; // NOPMD NOCS (VariableNamingConventions)
public static final long TSTAMP_OFFSET_exit0_0__bookstore_searchBook = 11; // NOPMD NOCS VariableNamingConventions)
private BookstoreEventRecordFactory() {}
/**
* Returns the "well-known" Bookstore trace as a list of {@link BeforeOperationEvent} and {@link AfterOperationEvent} events, ordered by its
* {@link kieker.common.record.flow.trace.AbstractTraceEvent#getOrderIndex()}es.
*
* @param firstTimestamp
* timestamp of the earliest event, incremented by 1 for each subsequent event
* @param traceId
* The id of the trace.
* @param sessionId
* The session ID.
* @param hostname
* The name of the host to be used for the trace.
* @return A Bookstore trace.
*/
public static TraceEventRecords validSyncTraceBeforeAfterEvents(final long firstTimestamp, final long traceId, final String sessionId,
final String hostname) {
int curOrderIndex = 0;
final BeforeOperationEvent entry0_0__bookstore_searchBook; // NOCS
final BeforeOperationEvent entry1_1__catalog_getBook; // NOCS
final AfterOperationEvent exit1_1__catalog_getBook; // NOCS
final BeforeOperationEvent entry2_1__crm_getOrders; // NOCS
final BeforeOperationEvent entry3_2__catalog_getBook; // NOCS
final AfterOperationEvent exit3_2__catalog_getBook; // NOCS
final AfterOperationEvent exit2_1__crm_getOrders; // NOCS
final AfterOperationEvent exit0_0__bookstore_searchBook; // NOCS
entry0_0__bookstore_searchBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
entry1_1__catalog_getBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit1_1__catalog_getBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
entry2_1__crm_getOrders = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry2_1__crm_getOrders,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
entry3_2__catalog_getBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit3_2__catalog_getBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit2_1__crm_getOrders = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit2_1__crm_getOrders,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
exit0_0__bookstore_searchBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
final TraceMetadata trace = new TraceMetadata(traceId, -1, sessionId, hostname, -1, -1);
final AbstractTraceEvent[] events = new AbstractTraceEvent[] {
entry0_0__bookstore_searchBook,
entry1_1__catalog_getBook,
exit1_1__catalog_getBook,
entry2_1__crm_getOrders,
entry3_2__catalog_getBook,
exit3_2__catalog_getBook,
exit2_1__crm_getOrders,
exit0_0__bookstore_searchBook,
};
return new TraceEventRecords(trace, events);
}
/**
* Returns the "well-known" Bookstore trace as a list of {@link CallOperationEvent}, {@link BeforeOperationEvent} and {@link AfterOperationEvent} events, ordered
* by
* its {@link kieker.common.record.flow.trace.AbstractTraceEvent#getOrderIndex()}es.
*
* @param firstTimestamp
* timestamp of the earliest event, incremented by 1 for each subsequent event
* @param traceId
* The trace ID.
* @param sessionId
* The session ID.
* @param hostname
* The name of the host.
* @return A Bookstore trace.
*/
public static TraceEventRecords validSyncTraceAdditionalCallEvents(final long firstTimestamp, final long traceId, final String sessionId,
final String hostname) {
int curOrderIndex = 0;
final BeforeOperationEvent entry0_0__bookstore_searchBook; // NOCS
final CallOperationEvent call1_1__catalog_getBook; // NOCS
final BeforeOperationEvent entry1_1__catalog_getBook; // NOCS
final AfterOperationEvent exit1_1__catalog_getBook; // NOCS
final CallOperationEvent call2_1__crm_getOrders; // NOCS
final BeforeOperationEvent entry2_1__crm_getOrders; // NOCS
final CallOperationEvent call3_2__catalog_getBook; // NOCS
final BeforeOperationEvent entry3_2__catalog_getBook; // NOCS
final AfterOperationEvent exit3_2__catalog_getBook; // NOCS
final AfterOperationEvent exit2_1__crm_getOrders; // NOCS
final AfterOperationEvent exit0_0__bookstore_searchBook; // NOCS
entry0_0__bookstore_searchBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
call1_1__catalog_getBook = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
entry1_1__catalog_getBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit1_1__catalog_getBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
call2_1__crm_getOrders = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call2_1__crm_getOrders,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
entry2_1__crm_getOrders = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry2_1__crm_getOrders,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
call3_2__catalog_getBook = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
entry3_2__catalog_getBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit3_2__catalog_getBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit2_1__crm_getOrders = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit2_1__crm_getOrders,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
exit0_0__bookstore_searchBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
final TraceMetadata trace = new TraceMetadata(traceId, -1, sessionId, hostname, -1, -1);
final AbstractTraceEvent[] events = new AbstractTraceEvent[] {
entry0_0__bookstore_searchBook,
call1_1__catalog_getBook,
entry1_1__catalog_getBook,
exit1_1__catalog_getBook,
call2_1__crm_getOrders,
entry2_1__crm_getOrders,
call3_2__catalog_getBook,
entry3_2__catalog_getBook,
exit3_2__catalog_getBook,
exit2_1__crm_getOrders,
exit0_0__bookstore_searchBook,
};
return new TraceEventRecords(trace, events);
}
/**
* Returns the "well-known" Bookstore trace as a list of {@link CallOperationEvent}, {@link BeforeOperationEvent} and {@link AfterOperationEvent} events, ordered
* by
* its {@link kieker.common.record.flow.trace.AbstractTraceEvent#getOrderIndex()}es. In this trace, <i>CRM.getOrders</i> is assumed not to be instrumented.
*
* @param firstTimestamp
* timestamp of the earliest event, incremented by 1 for each subsequent event
* @param traceId
* The trace ID.
* @param sessionId
* The session ID.
* @param hostname
* The name of the host.
*
* @return A Bookstore trace.
*/
public static TraceEventRecords validSyncTraceAdditionalCallEventsGap(final long firstTimestamp, final long traceId, final String sessionId,
final String hostname) {
int curOrderIndex = 0;
final BeforeOperationEvent entry0_0__bookstore_searchBook; // NOCS
final CallOperationEvent call1_1__catalog_getBook; // NOCS
final BeforeOperationEvent entry1_1__catalog_getBook; // NOCS
final AfterOperationEvent exit1_1__catalog_getBook; // NOCS
final CallOperationEvent call2_1__crm_getOrders; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry2_1__crm_getOrders; // NOCS
final CallOperationEvent call3_2__catalog_getBook; // NOCS
final BeforeOperationEvent entry3_2__catalog_getBook; // NOCS
final AfterOperationEvent exit3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit2_1__crm_getOrders; // NOCS
final AfterOperationEvent exit0_0__bookstore_searchBook; // NOCS
entry0_0__bookstore_searchBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
call1_1__catalog_getBook = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
entry1_1__catalog_getBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit1_1__catalog_getBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
call2_1__crm_getOrders = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call2_1__crm_getOrders,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
// assumed to be uninstrumented: entry2_1__crm_getOrders = new BeforeOperationEvent(curTime++, traceId, curOrderIndex++,
// BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
// BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
call3_2__catalog_getBook = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
entry3_2__catalog_getBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit3_2__catalog_getBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
// assumed to be uninstrumented: exit2_1__crm_getOrders = new AfterOperationEvent(curTime++, traceId, curOrderIndex++,
// BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
// BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
exit0_0__bookstore_searchBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
final TraceMetadata trace = new TraceMetadata(traceId, -1, sessionId, hostname, -1, -1);
final AbstractTraceEvent[] events = new AbstractTraceEvent[] {
entry0_0__bookstore_searchBook,
call1_1__catalog_getBook,
entry1_1__catalog_getBook,
exit1_1__catalog_getBook,
call2_1__crm_getOrders,
// entry2_1__crm_getOrders,
call3_2__catalog_getBook,
entry3_2__catalog_getBook,
exit3_2__catalog_getBook,
// exit2_1__crm_getOrders,
exit0_0__bookstore_searchBook,
};
return new TraceEventRecords(trace, events);
}
/**
* Returns a variant of the "well-known" Bookstore trace as a list of {@link CallOperationEvent}, {@link BeforeOperationEvent} and {@link AfterOperationEvent}
* events, ordered by its {@link kieker.common.record.flow.trace.AbstractTraceEvent#getOrderIndex()}es. In this trace, <i>CRM.getOrders</i> and
* <i>Catalog.getBook</i> are assumed not to be instrumented.
*
* @param firstTimestamp
* timestamp of the earliest event, incremented by 1 for each subsequent event
* @param traceId
* The trace ID.
* @param sessionId
* The session ID.
* @param hostname
* The name of the host.
*
* @return A Bookstore trace.
*/
public static TraceEventRecords validSyncTraceSimpleEntryCallExit(final long firstTimestamp, final long traceId, final String sessionId,
final String hostname) {
int curOrderIndex = 0;
final BeforeOperationEvent entry0_0__bookstore_searchBook; // NOCS
final CallOperationEvent call1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final CallOperationEvent call2_1__crm_getOrders; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry2_1__crm_getOrders; // NOCS
// assumed to be uninstrumented: final CallOperationEvent call3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit2_1__crm_getOrders; // NOCS
final AfterOperationEvent exit0_0__bookstore_searchBook; // NOCS
entry0_0__bookstore_searchBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
call1_1__catalog_getBook = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit0_0__bookstore_searchBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
final TraceMetadata trace = new TraceMetadata(traceId, -1, sessionId, hostname, -1, -1);
final AbstractTraceEvent[] events = new AbstractTraceEvent[] {
entry0_0__bookstore_searchBook,
call1_1__catalog_getBook,
exit0_0__bookstore_searchBook,
};
return new TraceEventRecords(trace, events);
}
/**
* Returns a variant the of "well-known" Bookstore trace as a list of {@link CallOperationEvent}, {@link BeforeOperationEvent} and {@link AfterOperationEvent}
* events, ordered by its {@link kieker.common.record.flow.trace.AbstractTraceEvent#getOrderIndex()}es. In this trace, <i>CRM.getOrders</i> and
* <i>Catalog.getBook</i> are assumed not to be instrumented.
*
* @param firstTimestamp
* timestamp of the earliest event, incremented by 1 for each subsequent event
* @param traceId
* The ID of the trace.
* @param sessionId
* The session ID.
* @param hostname
* The name of the host for the trace.
*
* @return A Bookstore trace.
*/
public static TraceEventRecords validSyncTraceSimpleEntryCallReturnCallCallExit(final long firstTimestamp, final long traceId, final String sessionId,
final String hostname) {
int curOrderIndex = 0;
final BeforeOperationEvent entry0_0__bookstore_searchBook; // NOCS
final CallOperationEvent call1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit1_1__catalog_getBook; // NOCS
final CallOperationEvent call2_1__crm_getOrders; // NOCS
final SplitEvent disturbEvent; // this caused to break the reconstruction once ...
// assumed to be uninstrumented: final BeforeOperationEvent entry2_1__crm_getOrders; // NOCS
// assumed to be uninstrumented: final CallOperationEvent call3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit2_1__crm_getOrders; // NOCS
final AfterOperationEvent exit0_0__bookstore_searchBook; // NOCS
entry0_0__bookstore_searchBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
call1_1__catalog_getBook = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call1_1__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
disturbEvent = new SplitEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call3_2__catalog_getBook, traceId, curOrderIndex++);
call2_1__crm_getOrders = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call2_1__crm_getOrders,
// note that we are using the timestamp of the omitted event here!
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
exit0_0__bookstore_searchBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
final TraceMetadata trace = new TraceMetadata(traceId, -1, sessionId, hostname, -1, -1);
final AbstractTraceEvent[] events = new AbstractTraceEvent[] {
entry0_0__bookstore_searchBook,
call1_1__catalog_getBook,
disturbEvent,
call2_1__crm_getOrders,
exit0_0__bookstore_searchBook,
};
return new TraceEventRecords(trace, events);
}
/**
* Returns a variant of "well-known" Bookstore trace as a list of {@link CallOperationEvent}, {@link BeforeOperationEvent} and {@link AfterOperationEvent}
* events, ordered by its {@link kieker.common.record.flow.trace.AbstractTraceEvent#getOrderIndex()}es. In this trace, <i>Catalog.getBook</i> is assumed
* not to be instrumented.
*
* @param firstTimestamp
* timestamp of the earliest event, incremented by 1 for each subsequent event
* @param traceId
* The ID of the trace.
* @param sessionId
* The session ID.
* @param hostname
* The name of the host for the trace.
*
* @return A Bookstore trace.
*/
public static TraceEventRecords validSyncTraceSimpleEntryCallCallExit(final long firstTimestamp, final long traceId, final String sessionId,
final String hostname) {
int curOrderIndex = 0;
final BeforeOperationEvent entry0_0__bookstore_searchBook; // NOCS
// assumed to be uninstrumented: final CallOperationEvent call1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit1_1__catalog_getBook; // NOCS
final CallOperationEvent call2_1__crm_getOrders; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry2_1__crm_getOrders; // NOCS
final CallOperationEvent call3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit2_1__crm_getOrders; // NOCS
final AfterOperationEvent exit0_0__bookstore_searchBook; // NOCS
entry0_0__bookstore_searchBook = new BeforeOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_entry0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
call2_1__crm_getOrders = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call2_1__crm_getOrders,
// note that we are using the timestamp of the omitted event here!
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
call3_2__catalog_getBook = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call3_2__catalog_getBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
exit0_0__bookstore_searchBook = new AfterOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_exit0_0__bookstore_searchBook,
traceId, curOrderIndex++,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE);
final TraceMetadata trace = new TraceMetadata(traceId, -1, sessionId, hostname, -1, -1);
final AbstractTraceEvent[] events = new AbstractTraceEvent[] {
entry0_0__bookstore_searchBook,
call2_1__crm_getOrders,
call3_2__catalog_getBook,
exit0_0__bookstore_searchBook,
};
return new TraceEventRecords(trace, events);
}
public static TraceEventRecords validSyncTraceSimpleCallCall(final long firstTimestamp, final long traceId, final String sessionId, final String hostname) {
int curOrderIndex = -1;
// assumed to be uninstrumented: final BeforeOperationEvent entry0_0__bookstore_searchBook; // NOCS
// assumed to be uninstrumented: final CallOperationEvent call1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry1_1__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit1_1__catalog_getBook; // NOCS
final CallOperationEvent call2_1__crm_getOrders; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry2_1__crm_getOrders; // NOCS
final CallOperationEvent call3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final BeforeOperationEvent entry3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit3_2__catalog_getBook; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit2_1__crm_getOrders; // NOCS
// assumed to be uninstrumented: final AfterOperationEvent exit0_0__bookstore_searchBook; // NOCS
call2_1__crm_getOrders = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call2_1__crm_getOrders,
// note that we are using the timestamp of the omitted event here!
traceId, ++curOrderIndex,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM);
call3_2__catalog_getBook = new CallOperationEvent(firstTimestamp + BookstoreEventRecordFactory.TSTAMP_OFFSET_call3_2__catalog_getBook,
traceId, ++curOrderIndex,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM,
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG);
final TraceMetadata trace = new TraceMetadata(traceId, -1, sessionId, hostname, -1, -1);
final AbstractTraceEvent[] events = new AbstractTraceEvent[] {
call2_1__crm_getOrders,
call3_2__catalog_getBook,
};
return new TraceEventRecords(trace, events);
}
}
/***************************************************************************
* Copyright 2015 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.common.util.record;
import java.util.ArrayList;
import java.util.List;
import kieker.common.record.controlflow.OperationExecutionRecord;
/**
* Provides some constants for the bookstore example, including class names, operation signatures etc., as well as methods returning (valid and invalid) bookstore
* traces.
*
* @author Andre van Hoorn
*
* @since 1.5
*/
public final class BookstoreOperationExecutionRecordFactory {
/** The name of the Bookstore package. */
public static final String PACKAGE_BOOKSTORE_APP = "bookstore";
/** The simple name of the Bookstore class. */
public static final String SIMPLE_CLASS_BOOKSTORE = "Bookstore";
/** The simple name of the Catalog class. */
public static final String SIMPLE_CLASS_CATALOG = "Catalog";
/** The simple name of the CRM class. */
public static final String SIMPLE_CLASS_CRM = "CRM";
/** The fully qualified name of the Bookstore class. */
public static final String FQ_CLASS_BOOKSTORE =
BookstoreOperationExecutionRecordFactory.PACKAGE_BOOKSTORE_APP
+ "." + BookstoreOperationExecutionRecordFactory.SIMPLE_CLASS_BOOKSTORE;
/** The fully qualified name of the Catalog class. */
public static final String FQ_CLASS_CATALOG = BookstoreOperationExecutionRecordFactory.PACKAGE_BOOKSTORE_APP
+ "." + BookstoreOperationExecutionRecordFactory.SIMPLE_CLASS_CATALOG;
/** The fully qualified name of the CRM class. */
public static final String FQ_CLASS_CRM = BookstoreOperationExecutionRecordFactory.PACKAGE_BOOKSTORE_APP
+ "." + BookstoreOperationExecutionRecordFactory.SIMPLE_CLASS_CRM;
/** The modifier of the {@code searchBook} method of the Bookstore. */
public static final String OP_MODIFIER_BOOKSTORE_SEARCH_BOOK = "public";
/** The return type of the {@code searchBook} method of the Bookstore. */
public static final String OP_RETTYPE_BOOKSTORE_SEARCH_BOOK = "Book";
/** The name of the {@code searchBook} method of the Bookstore. */
public static final String OP_NAME_BOOKSTORE_SEARCH_BOOK = "searchBook";
/** The argument type of the {@code searchBook} method of the Bookstore. */
public static final String OP_ARGTYPE_BOOKSTORE_SEARCH_BOOK = "long";
public static final String OP_FQNAME_BOOKSTORE_SEARCH_BOOK =
BookstoreOperationExecutionRecordFactory.FQ_CLASS_BOOKSTORE + "." + BookstoreOperationExecutionRecordFactory.OP_NAME_BOOKSTORE_SEARCH_BOOK;
public static final String OP_NAMEWITHARG_BOOKSTORE_SEARCH_BOOK =
BookstoreOperationExecutionRecordFactory.OP_NAME_BOOKSTORE_SEARCH_BOOK + "("
+ BookstoreOperationExecutionRecordFactory.OP_ARGTYPE_BOOKSTORE_SEARCH_BOOK + ")";
/** The modifier of the {@code getBook} method of the Catalog. */
public static final String OP_MODIFIER_CATALOG_GET_BOOK = "private";
/** The return type of the {@code getBook} method of the Catalog. */
public static final String OP_RETTYPE_CATALOG_GET_BOOK = "Book";
/** The name of the {@code getBook} method of the Catalog. */
public static final String OP_NAME_CATALOG_GET_BOOK = "getBook";
public static final String OP_ARGTYPE_CATALOG_GET_BOOK = "long";
public static final String OP_FQNAME_CATALOG_GET_BOOK =
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CATALOG + "." + BookstoreOperationExecutionRecordFactory.OP_NAME_CATALOG_GET_BOOK;
public static final String OP_NAMEWITHARG_CATALOG_GET_BOOK =
BookstoreOperationExecutionRecordFactory.OP_NAME_CATALOG_GET_BOOK + "("
+ BookstoreOperationExecutionRecordFactory.OP_ARGTYPE_CATALOG_GET_BOOK + ")";
public static final String OP_MODIFIER_CRM_GET_ORDERS = "private";
public static final String OP_RETTYPE_CRM_GET_ORDERS = "Order[]";
public static final String OP_NAME_CRM_GET_ORDERS = "getOrders";
public static final String OP_ARGTYPE_CRM_GET_ORDERS = "long";
public static final String OP_FQNAME_CRM_GET_ORDERS =
BookstoreOperationExecutionRecordFactory.FQ_CLASS_CRM + "." + BookstoreOperationExecutionRecordFactory.OP_NAME_CRM_GET_ORDERS;
public static final String OP_NAMEWITHARG_CRM_GET_ORDERS =
BookstoreOperationExecutionRecordFactory.OP_NAME_CRM_GET_ORDERS + "("
+ BookstoreOperationExecutionRecordFactory.OP_ARGTYPE_CRM_GET_ORDERS + ")";
public static final String FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK =
BookstoreOperationExecutionRecordFactory.OP_MODIFIER_BOOKSTORE_SEARCH_BOOK + " "
+ BookstoreOperationExecutionRecordFactory.OP_RETTYPE_BOOKSTORE_SEARCH_BOOK + " "
+ BookstoreOperationExecutionRecordFactory.OP_FQNAME_BOOKSTORE_SEARCH_BOOK + "("
+ BookstoreOperationExecutionRecordFactory.OP_ARGTYPE_BOOKSTORE_SEARCH_BOOK + ")";
public static final String FQ_SIGNATURE_CATALOG_GET_BOOK =
BookstoreOperationExecutionRecordFactory.OP_MODIFIER_CATALOG_GET_BOOK + " "
+ BookstoreOperationExecutionRecordFactory.OP_RETTYPE_CATALOG_GET_BOOK + " "
+ BookstoreOperationExecutionRecordFactory.OP_FQNAME_CATALOG_GET_BOOK + "("
+ BookstoreOperationExecutionRecordFactory.OP_ARGTYPE_CATALOG_GET_BOOK + ")";
public static final String FQ_SIGNATURE_CRM_GET_ORDERS =
BookstoreOperationExecutionRecordFactory.OP_MODIFIER_CRM_GET_ORDERS + " "
+ BookstoreOperationExecutionRecordFactory.OP_RETTYPE_CRM_GET_ORDERS + " "
+ BookstoreOperationExecutionRecordFactory.OP_FQNAME_CRM_GET_ORDERS + "("
+ BookstoreOperationExecutionRecordFactory.OP_ARGTYPE_CRM_GET_ORDERS + ")";
public static final int EXEC0_0__BOOKSTORE_SEARCHBOOK_EOI = 0; // NOCS (constant name)
public static final int EXEC0_0__BOOKSTORE_SEARCHBOOK_ESS = 0; // NOCS (constant name)
public static final int EXEC1_1__CATALOG_GETBOOK_EOI = 1; // NOCS (constant name)
public static final int EXEC1_1__CATALOG_GETBOOK_ESS = 1; // NOCS (constant name)
public static final int EXEC2_1__CRM_GETORDERS_EOI = 2; // NOCS (constant name)
public static final int EXEC2_1__CRM_GETORDERS_ESS = 1; // NOCS (constant name)
public static final int EXEC3_2__CATALOG_GETBOOK_EOI = 3; // NOCS (constant name)
public static final int EXEC3_2__CATALOG_GETBOOK_ESS = 2; // NOCS (constant name)
private BookstoreOperationExecutionRecordFactory() {}
/**
* Returns the ordered List of {@link OperationExecutionRecord}s for the "well-known" bookstore trace with short operation signatures, i.e., class name and
* operation without modifiers, return type, args etc.
* Example: <code>Catalog.searchBook</code>.
*
* @param sessionId
* The session ID.
* @param traceId
* The trace ID.
*
* @return The list of operation execution records.
*/
public static List<OperationExecutionRecord> genValidBookstoreTraceFullSignature(final String sessionId, final long traceId) {
final String hostname = "srv9786";
final List<OperationExecutionRecord> retList = new ArrayList<OperationExecutionRecord>(4); // 4 executions
final OperationExecutionRecord exec0_0__bookstore_searchBook = new OperationExecutionRecord( // NOCS (LocalFinalVariableNameCheck)
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK,
sessionId, traceId,
1, // tin
10, // tout
hostname,
BookstoreOperationExecutionRecordFactory.EXEC0_0__BOOKSTORE_SEARCHBOOK_EOI,
BookstoreOperationExecutionRecordFactory.EXEC0_0__BOOKSTORE_SEARCHBOOK_ESS);
retList.add(exec0_0__bookstore_searchBook);
final OperationExecutionRecord exec1_1__catalog_getBook = new OperationExecutionRecord( // NOCS (LocalFinalVariableNameCheck)
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
sessionId, traceId,
2, // tin
4, // tout
hostname,
BookstoreOperationExecutionRecordFactory.EXEC1_1__CATALOG_GETBOOK_EOI,
BookstoreOperationExecutionRecordFactory.EXEC0_0__BOOKSTORE_SEARCHBOOK_ESS);
retList.add(exec1_1__catalog_getBook);
final OperationExecutionRecord exec2_1__crm_getOrders = new OperationExecutionRecord( // NOCS (LocalFinalVariableNameCheck)
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CRM_GET_ORDERS,
sessionId, traceId,
5, // tin
8, // tout
hostname,
BookstoreOperationExecutionRecordFactory.EXEC2_1__CRM_GETORDERS_EOI,
BookstoreOperationExecutionRecordFactory.EXEC2_1__CRM_GETORDERS_ESS);
retList.add(exec2_1__crm_getOrders);
final OperationExecutionRecord exec3_2__catalog_getBook = new OperationExecutionRecord( // NOCS (LocalFinalVariableNameCheck)
BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_CATALOG_GET_BOOK,
sessionId, traceId,
6, // tin
7, // tout
hostname,
BookstoreOperationExecutionRecordFactory.EXEC3_2__CATALOG_GETBOOK_EOI,
BookstoreOperationExecutionRecordFactory.EXEC3_2__CATALOG_GETBOOK_ESS);
retList.add(exec3_2__catalog_getBook);
return retList;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment