View Javadoc
1   /*******************************************************************************
2    * Copyright (c) 2017 CEA LIST
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *     Ansgar Radermacher (CEA LIST) - initial API and implementation
10   *
11   *******************************************************************************/
12  
13  package org.eclipse.papyrus.designer.transformation.languages.cpp.tests;
14  
15  import org.eclipse.core.resources.IProject;
16  import org.eclipse.papyrus.designer.languages.common.testutils.TestConstants;
17  import org.eclipse.papyrus.designer.languages.common.testutils.TransformationTestSupport;
18  import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
19  import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture;
20  import org.eclipse.papyrus.junit.utils.rules.PluginResource;
21  import org.junit.ClassRule;
22  import org.junit.Rule;
23  import org.junit.Test;
24  
25  @PluginResource("org.eclipse.papyrus.designer.transformation.languages.cpp.library:/models/examples/HelloWorldCpp/HelloWorldCpp.di")
26  public class TestHelloWorldCppExample {
27  
28  	@SuppressWarnings("nls")
29  	public static final String HELLO_WORLD_CPP_DEFAULT_NODE = "HelloWorldCpp_defaultNode_SystemDepPlan";
30  
31  	@SuppressWarnings("nls")
32  	public static final String DEPLOYMENT_MONO_PULL = "HelloWorldCpp::deployment::SystemDepPlan";
33  
34  	@Rule
35  	/** The model set fixture. */
36  	public final PapyrusEditorFixture modelSetFixture = new PapyrusEditorFixture();
37  
38  	@ClassRule
39  	public static HouseKeeper.Static houseKeeper = new HouseKeeper.Static();
40  
41  	@Test
42  	public void testProducerConsumerMonoPull() throws InterruptedException {
43  
44  		TransformationTestSupport tts = new TransformationTestSupport(this.getClass(), houseKeeper, modelSetFixture);
45  
46  		// create generated project. For generation purposes, it is not important that this is not a CDT project
47  		IProject genProject = houseKeeper.createProject(HELLO_WORLD_CPP_DEFAULT_NODE);
48  
49  		
50  		tts.runTransformation(DEPLOYMENT_MONO_PULL);
51  		
52  		tts.validateResults(genProject, TestConstants.EXPECTED_RESULT + TestConstants.FILE_SEP +
53  				HELLO_WORLD_CPP_DEFAULT_NODE + TestConstants.FILE_SEP + TestConstants.SRC_GEN, TestConstants.SRC_GEN);
54  	}
55  
56  }