import static org.junit.Assume.assumeTrue;
import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
import java.util.UUID;
+import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.ctf.core.trace.CTFStream;
import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.ctf.core.trace.Metadata;
-import org.eclipse.linuxtools.ctf.core.trace.Stream;
import org.junit.Before;
import org.junit.Test;
protected CTFTrace testSingleFragment() throws CTFReaderException {
fixture = new Metadata();
CTFTrace trace = fixture.getTrace();
- for (Stream s : trace.getStreams()) {
+ for (CTFStream s : trace.getStreams()) {
fail("This should be empty, has" + s.toString());
}
fixture.parseText(mdStart);
int count = 0;
- for (Stream s : trace.getStreams()) {
+ for (CTFStream s : trace.getStreams()) {
count++;
assertNotNull(s);
}
assertEquals(1, count);
- assertEquals(1, trace.getEvents(0L).size());
+ assertEquals(1, trace.getEventDeclarations(0L).size());
return trace;
}
@Test
public void testStreamTextMD() throws CTFReaderException {
- CTFTrace trace = testSingleFragment();
- fixture.parseTextFragment(mdSecond);
- assertEquals(2, trace.getEvents(0L).size());
- assertEquals("bozo_the_clown", trace.getEvents(0L).get(1L).getName());
+ try (CTFTrace trace = testSingleFragment();) {
+ fixture.parseTextFragment(mdSecond);
+ final List<IEventDeclaration> eventDeclarations = new ArrayList<>(trace.getEventDeclarations(0L));
+ assertEquals(2, eventDeclarations.size());
+ assertEquals("bozo_the_clown", eventDeclarations.get(1).getName());
+ }
}
/**