Search in sources :

Example 16 with GeneratorModel

use of org.yakindu.sct.model.sgen.GeneratorModel in project statecharts by Yakindu.

the class SGenJavaValidatorTest method checkInitialValue.

@Test
public void checkInitialValue() {
    EObject model = parseExpression("GeneratorModel for yakindu::java { var x : boolean = 5 }", GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate("Incompatible types boolean and integer."));
}
Also used : AssertableDiagnostics(org.eclipse.xtext.junit4.validation.AssertableDiagnostics) EObject(org.eclipse.emf.ecore.EObject) GeneratorModel(org.yakindu.sct.model.sgen.GeneratorModel) AbstractSGenTest(org.yakindu.sct.generator.genmodel.test.util.AbstractSGenTest) Test(org.junit.Test)

Example 17 with GeneratorModel

use of org.yakindu.sct.model.sgen.GeneratorModel in project statecharts by Yakindu.

the class SGenJavaValidatorTest method checkGeneratorExists.

/**
 * @see SGenJavaValidator#checkGeneratorExists(GeneratorModel)
 */
@Test
public void checkGeneratorExists() {
    EObject model = parseExpression("GeneratorModel for yakindu::unknown {}", GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(UNKOWN_GENERATOR));
}
Also used : AssertableDiagnostics(org.eclipse.xtext.junit4.validation.AssertableDiagnostics) EObject(org.eclipse.emf.ecore.EObject) GeneratorModel(org.yakindu.sct.model.sgen.GeneratorModel) AbstractSGenTest(org.yakindu.sct.generator.genmodel.test.util.AbstractSGenTest) Test(org.junit.Test)

Example 18 with GeneratorModel

use of org.yakindu.sct.model.sgen.GeneratorModel in project statecharts by Yakindu.

the class SGenJavaValidatorTest method checkDuplicateGeneratorEntryFeature.

/**
 * @see SGenJavaValidator#checkDuplicateGeneratorEntryFeature(FeatureConfiguration)
 */
@Test
public void checkDuplicateGeneratorEntryFeature() {
    EObject model = parseExpression("GeneratorModel for yakindu::java { statechart Example { feature Outlet { } feature Outlet { }}}", GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(DUPLICATE_FEATURE));
}
Also used : AssertableDiagnostics(org.eclipse.xtext.junit4.validation.AssertableDiagnostics) EObject(org.eclipse.emf.ecore.EObject) GeneratorModel(org.yakindu.sct.model.sgen.GeneratorModel) AbstractSGenTest(org.yakindu.sct.generator.genmodel.test.util.AbstractSGenTest) Test(org.junit.Test)

Example 19 with GeneratorModel

use of org.yakindu.sct.model.sgen.GeneratorModel in project statecharts by Yakindu.

the class SGenJavaValidatorTest method checkDuplicateFeatureParameter.

/**
 * @see SGenJavaValidator#checkDuplicateFeatureParameter(org.yakindu.sct.model.sgen.FeatureParameterValue)
 */
@Test
public void checkDuplicateFeatureParameter() {
    EObject model = parseExpression("GeneratorModel for yakindu::java { statechart Example { feature Outlet { targetFolder = true  targetFolder = true }}}", GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(DUPLICATE_PARAMETER));
}
Also used : AssertableDiagnostics(org.eclipse.xtext.junit4.validation.AssertableDiagnostics) EObject(org.eclipse.emf.ecore.EObject) GeneratorModel(org.yakindu.sct.model.sgen.GeneratorModel) AbstractSGenTest(org.yakindu.sct.generator.genmodel.test.util.AbstractSGenTest) Test(org.junit.Test)

Example 20 with GeneratorModel

use of org.yakindu.sct.model.sgen.GeneratorModel in project statecharts by Yakindu.

the class SGenJavaValidatorTest method checkContentType.

/**
 * @see SGenJavaValidator#checkContentType(org.yakindu.sct.model.sgen.GeneratorEntry)
 */
@Test
public void checkContentType() {
    EObject model = parseExpression("GeneratorModel for yakindu::java { unkownType Example {}}", GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(UNKNOWN_CONTENT_TYPE));
}
Also used : AssertableDiagnostics(org.eclipse.xtext.junit4.validation.AssertableDiagnostics) EObject(org.eclipse.emf.ecore.EObject) GeneratorModel(org.yakindu.sct.model.sgen.GeneratorModel) AbstractSGenTest(org.yakindu.sct.generator.genmodel.test.util.AbstractSGenTest) Test(org.junit.Test)

Aggregations

GeneratorModel (org.yakindu.sct.model.sgen.GeneratorModel)28 EObject (org.eclipse.emf.ecore.EObject)13 AssertableDiagnostics (org.eclipse.xtext.junit4.validation.AssertableDiagnostics)11 Test (org.junit.Test)11 AbstractSGenTest (org.yakindu.sct.generator.genmodel.test.util.AbstractSGenTest)11 IGeneratorDescriptor (org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor)10 Resource (org.eclipse.emf.ecore.resource.Resource)6 ILibraryDescriptor (org.yakindu.sct.generator.core.extensions.ILibraryDescriptor)5 Check (org.eclipse.xtext.validation.Check)4 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)3 FeatureType (org.yakindu.sct.model.sgen.FeatureType)3 IResource (org.eclipse.core.resources.IResource)2 IPath (org.eclipse.core.runtime.IPath)2 IStatus (org.eclipse.core.runtime.IStatus)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)2 SimpleScope (org.eclipse.xtext.scoping.impl.SimpleScope)2 IDefaultFeatureValueProvider (org.yakindu.sct.generator.core.library.IDefaultFeatureValueProvider)2 FeatureTypeLibrary (org.yakindu.sct.model.sgen.FeatureTypeLibrary)2 PropertyDefinition (org.yakindu.sct.model.sgen.PropertyDefinition)2