1 package org
.eclipse
.linuxtools
.ctf
.core
.tests
.trace
;
3 import static org
.junit
.Assert
.assertEquals
;
4 import static org
.junit
.Assert
.assertFalse
;
5 import static org
.junit
.Assert
.assertNotNull
;
6 import static org
.junit
.Assert
.assertNull
;
7 import static org
.junit
.Assert
.assertTrue
;
8 import static org
.junit
.Assume
.assumeTrue
;
11 import java
.io
.IOException
;
12 import java
.nio
.channels
.FileChannel
;
14 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.Definition
;
15 import org
.eclipse
.linuxtools
.ctf
.core
.tests
.shared
.CtfTestTraces
;
16 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.CTFReaderException
;
17 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.Stream
;
18 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.StreamInput
;
19 import org
.junit
.After
;
20 import org
.junit
.Before
;
21 import org
.junit
.Test
;
24 * The class <code>StreamInputTest</code> contains tests for the class
25 * <code>{@link StreamInput}</code>.
28 * @version $Revision: 1.0 $
30 @SuppressWarnings("javadoc")
31 public class StreamInputTest
{
33 private static final int TRACE_INDEX
= 0;
35 private StreamInput fixture
;
41 * the command line arguments
43 public static void main(String
[] args
) {
44 new org
.junit
.runner
.JUnitCore().run(StreamInputTest
.class);
48 * Perform pre-test initialization.
50 * @throws CTFReaderException
53 public void setUp() throws CTFReaderException
{
54 assumeTrue(CtfTestTraces
.tracesExist());
55 fixture
= new StreamInput(new Stream(CtfTestTraces
.getTestTrace(TRACE_INDEX
)),
56 (FileChannel
) null, createFile());
57 fixture
.setTimestampEnd(1L);
61 * Perform post-test clean-up.
64 public void tearDown() {
65 // Add additional tear down code here
68 private static File
createFile() {
69 return new File("Tests/traces/trace20m/channel_0"); //$NON-NLS-1$
73 * Run the StreamInput(Stream,FileChannel,File) constructor test.
76 public void testStreamInput() {
77 assertNotNull(fixture
);
81 * Run the FileChannel getFileChannel() method test.
86 public void testGetFileChannel() throws IOException
{
87 FileChannel result
= fixture
.getFileChannel();
95 * Run the String getFilename() method test.
98 public void testGetFilename() {
99 String result
= fixture
.getFilename();
100 assertNotNull(result
);
104 * Run the String getPath() method test.
107 public void testGetPath() {
108 String result
= fixture
.getPath();
109 assertNotNull(result
);
113 * Run the Stream getStream() method test.
116 public void testGetStream() {
117 Stream result
= fixture
.getStream();
118 assertNotNull(result
);
122 * Run the long getTimestampEnd() method test.
125 public void testGetTimestampEnd() {
126 long result
= fixture
.getTimestampEnd();
127 assertTrue(0L < result
);
131 * Run the Definition lookupDefinition(String) method test.
134 public void testLookupDefinition() {
135 Definition result
= fixture
.lookupDefinition("id"); //$NON-NLS-1$
140 * Run the void setTimestampEnd(long) method test.
143 public void testSetTimestampEnd() {
144 fixture
.setTimestampEnd(1L);
145 assertEquals(fixture
.getTimestampEnd(), 1L);
153 public void testEquals1() throws CTFReaderException
{
154 s1
= new StreamInput(new Stream(CtfTestTraces
.getTestTrace(TRACE_INDEX
)),
155 (FileChannel
) null, createFile());
156 assertFalse(s1
.equals(null));
160 public void testEquals2() throws CTFReaderException
{
161 s1
= new StreamInput(new Stream(CtfTestTraces
.getTestTrace(TRACE_INDEX
)),
162 (FileChannel
) null, createFile());
163 assertFalse(s1
.equals(new Long(23L)));
167 public void testEquals3() throws CTFReaderException
{
168 s1
= new StreamInput(new Stream(CtfTestTraces
.getTestTrace(TRACE_INDEX
)),
169 (FileChannel
) null, createFile());
174 public void testEquals4() throws CTFReaderException
{
175 s1
= new StreamInput(new Stream(CtfTestTraces
.getTestTrace(TRACE_INDEX
)),
176 (FileChannel
) null, createFile());
177 s2
= new StreamInput(new Stream(CtfTestTraces
.getTestTrace(TRACE_INDEX
)),
178 (FileChannel
) null, createFile());
This page took 0.033648 seconds and 5 git commands to generate.