Tmf: Trace synchronization using network events
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.core.tests / src / org / eclipse / linuxtools / lttng2 / kernel / core / tests / event / matchandsync / MatchAndSyncTest.java
CommitLineData
e73a4ba5
GB
1/*******************************************************************************
2 * Copyright (c) 2013 École Polytechnique de Montréal
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Geneviève Bastien - Initial implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.lttng2.kernel.core.tests.event.matchandsync;
14
15import static org.junit.Assert.assertEquals;
16import static org.junit.Assert.assertTrue;
17
18import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpEventMatching;
19import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMatching;
20import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
21import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
22import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching;
23import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
24import org.junit.Test;
25
26/**
27 * Tests for {@link TcpEventMatching}
28 *
29 * @author Geneviève Bastien
30 */
31@SuppressWarnings("nls")
32public class MatchAndSyncTest {
33
34 /**
35 * Testing the packet matching
36 */
37 @Test
38 public void testMatching() {
39 final String cr = System.getProperty("line.separator");
40 CtfTmfTrace trace1 = CtfTmfTestTraces.getTestTrace(3);
41 CtfTmfTrace trace2 = CtfTmfTestTraces.getTestTrace(4);
42
43 CtfTmfTrace[] tracearr = new CtfTmfTrace[2];
44 tracearr[0] = trace1;
45 tracearr[1] = trace2;
46
47 TmfEventMatching.registerMatchObject(new TcpEventMatching());
48 TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
49
50 TmfNetworkEventMatching twoTraceMatch = new TmfNetworkEventMatching(tracearr);
51 assertTrue(twoTraceMatch.matchEvents());
52
53 String stats = twoTraceMatch.toString();
54 assertEquals("TmfEventMatches [ Number of matches found: 46 ]" +
55 "Trace 0:" + cr +
56 " 3 unmatched incoming events" + cr +
57 " 2 unmatched outgoing events" + cr +
58 "Trace 1:" + cr +
59 " 2 unmatched incoming events" + cr +
60 " 1 unmatched outgoing events" + cr, stats);
61 }
62
63}
This page took 0.026311 seconds and 5 git commands to generate.