/*******************************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
+import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.junit.BeforeClass;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.junit.After;
/**
* State system tests using the in-memory back-end.
*/
public class StateSystemInMemoryTest extends StateSystemTest {
- /**
- * Initialization
- */
- @BeforeClass
- public static void initialize() {
- assumeTrue(testTrace.exists());
+ private TestLttngKernelAnalysisModule module;
- TestLttngKernelAnalysisModule module = new TestLttngKernelAnalysisModule();
+ @Override
+ protected ITmfStateSystem initialize() {
+ module = new TestLttngKernelAnalysisModule();
try {
module.setTrace(testTrace.getTrace());
} catch (TmfAnalysisException e) {
}
module.schedule();
assertTrue(module.waitForCompletion());
- ssq = module.getStateSystem();
- assertNotNull(ssq);
+ return module.getStateSystem();
+ }
+
+ /**
+ * Class cleanup
+ */
+ @After
+ public void cleanup() {
+ if (module != null) {
+ module.close();
+ }
}
private static class TestLttngKernelAnalysisModule extends TmfStateSystemAnalysisModule {
@Override
protected ITmfStateProvider createStateProvider() {
- return new LttngKernelStateProvider((CtfTmfTrace) getTrace());
+ return new LttngKernelStateProvider(getTrace());
}
@Override