Add a trace filter to the set of event filters in TmfRequests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / trace / StreamTest.java
CommitLineData
866e5b51
FC
1package org.eclipse.linuxtools.ctf.core.tests.trace;
2
3import static org.junit.Assert.assertNotNull;
4import static org.junit.Assert.assertTrue;
5
6import java.nio.channels.FileChannel;
7import java.util.HashMap;
8import java.util.Set;
9
10import org.eclipse.linuxtools.ctf.core.event.EventDeclaration;
866e5b51
FC
11import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
12import org.eclipse.linuxtools.ctf.core.tests.TestParams;
13be1a8f 13import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
866e5b51 14import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
486efb2e
AM
15import org.eclipse.linuxtools.ctf.core.trace.Stream;
16import org.eclipse.linuxtools.ctf.core.trace.StreamInput;
ce2388e0 17import org.eclipse.linuxtools.internal.ctf.core.event.metadata.exceptions.ParseException;
866e5b51
FC
18import org.junit.After;
19import org.junit.Before;
20import org.junit.Test;
21
22/**
23 * The class <code>StreamTest</code> contains tests for the class
24 * <code>{@link Stream}</code>.
e291b8c8 25 *
866e5b51
FC
26 * @author ematkho
27 * @version $Revision: 1.0 $
28 */
be6df2d8 29@SuppressWarnings("javadoc")
866e5b51
FC
30public class StreamTest {
31
32 private Stream fixture;
33
34 /**
35 * Launch the test.
e291b8c8 36 *
866e5b51
FC
37 * @param args
38 * the command line arguments
39 */
40 public static void main(String[] args) {
41 new org.junit.runner.JUnitCore().run(StreamTest.class);
42 }
43
44 /**
45 * Perform pre-test initialization.
788ddcbc
MK
46 *
47 * @throws CTFReaderException
866e5b51
FC
48 */
49 @Before
13be1a8f 50 public void setUp() throws CTFReaderException {
866e5b51
FC
51 fixture = new Stream(TestParams.createTrace());
52 fixture.setEventContext(new StructDeclaration(1L));
53 fixture.setPacketContext(new StructDeclaration(1L));
54 fixture.setEventHeader(new StructDeclaration(1L));
55 fixture.setId(1L);
56 fixture.addInput(new StreamInput(new Stream(TestParams.createTrace()),
57 (FileChannel) null, TestParams.getEmptyFile()));
58 }
59
60 /**
61 * Perform post-test clean-up.
62 */
63 @After
64 public void tearDown() {
65 // Add additional tear down code here
66 }
67
68 /**
69 * Run the Stream(CTFTrace) constructor test.
788ddcbc
MK
70 *
71 * @throws CTFReaderException
866e5b51
FC
72 */
73 @Test
13be1a8f 74 public void testStream() throws CTFReaderException {
866e5b51
FC
75 CTFTrace trace = TestParams.createTrace();
76 Stream result = new Stream(trace);
77 assertNotNull(result);
78 }
79
80 /**
81 * Run the void addEvent(EventDeclaration) method test with the basic
82 * event.
e291b8c8 83 * @throws ParseException
866e5b51
FC
84 */
85 @Test
86 public void testAddEvent_base() throws ParseException {
87 EventDeclaration event = new EventDeclaration();
88 fixture.addEvent(event);
89 }
90
866e5b51
FC
91 /**
92 * Run the boolean eventContextIsSet() method test.
93 */
94 @Test
95 public void testEventContextIsSet() {
9ac2eb62 96 assertTrue(fixture.isEventContextSet());
866e5b51 97 }
e291b8c8
MK
98 /**
99 * Run the boolean eventContextIsSet() method test.
100 */
101 @Test
102 public void testToString() {
103 assertNotNull(fixture.toString());
104 }
866e5b51
FC
105
106 /**
107 * Run the boolean eventHeaderIsSet() method test.
108 */
109 @Test
110 public void testEventHeaderIsSet() {
9ac2eb62 111 assertTrue(fixture.isEventHeaderSet());
866e5b51
FC
112 }
113
114 /**
115 * Run the StructDeclaration getEventContextDecl() method test.
116 */
117 @Test
118 public void testGetEventContextDecl() {
119 assertNotNull(fixture.getEventContextDecl());
120 }
121
122 /**
123 * Run the StructDeclaration getEventHeaderDecl() method test.
124 */
125 @Test
126 public void testGetEventHeaderDecl() {
127 assertNotNull(fixture.getEventHeaderDecl());
128 }
129
130 /**
131 * Run the HashMap<Long, EventDeclaration> getEvents() method test.
132 */
133 @Test
134 public void testGetEvents() {
135 HashMap<Long, EventDeclaration> result = fixture.getEvents();
136 assertNotNull(result);
137 }
138
139 /**
140 * Run the Long getId() method test.
141 */
142 @Test
143 public void testGetId() {
144 Long result = fixture.getId();
145 assertNotNull(result);
146 }
147
148 /**
149 * Run the StructDeclaration getPacketContextDecl() method test.
150 */
151 @Test
152 public void testGetPacketContextDecl() {
153 StructDeclaration result = fixture.getPacketContextDecl();
154 assertNotNull(result);
155 }
156
157 /**
158 * Run the Set<StreamInput> getStreamInputs() method test.
159 */
160 @Test
161 public void testGetStreamInputs() {
162 Set<StreamInput> result = fixture.getStreamInputs();
163 assertNotNull(result);
164 }
165
166 /**
167 * Run the CTFTrace getTrace() method test.
168 */
169 @Test
170 public void testGetTrace() {
171 CTFTrace result = fixture.getTrace();
172 assertNotNull(result);
173 }
174
175 /**
176 * Run the boolean idIsSet() method test.
177 */
178 @Test
179 public void testIdIsSet() {
9ac2eb62 180 boolean result = fixture.isIdSet();
866e5b51
FC
181 assertTrue(result);
182 }
183
184 /**
185 * Run the boolean packetContextIsSet() method test.
186 */
187 @Test
188 public void testPacketContextIsSet() {
9ac2eb62 189 boolean result = fixture.isPacketContextSet();
866e5b51
FC
190 assertTrue(result);
191 }
192
193
194 /**
195 * Run the void setEventContext(StructDeclaration) method test.
196 */
197 @Test
198 public void testSetEventContext() {
199 StructDeclaration eventContext = new StructDeclaration(1L);
200 fixture.setEventContext(eventContext);
201 }
202
203 /**
204 * Run the void setEventHeader(StructDeclaration) method test.
205 */
206 @Test
207 public void testSetEventHeader() {
208 StructDeclaration eventHeader = new StructDeclaration(1L);
209 fixture.setEventHeader(eventHeader);
210 }
211
212 /**
213 * Run the void setId(long) method test.
214 */
215 @Test
216 public void testSetId() {
217 long id = 1L;
218 fixture.setId(id);
219 }
220
221 /**
222 * Run the void setPacketContext(StructDeclaration) method test.
223 */
224 @Test
225 public void testSetPacketContext() {
226 StructDeclaration packetContext = new StructDeclaration(1L);
227 fixture.setPacketContext(packetContext);
228 }
229}
This page took 0.050082 seconds and 5 git commands to generate.