1 /*******************************************************************************
2 * Copyright (c) 2013 École Polytechnique de Montréal
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
10 * Geneviève Bastien - Initial implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng2
.kernel
.core
.tests
.event
.matchandsync
;
15 import static org
.junit
.Assert
.assertEquals
;
16 import static org
.junit
.Assert
.assertTrue
;
18 import org
.eclipse
.linuxtools
.lttng2
.kernel
.core
.event
.matching
.TcpEventMatching
;
19 import org
.eclipse
.linuxtools
.lttng2
.kernel
.core
.event
.matching
.TcpLttngEventMatching
;
20 import org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
.CtfTmfTrace
;
21 import org
.eclipse
.linuxtools
.tmf
.core
.event
.matching
.TmfEventMatching
;
22 import org
.eclipse
.linuxtools
.tmf
.core
.event
.matching
.TmfNetworkEventMatching
;
23 import org
.eclipse
.linuxtools
.tmf
.core
.tests
.shared
.CtfTmfTestTrace
;
24 import org
.junit
.Test
;
27 * Tests for {@link TcpEventMatching}
29 * @author Geneviève Bastien
31 @SuppressWarnings("nls")
32 public class MatchAndSyncTest
{
35 * Testing the packet matching
38 public void testMatching() {
39 final String cr
= System
.getProperty("line.separator");
40 CtfTmfTrace trace1
= CtfTmfTestTrace
.SYNC_SRC
.getTrace();
41 CtfTmfTrace trace2
= CtfTmfTestTrace
.SYNC_DEST
.getTrace();
43 CtfTmfTrace
[] tracearr
= new CtfTmfTrace
[2];
47 TmfEventMatching
.registerMatchObject(new TcpEventMatching());
48 TmfEventMatching
.registerMatchObject(new TcpLttngEventMatching());
50 TmfNetworkEventMatching twoTraceMatch
= new TmfNetworkEventMatching(tracearr
);
51 assertTrue(twoTraceMatch
.matchEvents());
53 String stats
= twoTraceMatch
.toString();
54 assertEquals("TmfEventMatches [ Number of matches found: 46 ]" +
56 " 3 unmatched incoming events" + cr
+
57 " 2 unmatched outgoing events" + cr
+
59 " 2 unmatched incoming events" + cr
+
60 " 1 unmatched outgoing events" + cr
, stats
);