Kaynağa Gözat

Refactoring of testmodel util.

markus.muehlbrandt@gmail.com 12 yıl önce
ebeveyn
işleme
7193b5461b

+ 7 - 8
test-plugins/org.yakindu.sct.model.sgraph.test/src/org/yakindu/sct/model/sgraph/test/SGraphJavaValidationTest.java

@@ -55,10 +55,10 @@ import org.yakindu.sct.model.sgraph.Statechart;
 import org.yakindu.sct.model.sgraph.Synchronization;
 import org.yakindu.sct.model.sgraph.Transition;
 import org.yakindu.sct.model.sgraph.Vertex;
-import org.yakindu.sct.model.sgraph.test.util.SGraphTestModelUtil;
 import org.yakindu.sct.model.sgraph.validation.SGraphJavaValidator;
 import org.yakindu.sct.model.stext.stext.StextFactory;
 import org.yakindu.sct.model.stext.validation.STextJavaValidator;
+import org.yakindu.sct.test.models.AbstractTestModelsUtil;
 
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
@@ -370,7 +370,7 @@ public class SGraphJavaValidationTest {
 
 	@Test
 	public void synchronizationTransitionCount() {
-		statechart = SGraphTestModelUtil
+		statechart = AbstractTestModelsUtil
 				.loadStatechart("InvalidSynchronizationUsage.sct");
 		Iterator<EObject> iter = statechart.eAllContents();
 		while (iter.hasNext()) {
@@ -382,13 +382,12 @@ public class SGraphJavaValidationTest {
 		}
 
 		assertIssueCount(diagnostics, 2);
-		assertWarning(diagnostics,
-				ISSUE_SYNCHRONIZATION_TRANSITION_COUNT);
+		assertWarning(diagnostics, ISSUE_SYNCHRONIZATION_TRANSITION_COUNT);
 	}
 
 	@Test
 	public void orthogonalStates() {
-		statechart = SGraphTestModelUtil
+		statechart = AbstractTestModelsUtil
 				.loadStatechart("NotOrthogonalRegion01.sct");
 		Iterator<EObject> iter = statechart.eAllContents();
 		while (iter.hasNext()) {
@@ -406,7 +405,7 @@ public class SGraphJavaValidationTest {
 				ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_ORTHOGONAL);
 
 		diagnostics = new BasicDiagnostic();
-		statechart = SGraphTestModelUtil
+		statechart = AbstractTestModelsUtil
 				.loadStatechart("NotOrthogonalRegion02.sct");
 		iter = statechart.eAllContents();
 		while (iter.hasNext()) {
@@ -424,7 +423,7 @@ public class SGraphJavaValidationTest {
 				ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_WITHIN_SAME_PARENTSTATE);
 
 		diagnostics = new BasicDiagnostic();
-		statechart = SGraphTestModelUtil
+		statechart = AbstractTestModelsUtil
 				.loadStatechart("NotOrthogonalRegion03.sct");
 		iter = statechart.eAllContents();
 		while (iter.hasNext()) {
@@ -444,7 +443,7 @@ public class SGraphJavaValidationTest {
 
 	@Test
 	public void orthogonalStatesValid() {
-		statechart = SGraphTestModelUtil
+		statechart = AbstractTestModelsUtil
 				.loadStatechart("OrthogonalRegion01.sct");
 		Iterator<EObject> iter = statechart.eAllContents();
 		while (iter.hasNext()) {

+ 0 - 17
test-plugins/org.yakindu.sct.model.sgraph.test/src/org/yakindu/sct/model/sgraph/test/util/SGraphTestModelUtil.java

@@ -1,17 +0,0 @@
-package org.yakindu.sct.model.sgraph.test.util;
-
-import org.eclipse.emf.common.util.URI;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.test.models.AbstractTestModelsUtil;
-
-public final class SGraphTestModelUtil {
-
-	private static final String TESTMODEL_DIR = "org.yakindu.sct.test.models/testmodels/validation/";
-
-	private SGraphTestModelUtil() {
-	}
-
-	public static final Statechart loadStatechart(String filename) {
-		return AbstractTestModelsUtil.loadStatechart(URI.createPlatformPluginURI(TESTMODEL_DIR + filename, true));
-	}
-}

+ 17 - 2
test-plugins/org.yakindu.sct.test.models/src/org/yakindu/sct/test/models/AbstractTestModelsUtil.java

@@ -32,6 +32,8 @@ import com.google.inject.Inject;
  */
 public abstract class AbstractTestModelsUtil {
 
+	private static final String VALIDATION_TESTMODEL_DIR = "org.yakindu.sct.test.models/testmodels/validation/";
+
 	@Inject
 	private IModelSequencer sequencer;
 
@@ -61,8 +63,8 @@ public abstract class AbstractTestModelsUtil {
 	/**
 	 * Helper method - loads a testmodel from the given {@link URI}
 	 * 
-	 * @param uri 
-	 * 			the {@link URI} of the model file
+	 * @param uri
+	 *            the {@link URI} of the model file
 	 * @return the {@link Statechart}
 	 */
 	public static final Statechart loadStatechart(URI uri) {
@@ -73,4 +75,17 @@ public abstract class AbstractTestModelsUtil {
 				resource.getContents(), SGraphPackage.Literals.STATECHART);
 		return statechart;
 	}
+	
+	/**
+	 * Helper method - loads a testmodel from the given filename.
+	 * 
+	 * @param filename
+	 *            the filename of the model file
+	 * @return the {@link Statechart}
+	 */
+	public static final Statechart loadStatechart(String filename) {
+		return AbstractTestModelsUtil.loadStatechart(URI
+				.createPlatformPluginURI(VALIDATION_TESTMODEL_DIR + filename,
+						true));
+	}
 }