Require-Bundle: org.junit,
org.eclipse.linuxtools.lttng;bundle-version="0.2.0",
org.eclipse.linuxtools.tmf;bundle-version="0.2.0",
- org.eclipse.core.runtime;bundle-version="3.5.0"
+ org.eclipse.core.runtime;bundle-version="3.5.0",
+ org.eclipse.linuxtools.lttng.jni;bundle-version="0.2.0"
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.linuxtools.lttng.tests.LTTngCoreTestPlugin
Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.linuxtools.lttng.jni
import java.util.Set;
import org.eclipse.linuxtools.lttng.jni.JniEvent;
-import org.eclipse.linuxtools.lttng.jni.JniException;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
import org.eclipse.linuxtools.lttng.jni.JniTrace;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
+
/**
* @author alvaro
JniEvent tmpEvent = null;
// This trace should be valid
try {
- tmpEvent = new JniTrace(tracepath, printLttDebug).requestEventByName(eventName);
+ tmpEvent = JniTraceFactory.getJniTrace(tracepath, printLttDebug).requestEventByName(eventName);
} catch (JniException e) {
}
JniTrace trace = null;
JniEvent event = null;
try {
- trace = new JniTrace(tracepath, printLttDebug);
+ trace = JniTraceFactory.getJniTrace(tracepath, printLttDebug);
} catch (JniException e) {
e.printStackTrace();
}
package org.eclipse.linuxtools.lttng.tests.jni;
+
import org.eclipse.linuxtools.lttng.jni.JniEvent;
-import org.eclipse.linuxtools.lttng.jni.JniException;
-import org.eclipse.linuxtools.lttng.jni.JniTime;
-import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.common.JniTime;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
import junit.framework.TestCase;
// This trace should be valid
try {
- tmpEvent = new JniTrace(tracepath, printLttDebug).requestEventByName(eventName);
+ tmpEvent = JniTraceFactory.getJniTrace(tracepath, printLttDebug).requestEventByName(eventName);
}
catch( JniException e) { }
public void testEventConstructors() {
JniTracefile testTracefile = null;
- JniEvent testEvent1 = null;
- JniEvent testEvent2 = null;
+ @SuppressWarnings("unused")
+ JniEvent testEvent1 = null;
+ @SuppressWarnings("unused")
+ JniEvent testEvent2 = null;
// This trace should be valid and will be used in test
try {
- testTracefile = new JniTrace(tracepath, printLttDebug).requestTracefileByName(eventName);
+ testTracefile = JniTraceFactory.getJniTrace(tracepath, printLttDebug).requestTracefileByName(eventName);
}
catch( JniException e) { }
// Test the constructor with parameters using wrong arguments
// Test constructor on a wrong event pointer
try {
- testEvent1 = new JniEvent( new Jni_C_Pointer(0), testTracefile.getTracefileMarkersMap(), testTracefile );
+ testEvent1 = testTracefile.allocateNewJniEvent( new Jni_C_Pointer(0), testTracefile.getTracefileMarkersMap(), testTracefile );
fail("Construction with wrong event pointer should fail!");
}
catch( JniException e) {
// Test constructor on a wrong marker HashMap
try {
- testEvent1 = new JniEvent( testTracefile.getCurrentEvent().getEventPtr(), null, testTracefile );
+ testEvent1 = testTracefile.allocateNewJniEvent( testTracefile.getCurrentEvent().getEventPtr(), null, testTracefile );
fail("Construction with wrong marker hashmap should fail!");
}
catch( JniException e) {
// Test constructor on a wrong tracefile reference
try {
- testEvent1 = new JniEvent( testTracefile.getCurrentEvent().getEventPtr(), testTracefile.getTracefileMarkersMap(), null );
+ testEvent1 = testTracefile.allocateNewJniEvent( testTracefile.getCurrentEvent().getEventPtr(), testTracefile.getTracefileMarkersMap(), null );
fail("Construction with wrong tracefile reference should fail!");
}
catch( JniException e) {
// Finally, test constructor with correct information
try {
- testEvent1 = new JniEvent( testTracefile.getCurrentEvent().getEventPtr(), testTracefile.getTracefileMarkersMap(), testTracefile );
-
+ testEvent1 = testTracefile.allocateNewJniEvent( testTracefile.getCurrentEvent().getEventPtr(), testTracefile.getTracefileMarkersMap(), testTracefile );
}
catch( JniException e) {
fail("Construction with correct information failed!");
}
-
+ /*
// Test copy constructor
try {
testEvent1 = new JniEvent( testTracefile.getCurrentEvent() );
catch( Exception e) {
fail("Copy constructor failed!");
}
-
assertEquals("JniEvent timestamp not same after using copy constructor", testEvent1.getEventTime().getTime() , testEvent2.getEventTime().getTime() );
+ */
}
package org.eclipse.linuxtools.lttng.tests.jni;
+
+import junit.framework.TestCase;
+
import org.eclipse.linuxtools.lttng.jni.JniEvent;
-import org.eclipse.linuxtools.lttng.jni.JniException;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
-import org.eclipse.linuxtools.lttng.jni.JniTrace;
-import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
-
-import junit.framework.TestCase;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
/*
Functions tested here :
// This trace should be valid
// We will read the first 2 event to have something interesting to test on
try {
- tmpEvent = new JniTrace(tracepath, printLttDebug).requestEventByName(eventName);
+ tmpEvent = JniTraceFactory.getJniTrace(tracepath, printLttDebug).requestEventByName(eventName);
tmpEvent.readNextEvent();
tmpEvent.readNextEvent();
JniMarker tmpMarker = null;
- JniMarkerField tmpMarkerField1 = null;
- JniMarkerField tmpMarkerField2 = null;
+ @SuppressWarnings("unused")
+ JniMarkerField tmpMarkerField1 = null;
+ @SuppressWarnings("unused")
+ JniMarkerField tmpMarkerField2 = null;
// This event should be valid and will be used in test
try {
- tmpMarker = new JniTrace(tracepath, printLttDebug).requestEventByName(eventName).requestEventMarker();
+ tmpMarker = JniTraceFactory.getJniTrace(tracepath, printLttDebug).requestEventByName(eventName).requestEventMarker();
}
catch( JniException e) { }
// Test constructor with pointer on a wrong pointer
try {
- tmpMarkerField1 = new JniMarkerField( new Jni_C_Pointer(0) );
+ tmpMarkerField1 = tmpMarker.allocateNewJniMarkerField( new Jni_C_Pointer(0) );
fail("Construction with wrong pointer should fail!");
}
catch( JniException e) {
// Test constructor with pointer on a correct pointer
try {
- tmpMarkerField1 = new JniMarkerField( tmpMarker.getMarkerFieldsArrayList().get(0).getMarkerFieldPtr() );
+ tmpMarkerField1 = tmpMarker.allocateNewJniMarkerField( tmpMarker.getMarkerFieldsArrayList().get(0).getMarkerFieldPtr() );
}
catch( JniException e) {
fail("Construction with correct pointer failed!");
}
-
+ /*
// Test copy constructor
try {
tmpMarkerField1 = new JniMarkerField( tmpMarker.getMarkerFieldsArrayList().get(0) );
catch( Exception e) {
fail("Copy constructor failed!");
}
-
assertSame("JniMarker name not same after using copy constructor", tmpMarkerField1.getField() , tmpMarkerField2.getField());
+ */
}
package org.eclipse.linuxtools.lttng.tests.jni;
+
import org.eclipse.linuxtools.lttng.jni.JniEvent;
-import org.eclipse.linuxtools.lttng.jni.JniException;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
-import org.eclipse.linuxtools.lttng.jni.JniTrace;
-import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
import junit.framework.TestCase;
// This trace should be valid
// We will read the second event to have something interesting to test on
try {
- tmpEvent = new JniTrace(tracepath, printLttDebug).requestEventByName(eventName);
+ tmpEvent = JniTraceFactory.getJniTrace(tracepath, printLttDebug).requestEventByName(eventName);
tmpEvent.readNextEvent();
tmpMarker = tmpEvent.requestEventMarker();
JniEvent tmpEvent = null;
- JniMarker testMarker1 = null;
- JniMarker testMarker2 = null;
+ @SuppressWarnings("unused")
+ JniMarker testMarker1 = null;
+ @SuppressWarnings("unused")
+ JniMarker testMarker2 = null;
// This event should be valid and will be used in test
try {
- tmpEvent = new JniTrace(tracepath, printLttDebug).requestEventByName(eventName);
+ tmpEvent = JniTraceFactory.getJniTrace(tracepath, printLttDebug).requestEventByName(eventName);
}
catch( JniException e) { }
// Test constructor with pointer on a wrong pointer
try {
- testMarker1 = new JniMarker( new Jni_C_Pointer(0) );
+ testMarker1 = tmpEvent.getParentTracefile().allocateNewJniMarker( new Jni_C_Pointer(0) );
fail("Construction with wrong pointer should fail!");
}
catch( JniException e) {
// Test constructor with pointer on a correct pointer
try {
- testMarker1 = new JniMarker( tmpEvent.requestEventMarker().getMarkerPtr() );
+ testMarker1 = tmpEvent.getParentTracefile().allocateNewJniMarker( tmpEvent.requestEventMarker().getMarkerPtr() );
}
catch( JniException e) {
fail("Construction with correct pointer failed!");
}
-
+ /*
// Test copy constructor
try {
testMarker1 = new JniMarker( tmpEvent.requestEventMarker().getMarkerPtr() );
catch( JniException e) {
fail("Copy constructor failed!");
}
-
assertSame("JniMarker name not same after using copy constructor", testMarker1.getName() , testMarker2.getName());
+ */
}
package org.eclipse.linuxtools.lttng.tests.jni;
import org.eclipse.linuxtools.lttng.jni.JniEvent;
-import org.eclipse.linuxtools.lttng.jni.JniException;
-import org.eclipse.linuxtools.lttng.jni.JniTime;
import org.eclipse.linuxtools.lttng.jni.JniTrace;
-import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.common.JniTime;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
import junit.framework.TestCase;
// This trace should be valid
try {
- tmpTrace = new JniTrace(tracepath1, printLttDebug);
+ tmpTrace = JniTraceFactory.getJniTrace(tracepath1, printLttDebug);
//tmpTrace.seekToTime(new JniTime(0L));
}
catch( JniException e) { }
}
public void testTraceConstructors() {
- JniTrace testTrace1 = null;
+ @SuppressWarnings("unused")
+ JniTrace testTrace1 = null;
@SuppressWarnings("unused")
JniTrace testTrace2 = null;
// Test constructor with argument on a wrong tracepath
try {
- testTrace1 = new JniTrace(wrongTracePath, printLttDebug);
+ testTrace1 = JniTraceFactory.getJniTrace(wrongTracePath, printLttDebug);
fail("Construction with wrong tracepath should fail!");
}
catch( JniException e) {
// Test constructor with argument on a correct tracepath
try {
- testTrace1 = new JniTrace(tracepath1, printLttDebug);
+ testTrace1 = JniTraceFactory.getJniTrace(tracepath1, printLttDebug);
}
catch( JniException e) {
fail("Construction with correct tracepath failed!");
}
+ /*
// Test copy constructor that take a pointer with a good pointer
try {
testTrace1 = new JniTrace( new Jni_C_Pointer(0), printLttDebug);
catch( JniException e) {
fail("Construction with correct pointer failed!");
}
-
+ */
}
public void testTraceOpenClose() {
package org.eclipse.linuxtools.lttng.tests.jni;
-import org.eclipse.linuxtools.lttng.jni.JniException;
-import org.eclipse.linuxtools.lttng.jni.JniTime;
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.common.JniTime;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
import junit.framework.TestCase;
// This trace should be valid
try {
- tmpTracefile = new JniTrace(tracepath1, printLttDebug).requestTracefileByName(tracefileName1);
+ tmpTracefile = JniTraceFactory.getJniTrace(tracepath1, printLttDebug).requestTracefileByName(tracefileName1);
}
catch( JniException e) { }
public void testTracefileConstructors() {
JniTrace testTrace = null;
- JniTracefile testTracefile1 = null;
- JniTracefile testTracefile2 = null;
+ @SuppressWarnings("unused")
+ JniTracefile testTracefile1 = null;
+ @SuppressWarnings("unused")
+ JniTracefile testTracefile2 = null;
// This trace should be valid and will be used in test
try {
- testTrace = new JniTrace(tracepath1, printLttDebug);
+ testTrace = JniTraceFactory.getJniTrace(tracepath1, printLttDebug);
}
catch( JniException e) { }
// Test constructor with pointer on a wrong pointer
try {
- testTracefile1 = new JniTracefile( new Jni_C_Pointer(0), testTrace );
+ testTracefile1 = testTrace.allocateNewJniTracefile( new Jni_C_Pointer(0), testTrace );
fail("Construction with wrong pointer should fail!");
}
catch( JniException e) {
// Test constructor with pointer on a correct pointer
try {
- testTracefile1 = new JniTracefile( testTrace.requestEventByName(tracefileName1).getTracefilePtr(), testTrace );
+ testTracefile1 = testTrace.allocateNewJniTracefile( testTrace.requestEventByName(tracefileName1).getTracefilePtr(), testTrace );
}
catch( JniException e) {
fail("Construction with correct pointer failed!");
}
-
+ /*
// Test copy constructor
try {
testTracefile1 = new JniTracefile( testTrace.requestEventByName(tracefileName1).getTracefilePtr(), testTrace );
catch( JniException e) {
fail("Copy constructor failed!");
}
-
assertSame("JniTracefile name not same after using copy constructor", testTracefile1.getTracefileName() , testTracefile2.getTracefileName());
+ */
}