1 package org
.eclipse
.linuxtools
.ctf
.core
.tests
.trace
;
3 import static org
.junit
.Assert
.assertNotNull
;
4 import static org
.junit
.Assert
.assertTrue
;
6 import java
.nio
.channels
.FileChannel
;
7 import java
.util
.HashMap
;
10 import org
.eclipse
.linuxtools
.ctf
.core
.event
.EventDeclaration
;
11 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.StructDeclaration
;
12 import org
.eclipse
.linuxtools
.ctf
.core
.tests
.TestParams
;
13 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.CTFReaderException
;
14 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.CTFTrace
;
15 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.Stream
;
16 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.StreamInput
;
17 import org
.eclipse
.linuxtools
.internal
.ctf
.core
.event
.metadata
.exceptions
.ParseException
;
18 import org
.junit
.After
;
19 import org
.junit
.Before
;
20 import org
.junit
.Test
;
23 * The class <code>StreamTest</code> contains tests for the class
24 * <code>{@link Stream}</code>.
27 * @version $Revision: 1.0 $
29 @SuppressWarnings("javadoc")
30 public class StreamTest
{
32 private Stream fixture
;
38 * the command line arguments
40 public static void main(String
[] args
) {
41 new org
.junit
.runner
.JUnitCore().run(StreamTest
.class);
45 * Perform pre-test initialization.
47 * @throws CTFReaderException
50 public void setUp() throws CTFReaderException
{
51 fixture
= new Stream(TestParams
.createTrace());
52 fixture
.setEventContext(new StructDeclaration(1L));
53 fixture
.setPacketContext(new StructDeclaration(1L));
54 fixture
.setEventHeader(new StructDeclaration(1L));
56 fixture
.addInput(new StreamInput(new Stream(TestParams
.createTrace()),
57 (FileChannel
) null, TestParams
.getEmptyFile()));
61 * Perform post-test clean-up.
64 public void tearDown() {
65 // Add additional tear down code here
69 * Run the Stream(CTFTrace) constructor test.
71 * @throws CTFReaderException
74 public void testStream() throws CTFReaderException
{
75 CTFTrace trace
= TestParams
.createTrace();
76 Stream result
= new Stream(trace
);
77 assertNotNull(result
);
81 * Run the void addEvent(EventDeclaration) method test with the basic
83 * @throws ParseException
86 public void testAddEvent_base() throws ParseException
{
87 EventDeclaration event
= new EventDeclaration();
88 fixture
.addEvent(event
);
92 * Run the boolean eventContextIsSet() method test.
95 public void testEventContextIsSet() {
96 assertTrue(fixture
.isEventContextSet());
99 * Run the boolean eventContextIsSet() method test.
102 public void testToString() {
103 assertNotNull(fixture
.toString());
107 * Run the boolean eventHeaderIsSet() method test.
110 public void testEventHeaderIsSet() {
111 assertTrue(fixture
.isEventHeaderSet());
115 * Run the StructDeclaration getEventContextDecl() method test.
118 public void testGetEventContextDecl() {
119 assertNotNull(fixture
.getEventContextDecl());
123 * Run the StructDeclaration getEventHeaderDecl() method test.
126 public void testGetEventHeaderDecl() {
127 assertNotNull(fixture
.getEventHeaderDecl());
131 * Run the HashMap<Long, EventDeclaration> getEvents() method test.
134 public void testGetEvents() {
135 HashMap
<Long
, EventDeclaration
> result
= fixture
.getEvents();
136 assertNotNull(result
);
140 * Run the Long getId() method test.
143 public void testGetId() {
144 Long result
= fixture
.getId();
145 assertNotNull(result
);
149 * Run the StructDeclaration getPacketContextDecl() method test.
152 public void testGetPacketContextDecl() {
153 StructDeclaration result
= fixture
.getPacketContextDecl();
154 assertNotNull(result
);
158 * Run the Set<StreamInput> getStreamInputs() method test.
161 public void testGetStreamInputs() {
162 Set
<StreamInput
> result
= fixture
.getStreamInputs();
163 assertNotNull(result
);
167 * Run the CTFTrace getTrace() method test.
170 public void testGetTrace() {
171 CTFTrace result
= fixture
.getTrace();
172 assertNotNull(result
);
176 * Run the boolean idIsSet() method test.
179 public void testIdIsSet() {
180 boolean result
= fixture
.isIdSet();
185 * Run the boolean packetContextIsSet() method test.
188 public void testPacketContextIsSet() {
189 boolean result
= fixture
.isPacketContextSet();
195 * Run the void setEventContext(StructDeclaration) method test.
198 public void testSetEventContext() {
199 StructDeclaration eventContext
= new StructDeclaration(1L);
200 fixture
.setEventContext(eventContext
);
204 * Run the void setEventHeader(StructDeclaration) method test.
207 public void testSetEventHeader() {
208 StructDeclaration eventHeader
= new StructDeclaration(1L);
209 fixture
.setEventHeader(eventHeader
);
213 * Run the void setId(long) method test.
216 public void testSetId() {
222 * Run the void setPacketContext(StructDeclaration) method test.
225 public void testSetPacketContext() {
226 StructDeclaration packetContext
= new StructDeclaration(1L);
227 fixture
.setPacketContext(packetContext
);