1 package org
.eclipse
.linuxtools
.ctf
.core
.tests
.trace
;
3 import static org
.junit
.Assert
.assertNotNull
;
4 import static org
.junit
.Assert
.assertNull
;
5 import static org
.junit
.Assert
.assertTrue
;
8 import java
.nio
.channels
.FileChannel
;
10 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.Definition
;
11 import org
.eclipse
.linuxtools
.ctf
.core
.tests
.TestParams
;
12 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.CTFReaderException
;
13 import org
.eclipse
.linuxtools
.internal
.ctf
.core
.trace
.Stream
;
14 import org
.eclipse
.linuxtools
.internal
.ctf
.core
.trace
.StreamInput
;
15 import org
.eclipse
.linuxtools
.internal
.ctf
.core
.trace
.StreamInputPacketIndex
;
16 import org
.junit
.After
;
17 import org
.junit
.Before
;
18 import org
.junit
.Test
;
21 * The class <code>StreamInputTest</code> contains tests for the class
22 * <code>{@link StreamInput}</code>.
25 * @version $Revision: 1.0 $
27 public class StreamInputTest
{
29 private StreamInput fixture
;
35 * the command line arguments
37 public static void main(String
[] args
) {
38 new org
.junit
.runner
.JUnitCore().run(StreamInputTest
.class);
42 * Perform pre-test initialization.
44 * @throws CTFReaderException
47 public void setUp() throws CTFReaderException
{
48 fixture
= new StreamInput(new Stream(TestParams
.createTrace()),
49 (FileChannel
) null, createFile());
50 fixture
.setTimestampEnd(1L);
54 * Perform post-test clean-up.
57 public void tearDown() {
58 // Add additional tear down code here
61 private static File
createFile() {
62 return new File("Tests/traces/trace20m/channel_0"); //$NON-NLS-1$
66 * Run the StreamInput(Stream,FileChannel,File) constructor test.
69 public void testStreamInput() {
70 assertNotNull(fixture
);
74 * Run the FileChannel getFileChannel() method test.
77 public void testGetFileChannel() {
78 FileChannel result
= fixture
.getFileChannel();
83 * Run the String getFilename() method test.
86 public void testGetFilename() {
87 String result
= fixture
.getFilename();
88 assertNotNull(result
);
92 * Run the StreamInputPacketIndex getIndex() method test.
95 public void testGetIndex() {
96 StreamInputPacketIndex result
= fixture
.getIndex();
97 assertNotNull(result
);
101 * Run the String getPath() method test.
104 public void testGetPath() {
105 String result
= fixture
.getPath();
106 assertNotNull(result
);
110 * Run the Stream getStream() method test.
113 public void testGetStream() {
114 Stream result
= fixture
.getStream();
115 assertNotNull(result
);
119 * Run the long getTimestampEnd() method test.
122 public void testGetTimestampEnd() {
123 long result
= fixture
.getTimestampEnd();
124 assertTrue(0L < result
);
128 * Run the Definition lookupDefinition(String) method test.
131 public void testLookupDefinition() {
132 Definition result
= fixture
.lookupDefinition("id"); //$NON-NLS-1$
137 * Run the void setTimestampEnd(long) method test.
140 public void testSetTimestampEnd() {
141 fixture
.setTimestampEnd(1L);