import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
-import org.eclipse.linuxtools.ctf.core.trace.Stream;
+import org.eclipse.linuxtools.ctf.core.trace.CTFStream;
import org.eclipse.linuxtools.internal.ctf.core.event.EventDeclaration;
import org.junit.Before;
import org.junit.Test;
fixture.setContext(new StructDeclaration(1L));
fixture.setId(1L);
fixture.setFields(new StructDeclaration(1L));
- fixture.setStream(new Stream(testTrace.getTrace()));
+ fixture.setStream(new CTFStream(testTrace.getTrace()));
fixture.setName("");
}
obj.setContext(new StructDeclaration(1L));
obj.setId(1L);
obj.setFields(new StructDeclaration(1L));
- obj.setStream(new Stream(testTrace.getTrace()));
+ obj.setStream(new CTFStream(testTrace.getTrace()));
obj.setName("");
assertTrue(fixture.equals(fixture));
*/
@Test
public void testGetId() {
- Long result = fixture.getId();
- assertNotNull(result);
+ assertEquals(1,fixture.id());
}
/**
*/
@Test
public void testGetStream() {
- Stream result = fixture.getStream();
+ CTFStream result = fixture.getStream();
assertNotNull(result);
}
*/
@Test
public void testHashCode_null() {
- fixture.setStream((Stream) null);
+ fixture.setStream((CTFStream) null);
fixture.setName((String) null);
int result = fixture.hashCode();
*/
@Test
public void testStreamIsSet_null() {
- fixture.setStream((Stream) null);
+ fixture.setStream((CTFStream) null);
boolean result = fixture.streamIsSet();
assertEquals(false, result);
*/
@Test
public void testEventDefinition() throws CTFReaderException {
- CTFTrace trace = testTrace.getTrace();
- CTFTraceReader tr = new CTFTraceReader(trace);
- tr.advance();
- EventDefinition ed = new EventDefinition(null, null);
- ed = tr.getCurrentEventDef();
- assertNotNull(ed);
- assertNotNull(ed.getPath());
- assertNotNull(ed.getDeclaration());
- assertNotNull(ed.getFields());
- assertNull(ed.getContext());
- assertNotNull(ed.getPacketContext());
- assertNotNull(ed.getCPU());
- assertNotNull(ed.getPacketContext());
- assertNotNull(ed.getStreamInputReader());
- assertNull(ed.lookupDefinition("context"));
- assertNotNull(ed.lookupDefinition("fields"));
- assertNull(ed.lookupDefinition("other"));
- assertNotNull(ed.toString());
- ed.setContext( ed.getFields());
- assertNotNull(ed.toString());
+ try (CTFTrace trace = testTrace.getTrace();) {
+ EventDefinition ed = null;
+ try (CTFTraceReader tr = new CTFTraceReader(trace);) {
+ tr.advance();
+ ed = tr.getCurrentEventDef();
+ }
+
+ assertNotNull(ed);
+ assertNotNull(ed.getScopePath());
+ assertNotNull(ed.getDeclaration());
+ assertNotNull(ed.getFields());
+ assertNull(ed.getContext());
+ assertNotNull(ed.getPacketContext());
+ assertNotNull(ed.getCPU());
+ assertNotNull(ed.getStreamInputReader());
+ assertNull(ed.lookupDefinition("context"));
+ assertNotNull(ed.lookupDefinition("fields"));
+ assertNull(ed.lookupDefinition("other"));
+ assertNotNull(ed.toString());
+ }
}
EventDeclaration e1;