/*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationData;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.junit.After;
import org.junit.Before;
*/
public class CtfTmfTraceTest {
- private static final String PATH = TestParams.getPath();
+ private static final int TRACE_INDEX = 0;
+ private static final String PATH = CtfTmfTestTraces.getTestTracePath(TRACE_INDEX);
private CtfTmfTrace fixture;
- /**
- * Launch the test.
- *
- * @param args
- * the command line arguments
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(CtfTmfTraceTest.class);
- }
-
/**
* Perform pre-test initialization.
*
*/
@Before
public void setUp() throws TmfTraceException {
+ assumeTrue(CtfTmfTestTraces.tracesExist());
fixture = new CtfTmfTrace();
fixture.initTrace((IResource) null, PATH, CtfTmfEvent.class);
}
*/
@After
public void tearDown() {
- fixture.dispose();
+ if (fixture != null) {
+ fixture.dispose();
+ }
}
/**
assertEquals(1000, result.getCacheSize());
assertEquals(0L, result.getNbEvents());
assertEquals(0L, result.getStreamingInterval());
- assertNull(result.getStateSystem());
assertNull(result.getResource());
assertEquals(1000, result.getQueueSize());
assertNull(result.getType());
*/
@Test
public void testGetEnvValue() {
- String key = "tracer_name"; //$NON-NLS-1$
+ String key = "tracer_name";
String result = fixture.getEnvValue(key);
- assertEquals("\"lttng-modules\"",result); //$NON-NLS-1$
+ assertEquals("\"lttng-modules\"",result);
}
/**
*/
@Test
public void testGetLocationRatio() {
- final CtfLocationData location2 = new CtfLocationData(1, 0);
+ final CtfLocationInfo location2 = new CtfLocationInfo(1, 0);
CtfLocation location = new CtfLocation(location2);
double result = fixture.getLocationRatio(location);
assertNotNull(result);
}
- /**
- * Run the IStateSystemQuerier getStateSystem() method test.
- */
- @Test
- public void testGetStateSystem() {
- ITmfStateSystem result = fixture.getStateSystem();
- assertNull(result);
- }
-
/**
* Run the long getStreamingInterval() method test.
*/
*/
@Test
public void testSeekEvent_location() {
- final CtfLocationData location2 = new CtfLocationData(1L, 0L);
+ final CtfLocationInfo location2 = new CtfLocationInfo(1L, 0L);
CtfLocation ctfLocation = new CtfLocation(location2);
ITmfContext result = fixture.seekEvent(ctfLocation);
assertNotNull(result);
/**
* Run the boolean validate(IProject,String) method test.
+ * @throws TmfValidationException
*/
@Test
public void testValidate() {
IProject project = null;
String path = PATH;
- boolean result = fixture.validate(project, path);
- assertTrue(result);
+ IStatus result = fixture.validate(project, path);
+ assertTrue(result.isOK());
}
}