xml: bug 497272 Populate views from built-in XML files
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.ui.tests / src / org / eclipse / tracecompass / tmf / analysis / xml / ui / tests / module / XmlAnalysisOutputSourceTest.java
1 /*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10 package org.eclipse.tracecompass.tmf.analysis.xml.ui.tests.module;
11
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertNotNull;
14 import static org.junit.Assert.assertTrue;
15
16 import java.util.Iterator;
17
18 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module.TmfXmlAnalysisOutputSource;
19 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
20 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisOutput;
21 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
22 import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
23 import org.eclipse.tracecompass.tmf.tests.stubs.trace.xml.TmfXmlTraceStub;
24 import org.junit.Test;
25
26 /**
27 * Test that XML-defined outputs are added to the analysis modules they are for
28 *
29 * @author Geneviève Bastien
30 */
31 public class XmlAnalysisOutputSourceTest {
32
33 private static final String BUILTIN_MODULE = "test.builtin.sp";
34 private static final String BUILTIN_OUTPUT= "Test output of XML builtin module";
35
36 /**
37 * Test the
38 * {@link TmfXmlAnalysisOutputSource#moduleCreated(IAnalysisModule)} method
39 */
40 @Test
41 public void testBuiltinOutput() {
42
43 TmfTrace trace = new TmfXmlTraceStub();
44 try {
45 trace.traceOpened(new TmfTraceOpenedSignal(this, trace, null));
46
47 IAnalysisModule module = trace.getAnalysisModule(BUILTIN_MODULE);
48 assertNotNull(module);
49
50 Iterator<IAnalysisOutput> iterator = module.getOutputs().iterator();
51 assertTrue(iterator.hasNext());
52 IAnalysisOutput output = iterator.next();
53 assertEquals(BUILTIN_OUTPUT, output.getName());
54
55 } finally {
56 trace.dispose();
57 }
58
59 }
60
61 }
This page took 0.032202 seconds and 5 git commands to generate.