Source:
public void testAspects() { TmfXmlTraceStub trace = new TmfXmlTraceStub(); IStatus status = trace.validate(null, getAbsolutePath(VALID_FILE).toOSString()); if (!status.isOK()) { fail(status.getException().getMessage()); } try { trace.initTrace(null, getAbsolutePath(VALID_FILE).toOSString(), TmfEvent.class); } catch (TmfTraceException e1) { fail(e1.getMessage()); } ITmfEventAspect cpuAspect = null; ITmfEventAspect testAspect = null; int aspectCount = 0; for (ITmfEventAspect aspect : trace.getEventAspects()) { aspectCount++; if (aspect instanceof TmfCpuAspect) { cpuAspect = aspect; } else if (aspect.getName().equals("test")) { testAspect = aspect; } } assertEquals("Number of aspects", 5, aspectCount); assertNotNull(cpuAspect); assertNotNull(testAspect); ITmfContext ctx; ctx = trace.seekEvent(0L); assertNotNull(ctx); ITmfEvent event = trace.getNext(ctx); assertNotNull(event); assertEquals("Cpu criterion of event 1", 1, cpuAspect.resolve(event)); assertEquals("Test criterion of event 1", "abc", testAspect.resolve(event)); event = trace.getNext(ctx); assertNotNull(event); assertEquals("Cpu criterion of event 2", 1, cpuAspect.resolve(event)); assertEquals("Test criterion of event 2", "abc", testAspect.resolve(event)); event = trace.getNext(ctx); assertNotNull(event); assertEquals("Cpu criterion of event 3", 2, cpuAspect.resolve(event)); assertEquals("Test criterion of event 3", "def", testAspect.resolve(event)); event = trace.getNext(ctx); assertNotNull(event); assertEquals("Cpu criterion of event 4", 1, cpuAspect.resolve(event)); assertEquals("Test criterion of event 4", "def", testAspect.resolve(event)); }

Target:
public void testAspects() { TmfXmlTraceStub trace = new TmfXmlTraceStub(); IStatus status = trace.validate(null, getAbsolutePath(VALID_FILE).toOSString()); if (!status.isOK()) { fail(status.getException().getMessage()); } try { trace.initTrace(null, getAbsolutePath(VALID_FILE).toOSString(), TmfEvent.class); } catch (TmfTraceException e1) { fail(e1.getMessage()); } ITmfEventAspect cpuAspect = null; ITmfEventAspect testAspect = null; int aspectCount = 0; for (ITmfEventAspect aspect : trace.getEventAspects()) { aspectCount++; if (aspect instanceof TmfCpuAspect) { cpuAspect = aspect; } else if (aspect.getName().equals("test")) { testAspect = aspect; } } assertEquals("Number of aspects", 5, aspectCount); assertNotNull(cpuAspect); assertNotNull(testAspect); ITmfContext ctx; ctx = trace.seekEvent(0L); assertNotNull(ctx); ITmfEvent event = trace.getNext(ctx); assertNotNull(event); assertEquals("Cpu aspect of event 1", 1, cpuAspect.resolve(event)); assertEquals("Test aspect of event 1", "abc", testAspect.resolve(event)); event = trace.getNext(ctx); assertNotNull(event); assertEquals("Cpu aspect of event 2", 1, cpuAspect.resolve(event)); assertEquals("Test aspect of event 2", "abc", testAspect.resolve(event)); event = trace.getNext(ctx); assertNotNull(event); assertEquals("Cpu aspect of event 3", 2, cpuAspect.resolve(event)); assertEquals("Test aspect of event 3", "def", testAspect.resolve(event)); event = trace.getNext(ctx); assertNotNull(event); assertEquals("Cpu aspect of event 4", 1, cpuAspect.resolve(event)); assertEquals("Test aspect of event 4", "def", testAspect.resolve(event)); }