Commit | Line | Data |
---|---|---|
866e5b51 FC |
1 | package org.eclipse.linuxtools.ctf.core.tests.trace; |
2 | ||
3 | import static org.junit.Assert.assertNotNull; | |
4 | import static org.junit.Assert.assertNull; | |
5 | import static org.junit.Assert.assertTrue; | |
6 | ||
7 | import java.io.File; | |
8 | import java.nio.channels.FileChannel; | |
9 | ||
10 | import org.eclipse.linuxtools.ctf.core.event.types.Definition; | |
11 | import org.eclipse.linuxtools.ctf.core.tests.TestParams; | |
13be1a8f | 12 | import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException; |
ce2388e0 FC |
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; | |
866e5b51 FC |
16 | import org.junit.After; |
17 | import org.junit.Before; | |
18 | import org.junit.Test; | |
19 | ||
20 | /** | |
21 | * The class <code>StreamInputTest</code> contains tests for the class | |
22 | * <code>{@link StreamInput}</code>. | |
23 | * | |
24 | * @author ematkho | |
25 | * @version $Revision: 1.0 $ | |
26 | */ | |
27 | public class StreamInputTest { | |
28 | ||
29 | private StreamInput fixture; | |
30 | ||
31 | /** | |
32 | * Launch the test. | |
33 | * | |
34 | * @param args | |
35 | * the command line arguments | |
36 | */ | |
37 | public static void main(String[] args) { | |
38 | new org.junit.runner.JUnitCore().run(StreamInputTest.class); | |
39 | } | |
40 | ||
41 | /** | |
42 | * Perform pre-test initialization. | |
13be1a8f AM |
43 | * |
44 | * @throws CTFReaderException | |
866e5b51 FC |
45 | */ |
46 | @Before | |
13be1a8f | 47 | public void setUp() throws CTFReaderException { |
866e5b51 FC |
48 | fixture = new StreamInput(new Stream(TestParams.createTrace()), |
49 | (FileChannel) null, createFile()); | |
50 | fixture.setTimestampEnd(1L); | |
51 | } | |
52 | ||
53 | /** | |
54 | * Perform post-test clean-up. | |
55 | */ | |
56 | @After | |
57 | public void tearDown() { | |
58 | // Add additional tear down code here | |
59 | } | |
60 | ||
61 | private static File createFile() { | |
62 | return new File("Tests/traces/trace20m/channel_0"); //$NON-NLS-1$ | |
63 | } | |
64 | ||
65 | /** | |
66 | * Run the StreamInput(Stream,FileChannel,File) constructor test. | |
67 | */ | |
68 | @Test | |
69 | public void testStreamInput() { | |
70 | assertNotNull(fixture); | |
71 | } | |
72 | ||
73 | /** | |
74 | * Run the FileChannel getFileChannel() method test. | |
75 | */ | |
76 | @Test | |
77 | public void testGetFileChannel() { | |
78 | FileChannel result = fixture.getFileChannel(); | |
79 | assertNull(result); | |
80 | } | |
81 | ||
82 | /** | |
83 | * Run the String getFilename() method test. | |
84 | */ | |
85 | @Test | |
86 | public void testGetFilename() { | |
87 | String result = fixture.getFilename(); | |
88 | assertNotNull(result); | |
89 | } | |
90 | ||
91 | /** | |
92 | * Run the StreamInputPacketIndex getIndex() method test. | |
93 | */ | |
94 | @Test | |
95 | public void testGetIndex() { | |
96 | StreamInputPacketIndex result = fixture.getIndex(); | |
97 | assertNotNull(result); | |
98 | } | |
99 | ||
100 | /** | |
101 | * Run the String getPath() method test. | |
102 | */ | |
103 | @Test | |
104 | public void testGetPath() { | |
105 | String result = fixture.getPath(); | |
106 | assertNotNull(result); | |
107 | } | |
108 | ||
109 | /** | |
110 | * Run the Stream getStream() method test. | |
111 | */ | |
112 | @Test | |
113 | public void testGetStream() { | |
114 | Stream result = fixture.getStream(); | |
115 | assertNotNull(result); | |
116 | } | |
117 | ||
118 | /** | |
119 | * Run the long getTimestampEnd() method test. | |
120 | */ | |
121 | @Test | |
122 | public void testGetTimestampEnd() { | |
123 | long result = fixture.getTimestampEnd(); | |
124 | assertTrue(0L < result); | |
125 | } | |
126 | ||
127 | /** | |
128 | * Run the Definition lookupDefinition(String) method test. | |
129 | */ | |
130 | @Test | |
131 | public void testLookupDefinition() { | |
132 | Definition result = fixture.lookupDefinition("id"); //$NON-NLS-1$ | |
133 | assertNull(result); | |
134 | } | |
135 | ||
136 | /** | |
137 | * Run the void setTimestampEnd(long) method test. | |
138 | */ | |
139 | @Test | |
140 | public void testSetTimestampEnd() { | |
141 | fixture.setTimestampEnd(1L); | |
142 | } | |
143 | } |