Search in sources :

Example 1 with FrameworkDebugTraceEntry

use of org.eclipse.osgi.internal.debug.FrameworkDebugTraceEntry in project rt.equinox.framework by eclipse.

the class DebugOptionsTestCase method testTracingEntry01.

/**
 * Test that a new {@link FrameworkDebugTraceEntry} object created without a trace class
 * has 'org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase' as the class name and
 * 'testTracingEntry01' as the method name that it determined as the caller of it.
 *
 * This test mimics the tracing framework to ensure that the correct class name and method name
 * are returned and written to the trace file.
 */
public void testTracingEntry01() {
    String bundleName = OSGiTestsActivator.getContext().getBundle().getSymbolicName();
    // $NON-NLS-1$
    String optionPath = "/debug";
    // $NON-NLS-1$
    String message = "Test message";
    FrameworkDebugTraceEntry traceEntry = new FrameworkDebugTraceEntry(bundleName, optionPath, message, null);
    // $NON-NLS-1$
    String correctClassName = "org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase";
    // $NON-NLS-1$
    String correctMethodName = "testTracingEntry01";
    // $NON-NLS-1$
    assertEquals("The class calling the trace API does not match the expected value.", correctClassName, traceEntry.getClassName());
    // $NON-NLS-1$
    assertEquals("The method calling the trace API does not match the expected value.", correctMethodName, traceEntry.getMethodName());
}
Also used : FrameworkDebugTraceEntry(org.eclipse.osgi.internal.debug.FrameworkDebugTraceEntry)

Example 2 with FrameworkDebugTraceEntry

use of org.eclipse.osgi.internal.debug.FrameworkDebugTraceEntry in project rt.equinox.framework by eclipse.

the class DebugOptionsTestCase method testTracingEntry02.

/**
 * Test that a new {@link FrameworkDebugTraceEntry} object created with a trace class
 * of 'org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase' has the correct class name and
 * method name of the caller.
 *
 * This test mimics the tracing framework to ensure that the correct class name and method name
 * are returned and written to the trace file.
 */
public void testTracingEntry02() {
    String correctClassName = Runner1.class.getName();
    // $NON-NLS-1$
    String correctMethodName = "run";
    FrameworkDebugTraceEntry traceEntry = new Runner1().run();
    // $NON-NLS-1$
    assertEquals("The class calling the trace API does not match the expected value.", correctClassName, traceEntry.getClassName());
    // $NON-NLS-1$
    assertEquals("The method calling the trace API does not match the expected value.", correctMethodName, traceEntry.getMethodName());
}
Also used : FrameworkDebugTraceEntry(org.eclipse.osgi.internal.debug.FrameworkDebugTraceEntry)

Aggregations

FrameworkDebugTraceEntry (org.eclipse.osgi.internal.debug.FrameworkDebugTraceEntry)2