1 /*******************************************************************************
2 * Copyright (c) 2012, 2015 Ericsson
3 * Copyright (c) 2010, 2011 École Polytechnique de Montréal
4 * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
6 * All rights reserved. This program and the accompanying materials are
7 * made available under the terms of the Eclipse Public License v1.0 which
8 * accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.tests
.kernelanalysis
;
15 import static org
.junit
.Assert
.assertEquals
;
16 import static org
.junit
.Assert
.fail
;
18 import org
.eclipse
.core
.runtime
.IPath
;
19 import org
.eclipse
.core
.runtime
.IStatus
;
20 import org
.eclipse
.jdt
.annotation
.NonNull
;
21 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.tests
.Activator
;
22 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.tests
.stubs
.trace
.TmfXmlKernelTraceStub
;
23 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelTrace
;
24 import org
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.core
.kernel
.KernelStateProvider
;
25 import org
.eclipse
.tracecompass
.tmf
.core
.event
.TmfEvent
;
26 import org
.eclipse
.tracecompass
.tmf
.core
.exceptions
.TmfTraceException
;
27 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.ITmfStateProvider
;
28 import org
.junit
.After
;
29 import org
.junit
.Before
;
30 import org
.junit
.Test
;
33 * Tests for the {@link KernelStateProvider}
35 * @author Alexandre Montplaisir
37 public class KernelStateProviderTest
{
39 private static final @NonNull String LTTNG_KERNEL_FILE
= "testfiles/lttng_kernel_analysis.xml";
41 private IKernelTrace fTrace
;
42 private ITmfStateProvider fInput
;
48 public void initialize() {
49 IKernelTrace thetrace
= new TmfXmlKernelTraceStub();
50 IPath filePath
= Activator
.getAbsoluteFilePath(LTTNG_KERNEL_FILE
);
51 IStatus status
= thetrace
.validate(null, filePath
.toOSString());
53 fail(status
.getException().getMessage());
56 thetrace
.initTrace(null, filePath
.toOSString(), TmfEvent
.class);
57 } catch (TmfTraceException e
) {
62 fInput
= new KernelStateProvider(thetrace
, thetrace
.getKernelEventLayout());
69 public void classTeardown() {
76 * Test loading the state provider.
79 public void testOpening() {
81 testStartTime
= fInput
.getStartTime();
82 /* Expected start time of the trace */
83 assertEquals(testStartTime
, 1L);
This page took 0.033204 seconds and 5 git commands to generate.