import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
*/
public class CtfIteratorTest {
- private static final int TRACE_INDEX = 0;
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
- private CtfIterator fixture;
+ private CtfTmfTrace trace;
+ private CtfIterator iterator;
/**
* Perform pre-test initialization.
*/
@Before
public void setUp() {
- assumeTrue(CtfTmfTestTraces.tracesExist());
- fixture = new CtfIterator(getTrace());
+ assumeTrue(testTrace.exists());
+ trace = testTrace.getTrace();
+ iterator = new CtfIterator(trace);
CtfLocation ctfLocation = new CtfLocation(new CtfLocationInfo(1, 0));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
+ iterator.setLocation(ctfLocation);
+ iterator.increaseRank();
}
/**
*/
@After
public void tearDown() {
- if (fixture != null) {
- fixture.dispose();
+ if (iterator != null) {
+ iterator.dispose();
}
}
- private static CtfTmfTrace getTrace() {
- return CtfTmfTestTraces.getTestTrace(TRACE_INDEX);
- }
-
/**
* Run the CtfIterator(CtfTmfTrace) constructor on a non init'ed trace.
*/
@Test
public void testCtfIterator_noinit() {
- CtfTmfTrace trace = getTrace();
CtfIterator result = new CtfIterator(trace);
assertNotNull(result);
}
*/
@Test
public void testCtfIterator_init() {
- CtfTmfTrace trace = getTrace();
- trace.init("test"); //$NON-NLS-1$
+ trace.init("test");
CtfIterator result = new CtfIterator(trace);
assertNotNull(result);
*/
@Test
public void testCtfIterator_position() {
- CtfTmfTrace trace = getTrace();
long timestampValue = 1L;
long rank = 1L;
CtfIterator result = new CtfIterator(trace, new CtfLocationInfo(timestampValue, 0), rank);
*/
@Test
public void testAdvance() {
- boolean result = fixture.advance();
+ boolean result = iterator.advance();
assertTrue(result);
}
*/
@Test
public void testClone() {
- CtfIterator result = fixture.clone();
+ CtfIterator result = iterator.clone();
assertNotNull(result);
}
*/
@Test
public void testCompareTo() {
- CtfIterator o = new CtfIterator(getTrace());
- int result = fixture.compareTo(o);
+ CtfIterator o = new CtfIterator(trace);
+ int result = iterator.compareTo(o);
assertEquals(1L, result);
}
*/
@Test
public void testEquals_other() {
- CtfIterator obj = new CtfIterator(getTrace());
+ CtfIterator obj = new CtfIterator(trace);
CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0));
obj.setLocation(ctfLocation1);
obj.increaseRank();
- boolean result = fixture.equals(obj);
+ boolean result = iterator.equals(obj);
assertTrue(result);
}
@Test
public void testEquals_empty() {
Object obj = new Object();
- boolean result = fixture.equals(obj);
+ boolean result = iterator.equals(obj);
assertFalse(result);
}
*/
@Test
public void testGetCtfTmfTrace() {
- CtfTmfTrace result = fixture.getCtfTmfTrace();
+ CtfTmfTrace result = iterator.getCtfTmfTrace();
assertNotNull(result);
}
*/
@Test
public void testGetCurrentEvent() {
- CtfTmfEvent result = fixture.getCurrentEvent();
+ CtfTmfEvent result = iterator.getCurrentEvent();
assertNotNull(result);
}
*/
@Test
public void testGetLocation() {
- CtfLocation result = fixture.getLocation();
+ CtfLocation result = iterator.getLocation();
assertNotNull(result);
}
*/
@Test
public void testGetRank() {
- long result = fixture.getRank();
+ long result = iterator.getRank();
assertEquals(1L, result);
}
*/
@Test
public void testHasValidRank() {
- boolean result = fixture.hasValidRank();
+ boolean result = iterator.hasValidRank();
assertTrue(result);
}
*/
@Test
public void testHashCode() {
- int result = fixture.hashCode();
- int result2 = fixture.hashCode();
+ int result = iterator.hashCode();
+ int result2 = iterator.hashCode();
assertEquals(result, result2);
}
*/
@Test
public void testIncreaseRank() {
- fixture.increaseRank();
+ iterator.increaseRank();
}
/**
@Test
public void testSeek() {
long timestamp = 1L;
- boolean result = fixture.seek(timestamp);
+ boolean result = iterator.seek(timestamp);
assertTrue(result);
}
@Test
public void testSetLocation() {
CtfLocation location = new CtfLocation(new CtfLocationInfo(1, 0));
- fixture.setLocation(location);
+ iterator.setLocation(location);
}
}