blob: f4831f309bbae9d9ae29d58abc739d6004717287 [file] [log] [blame]
/**
* Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.osbp.dsl.entity.xtext.grammar.tests;
import com.google.inject.Inject;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.osbp.dsl.common.xtext.validation.CommonGrammarJavaValidator;
import org.eclipse.osbp.dsl.entity.xtext.grammar.tests.InjectorProvider;
import org.eclipse.osbp.dsl.entity.xtext.grammar.tests.ParseHelper;
import org.eclipse.osbp.dsl.entity.xtext.validation.EntityGrammarJavaValidator;
import org.eclipse.osbp.dsl.semantic.entity.LEntityModel;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.diagnostics.Severity;
import org.eclipse.xtext.junit4.InjectWith;
import org.eclipse.xtext.junit4.XtextRunner;
import org.eclipse.xtext.junit4.validation.ValidationTestHelper;
import org.eclipse.xtext.validation.Issue;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(XtextRunner.class)
@InjectWith(InjectorProvider.class)
@SuppressWarnings("all")
public class GrammarTests {
@Inject
@Extension
private ValidationTestHelper _validationTestHelper;
@Inject
@Extension
private ParseHelper<LEntityModel> _parseHelper;
private Map<String, Issue> result;
private Map<String, Issue> result2;
@Test
public void id_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test { \t\t\t\t\t\t\t\t\t\t// warn: no id");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id; ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long other; \t\t\t\t\t\t\t\t\t// error: duplicate id");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__MISSING_ID);
Assert.assertSame(_severity, Severity.WARNING);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__MISSING_ID);
Assert.assertEquals(_lineNumber, 5);
Severity _severity_1 = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_ID);
Assert.assertSame(_severity_1, Severity.ERROR);
int _lineNumber_1 = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_ID);
Assert.assertEquals(_lineNumber_1, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void id_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.append("\t");
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long someValue;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long other;\t\t\t\t\t\t\t\t// error: duplicate id");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_ID);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_ID);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void version_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("version long version;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("version long other;\t\t\t\t\t\t\t\t// error: duplicate version");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_VERSION);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_VERSION);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void version_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.append("\t");
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("version long version;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long someValue;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("version long other;\t\t\t\t\t\t\t// error: duplicate version");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_VERSION);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_VERSION);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void featureName_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;\t\t\t\t\t\t\t\t\t// error: duplicate property");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long other;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void featureName_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.append("\t");
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long someValue;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;\t\t\t\t\t\t\t\t// error: duplicate property (supertype)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void featureName_3() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long other;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test xxyy;\t\t\t\t\t\t\t\t\t// error: duplicate property var-ref");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertEquals(_lineNumber, 11);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void featureName_4() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long xxyy;\t\t\t\t\t\t\t\t\t// error: duplicate property id-ref");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void featureName_5() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long xxyy;\t\t\t\t\t\t\t\t\t// error: duplicate property id-var");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_PROPERTY_NAME);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void duplicatePackage_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long xxyy;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {\t\t\t// error: duplicate package");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long xxyy;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(CommonGrammarJavaValidator.CODE__DUPLICATE_LPACKAGE_IN_FILE);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(CommonGrammarJavaValidator.CODE__DUPLICATE_LPACKAGE_IN_FILE);
Assert.assertEquals(_lineNumber, 14);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void duplicateType_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {\t\t\t\t\t\t\t\t\t\t// error: duplicate type (entity)");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(CommonGrammarJavaValidator.CODE__DUPLICATE_LTYPE_IN_PROJECT);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(CommonGrammarJavaValidator.CODE__DUPLICATE_LTYPE_IN_PROJECT);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void duplicateType_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype number jvmType Long as primitive;");
_builder.newLine();
_builder.append("datatype number jvmType Float as primitive; \t\t\t// error: duplicate type (datatype)");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long xxyy;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(CommonGrammarJavaValidator.CODE__DUPLICATE_LDATATYPE_IN_PACKAGE);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(CommonGrammarJavaValidator.CODE__DUPLICATE_LDATATYPE_IN_PACKAGE);
Assert.assertEquals(_lineNumber, 4);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void duplicateType_3() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests1 {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test1 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long xxyy;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long abc;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests2 {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;\t\t\t\t// error: duplicate type (in other package)");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long cde;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long ghi;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void invalidPrimitive_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype xyz jvmType String as primitive;\t\t\t\t// error: no such primitive Java type");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id xyz id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(CommonGrammarJavaValidator.CODE__NOT_A_VALID_PRIMITIVE);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(CommonGrammarJavaValidator.CODE__NOT_A_VALID_PRIMITIVE);
Assert.assertEquals(_lineNumber, 3);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void invalidPrimitive_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype abc jvmType Long as primitive;\t\t\t\t\t// ok");
_builder.newLine();
_builder.append("datatype xyz jvmType String as primitive;\t\t\t\t// error: no such primitive Java type");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id xyz id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(CommonGrammarJavaValidator.CODE__NOT_A_VALID_PRIMITIVE);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(CommonGrammarJavaValidator.CODE__NOT_A_VALID_PRIMITIVE);
Assert.assertEquals(_lineNumber, 4);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void javaKeyword() {
try {
for (final String keyword : CommonGrammarJavaValidator.javakeywords) {
{
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long ");
_builder.append(keyword, "\t\t");
_builder.append("; \t\t\t\t\t\t// each keyword produces error");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Collection<Issue> _values = this.result.values();
Iterator<Issue> _iterator = _values.iterator();
Issue _next = _iterator.next();
Severity _severity = _next.getSeverity();
Assert.assertSame(_severity, Severity.ERROR);
}
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void bidirectionalAssociation_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test2[*] mytests;\t\t\t\t\t\t// error: no opposite reference given");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__MISSING_OPPOSITE_REFERENCE);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__MISSING_OPPOSITE_REFERENCE);
Assert.assertEquals(_lineNumber, 7);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void bidirectionalAssociation_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test2[*] mytests opposite nosuchthing;\t\t// error: type of opposite ref cannot be resolved");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("} ");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Collection<Issue> _values = this.result.values();
Iterator<Issue> _iterator = _values.iterator();
Issue _next = _iterator.next();
Severity _severity = _next.getSeverity();
Assert.assertSame(_severity, Severity.ERROR);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void bidirectionalAssociation_3() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test2[*]\t\t\t\t\t\t\t\t\t// error: no opposite reference given");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("bean Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("} ");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Collection<Issue> _values = this.result.values();
Iterator<Issue> _iterator = _values.iterator();
Issue _next = _iterator.next();
Severity _severity = _next.getSeverity();
Assert.assertSame(_severity, Severity.ERROR);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void bidirectionalAssociation_4() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test2[*] mytests opposite nosuchthing;\t\t// error: type of opposite ref cannot be resolved");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("bean Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("} ");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Collection<Issue> _values = this.result.values();
Iterator<Issue> _iterator = _values.iterator();
Issue _next = _iterator.next();
Severity _severity = _next.getSeverity();
Assert.assertSame(_severity, Severity.ERROR);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void manyToMany_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t\t\t\t\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test2[1..*] mytests opposite xyz;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t\t\t\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test[*] xyz opposite mytests;\t\t\t\t// error: many-to-many between entities");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(CommonGrammarJavaValidator.CODE__MANY_TO_MANY__NOT_SUPPORTED);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(CommonGrammarJavaValidator.CODE__MANY_TO_MANY__NOT_SUPPORTED);
Assert.assertEquals(_lineNumber, 16);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void manyToMany_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t\t\t\t\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("bean Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test2[1..*] mytests opposite xyz;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t\t\t\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("bean Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test[*] xyz opposite mytests;\t\t\t\t// error: many-to-many between beans");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(CommonGrammarJavaValidator.CODE__MANY_TO_MANY__NOT_SUPPORTED);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(CommonGrammarJavaValidator.CODE__MANY_TO_MANY__NOT_SUPPORTED);
Assert.assertEquals(_lineNumber, 16);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void cascade_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref cascade Test2[1..*] mytests opposite xyz;\t// error: cascade goes only one way (entities)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref cascade Test xyz;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__BIDIRECTIONAL_CASCADE_INVALID);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__BIDIRECTIONAL_CASCADE_INVALID);
Assert.assertEquals(_lineNumber, 9);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void cascade_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("bean Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref cascade Test2[1..*] mytests opposite xyz;\t// error: cascade goes only one way (beans)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("bean Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref cascade Test xyz;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__BIDIRECTIONAL_CASCADE_INVALID);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__BIDIRECTIONAL_CASCADE_INVALID);
Assert.assertEquals(_lineNumber, 9);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void cascade_3() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref cascade Test2[1] mytests opposite xyz;\t\t// error: cascade must not go from many to one common parent");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t\t\t\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test[*] xyz opposite mytests;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("} ");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__CASCADE_DIRECTION_INVALID);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__CASCADE_DIRECTION_INVALID);
Assert.assertEquals(_lineNumber, 9);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void cascade_4() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("bean Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref cascade Test2[1] mytests opposite xyz;\t\t// error: cascade must not go from many to one common parent");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t\t\t\t ");
_builder.newLine();
_builder.append("\t");
_builder.append("bean Test2 { ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("ref Test[*] xyz opposite mytests;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("} ");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__CASCADE_DIRECTION_INVALID);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__CASCADE_DIRECTION_INVALID);
Assert.assertEquals(_lineNumber, 9);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void inheritance_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per class {}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per subclass {} \t\t\t\t\t// warning: inheritance mismatch");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long y;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DIFFERING_INHERITANCE_FROM_SUPERTYPE);
Assert.assertSame(_severity, Severity.WARNING);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DIFFERING_INHERITANCE_FROM_SUPERTYPE);
Assert.assertEquals(_lineNumber, 13);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void inheritance_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per subclass {}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long x;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long mynumber;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per class {} \t\t\t\t\t// warning: inheritance mismatch");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var long y;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DIFFERING_INHERITANCE_FROM_SUPERTYPE);
Assert.assertSame(_severity, Severity.WARNING);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DIFFERING_INHERITANCE_FROM_SUPERTYPE);
Assert.assertEquals(_lineNumber, 13);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void inheritance_3() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per class {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorColumn disc;");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorType STRING;");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorValue MAINTYPE;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per class {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorColumn disc;\t\t\t\t\t// warning: ignored");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DIFFERING_INHERITANCE_FROM_SUPERTYPE);
Assert.assertSame(_severity, Severity.WARNING);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DIFFERING_INHERITANCE_FROM_SUPERTYPE);
Assert.assertEquals(_lineNumber, 16);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void inheritance_4() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per class {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorColumn disc;");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorType STRING;");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorValue MAINTYPE;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per class {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorType INT;\t\t\t\t\t\t// warning: ignored");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DIFFERING_INHERITANCE_FROM_SUPERTYPE);
Assert.assertSame(_severity, Severity.WARNING);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DIFFERING_INHERITANCE_FROM_SUPERTYPE);
Assert.assertEquals(_lineNumber, 16);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void inheritance_5() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per class {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorColumn disc;");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorType STRING;");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorValue MAINTYPE;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("inheritance per class {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("discriminatorValue MAINTYPE;\t\t\t\t// error: not unique");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__INHERITANCE_DISCRIMINATOR_VALUE_NOT_UNIQUE);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__INHERITANCE_DISCRIMINATOR_VALUE_NOT_UNIQUE);
Assert.assertEquals(_lineNumber, 15);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void persistence_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("tableName testtable;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("tableName testtable;\t\t\t\t\t\t\t// error: table name in use");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_PERSISTENCE);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_PERSISTENCE);
Assert.assertEquals(_lineNumber, 11);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void persistence_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("tableName testtable;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("tableName Testtable;\t\t\t\t\t\t\t// error: table name equal when using CAPITALS");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__DUPLICATE_PERSISTENCE);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__DUPLICATE_PERSISTENCE);
Assert.assertEquals(_lineNumber, 11);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void persistence_3() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.dsl.^entity.xtext.tests {");
_builder.newLine();
_builder.newLine();
_builder.append("datatype long jvmType Long as primitive;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("tableName testtable;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id long id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test2 extends Test {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("tableName testTable;\t\t\t\t\t\t\t// no error: CamelCase recognized -> TEST_TABLE");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void historized_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("\t");
_builder.append("package org.eclipse.osbp.dsl.entitydsl.histtimevalidation {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype String jvmType String;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t");
_builder.append("inheritance per class{}");
_builder.newLine();
_builder.append("\t");
_builder.append("uuid String id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("historized entity SubTest extends Test { \t\t\t\t// error: no historized entities in inheritance");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("} ");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__HISTORIZED_IN_SUBCLASS);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__HISTORIZED_IN_SUBCLASS);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void historized_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("\t");
_builder.append("package org.eclipse.osbp.dsl.entitydsl.histtimevalidation {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype String jvmType String;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t");
_builder.append("inheritance per subclass{}");
_builder.newLine();
_builder.append("\t");
_builder.append("uuid String id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("historized entity SubTest extends Test { \t\t\t\t// error: no historized entities in inheritance");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("} ");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__HISTORIZED_IN_SUBCLASS);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__HISTORIZED_IN_SUBCLASS);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void timedependent_1() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("\t");
_builder.append("package org.eclipse.osbp.dsl.entitydsl.histtimevalidation {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype String jvmType String;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t");
_builder.append("inheritance per class{}");
_builder.newLine();
_builder.append("\t");
_builder.append("uuid String id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("timedependent entity SubTest extends Test { \t\t\t\t// error: no historized entities in inheritance");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("} ");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__TIMEDEPENDENT_IN_SUBCLASS);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__TIMEDEPENDENT_IN_SUBCLASS);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void timedependent_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("\t");
_builder.append("package org.eclipse.osbp.dsl.entitydsl.histtimevalidation {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype String jvmType String;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("entity Test {");
_builder.newLine();
_builder.append("\t");
_builder.append("inheritance per subclass{}");
_builder.newLine();
_builder.append("\t");
_builder.append("uuid String id;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("timedependent entity SubTest extends Test { \t\t\t\t// error: no historized entities in inheritance");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("} ");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__TIMEDEPENDENT_IN_SUBCLASS);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__TIMEDEPENDENT_IN_SUBCLASS);
Assert.assertEquals(_lineNumber, 10);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void historized_id() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.entitydsltest.validation {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype String jvmType String;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("historized entity MyTest {");
_builder.newLine();
_builder.append("\t");
_builder.append("var String stuff;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__MISSING_ID_FOR_VERSIONED);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__MISSING_ID_FOR_VERSIONED);
Assert.assertEquals(_lineNumber, 6);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
@Test
public void timedependent_id() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.osbp.entitydsltest.validation {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("datatype String jvmType String;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("timedependent entity MyTest {");
_builder.newLine();
_builder.append("\t");
_builder.append("var String stuff;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
LEntityModel _parse = this._parseHelper.parse(_builder);
List<Issue> _validate = this._validationTestHelper.validate(_parse);
final Function1<Issue, String> _function = new Function1<Issue, String>() {
public String apply(final Issue it) {
return it.getCode();
}
};
Map<String, Issue> _map = IterableExtensions.<String, Issue>toMap(_validate, _function);
this.result = _map;
Severity _severity = this.severity(EntityGrammarJavaValidator.CODE__MISSING_ID_FOR_VERSIONED);
Assert.assertSame(_severity, Severity.ERROR);
int _lineNumber = this.lineNumber(EntityGrammarJavaValidator.CODE__MISSING_ID_FOR_VERSIONED);
Assert.assertEquals(_lineNumber, 6);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
/**
* Helper methods
*/
public int lineNumber(final String code) {
Issue _get = this.result.get(code);
return (_get.getLineNumber()).intValue();
}
public Severity severity(final String code) {
Issue _get = this.result.get(code);
return _get.getSeverity();
}
}