Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2012-01-12 17:06:33 +0000
committerEd Merks2012-01-12 17:06:33 +0000
commited131216b161138a90b84d217ff2cfe482f62d3d (patch)
treed9799d0d7bcb9e5473e17274f7d2aca868a0800b /tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation
parent990f9aec10d784b5b384ae84bf8a4275277b9c11 (diff)
downloadorg.eclipse.emf-ed131216b161138a90b84d217ff2cfe482f62d3d.tar.gz
org.eclipse.emf-ed131216b161138a90b84d217ff2cfe482f62d3d.tar.xz
org.eclipse.emf-ed131216b161138a90b84d217ff2cfe482f62d3d.zip
[368320] Refactor xcore test project names
Also eliminate any bundle version constraints; the build inserts them.
Diffstat (limited to 'tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation')
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-AtMostOneID.xcore19
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-ConsistentSuperTypesConflict.xcore21
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-ConsistentSuperTypesDuplicate.xcore13
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-DisjointFeatureAndOperationSignatures.xcore11
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-NoCircularSuperTypes.xcore9
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-UniqueFeatureNames.xcore19
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-UniqueOperationSignatures.xcore11
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-WellformedMapEntryClass.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-WellformedMapEntryNoInstanceClassName.xcore15
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClassifier-UniqueTypeParameterNames.xcore9
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EEnum-UniqueEnumeratorLiterals.xcore11
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EEnum-UniqueEnumeratorNames.xcore11
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ClassNotPermitted.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentNoneAllowed.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsIncorrectNumber.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsInvalidSubstitution.xcore19
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsNone.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-DataTypeNotPermitted.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-NoClass.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-PrimitiveTypePermitted.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EObject-EveryMapEntryUnique.xcore12
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EOperation-UniqueParameterNames.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EOperation-UniqueTypeParameterNames.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EPackage-UniqueClassifierNames.xcore11
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentContainer.xcore22
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeBadTransient.xcore11
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeBothContainment.xcore12
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeNotMatching.xcore11
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-SingleContainer.xcore11
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/ETypedElement-ConsistentBounds.xcore10
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/Linking.xcore8
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/XcoreValidationTest.java87
32 files changed, 463 insertions, 0 deletions
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-AtMostOneID.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-AtMostOneID.xcore
new file mode 100644
index 000000000..2c2ba80f1
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-AtMostOneID.xcore
@@ -0,0 +1,19 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class C extends A, B { }' message 'The features 'id1' and 'id2' cannot both be IDs'
+--- */
+
+class A
+{
+ id String id1
+}
+
+class B
+{
+ id String id2
+}
+
+class C extends A, B
+{
+} \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-ConsistentSuperTypesConflict.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-ConsistentSuperTypesConflict.xcore
new file mode 100644
index 000000000..17551456f
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-ConsistentSuperTypesConflict.xcore
@@ -0,0 +1,21 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class D extends B, C { }' message 'The generic super types instantiate 'foo.A' inconsistently'
+--- */
+
+class A<T>
+{
+}
+
+class B extends A<String>
+{
+}
+
+class C extends A<Integer>
+{
+}
+
+class D extends B, C
+{
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-ConsistentSuperTypesDuplicate.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-ConsistentSuperTypesDuplicate.xcore
new file mode 100644
index 000000000..6e9ede673
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-ConsistentSuperTypesDuplicate.xcore
@@ -0,0 +1,13 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class B extends A, A { }' message 'The generic super types at index '1' and '0' must not be duplicates'
+--- */
+
+class A
+{
+}
+
+class B extends A, A
+{
+} \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-DisjointFeatureAndOperationSignatures.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-DisjointFeatureAndOperationSignatures.xcore
new file mode 100644
index 000000000..71abafcfe
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-DisjointFeatureAndOperationSignatures.xcore
@@ -0,0 +1,11 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class A { String a op String getA() }' message 'There may not be an operation 'foo.A.getA' with the same signature as an accessor method for feature 'foo.A.a''
+--- */
+
+class A
+{
+ String a
+ op String getA()
+} \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-NoCircularSuperTypes.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-NoCircularSuperTypes.xcore
new file mode 100644
index 000000000..352e55d4a
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-NoCircularSuperTypes.xcore
@@ -0,0 +1,9 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class A extends A { }' message 'A class may not be a super type of itself'
+--- */
+
+class A extends A
+{
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-UniqueFeatureNames.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-UniqueFeatureNames.xcore
new file mode 100644
index 000000000..bae231ec9
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-UniqueFeatureNames.xcore
@@ -0,0 +1,19 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class C extends A, B { }' message 'There may not be two features named 'a''
+--- */
+
+class A
+{
+ String a
+}
+
+class B
+{
+ String a
+}
+
+class C extends A, B
+{
+} \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-UniqueOperationSignatures.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-UniqueOperationSignatures.xcore
new file mode 100644
index 000000000..26d6f3a2b
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-UniqueOperationSignatures.xcore
@@ -0,0 +1,11 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class A { op String a() op String a() }' message 'There may not be two operations 'foo.A.a' and 'foo.A.a' with the same signature'
+--- */
+
+class A
+{
+ op String a()
+ op String a()
+} \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-WellformedMapEntryClass.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-WellformedMapEntryClass.xcore
new file mode 100644
index 000000000..2d07d9878
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-WellformedMapEntryClass.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class A wraps java.util.Map$Entry { }' message 'A map entry class must have a feature called 'key''
+error at 'class A wraps java.util.Map$Entry { }' message 'A map entry class must have a feature called 'value''
+--- */
+
+class A wraps java.util.Map$Entry
+{
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-WellformedMapEntryNoInstanceClassName.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-WellformedMapEntryNoInstanceClassName.xcore
new file mode 100644
index 000000000..e5716ebd8
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClass-WellformedMapEntryNoInstanceClassName.xcore
@@ -0,0 +1,15 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class B extends A { }' message 'A class that inherits from a map entry class must have instance class name 'java.util.Map$Entry''
+--- */
+
+class A wraps java.util.Map$Entry
+{
+ String key
+ String value
+}
+
+class B extends A
+{
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClassifier-UniqueTypeParameterNames.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClassifier-UniqueTypeParameterNames.xcore
new file mode 100644
index 000000000..6f4830fdd
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EClassifier-UniqueTypeParameterNames.xcore
@@ -0,0 +1,9 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class A<T, T> { }' message 'There may not be two type parameters named 'T''
+--- */
+
+class A<T, T>
+{
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EEnum-UniqueEnumeratorLiterals.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EEnum-UniqueEnumeratorLiterals.xcore
new file mode 100644
index 000000000..1ac698de9
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EEnum-UniqueEnumeratorLiterals.xcore
@@ -0,0 +1,11 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'A as 'x'' message 'There may not be two enumerators with literal value 'x''
+--- */
+
+enum A
+{
+ A as 'x'
+ B as 'x'
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EEnum-UniqueEnumeratorNames.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EEnum-UniqueEnumeratorNames.xcore
new file mode 100644
index 000000000..63ca5e7c3
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EEnum-UniqueEnumeratorNames.xcore
@@ -0,0 +1,11 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'A ' message 'There may not be two enumerators named 'A''
+--- */
+
+enum A
+{
+ A
+ A
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ClassNotPermitted.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ClassNotPermitted.xcore
new file mode 100644
index 000000000..cfdc2250e
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ClassNotPermitted.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'A' message 'The generic attribute type must not refer to a class'
+--- */
+
+class A
+{
+ A a
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentNoneAllowed.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentNoneAllowed.xcore
new file mode 100644
index 000000000..4f9f97c65
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentNoneAllowed.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'A<?>' message 'The generic type associated with the 'A' classifier must not have 1 argument(s) when the classifier has 0 type parameter(s)'
+--- */
+
+class A
+{
+ refers A<?> a
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsIncorrectNumber.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsIncorrectNumber.xcore
new file mode 100644
index 000000000..6db4aed57
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsIncorrectNumber.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'A<String>' message 'The generic type associated with the 'A' classifier must not have 1 argument(s) when the classifier has 2 type parameter(s)'
+--- */
+
+class A<T, U>
+{
+ refers A<String> a
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsInvalidSubstitution.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsInvalidSubstitution.xcore
new file mode 100644
index 000000000..931c0b642
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsInvalidSubstitution.xcore
@@ -0,0 +1,19 @@
+
+package foo
+
+/* XPECT validationIssues ---
+error at 'A<C>' message 'The generic type 'foo.C' is not a valid substitution for type parameter 'foo.A.T''
+--- */
+
+class A<T extends B>
+{
+ refers A<C> a
+}
+
+class B
+{
+}
+
+class C
+{
+} \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsNone.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsNone.xcore
new file mode 100644
index 000000000..61ed378b0
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-ConsistentArgumentsNone.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+warning at 'A' message 'The generic type associated with the 'A' classifier should have 1 type argument(s) to match the number of type parameter (s) of the classifier '
+--- */
+
+class A<T>
+{
+ refers A a
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-DataTypeNotPermitted.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-DataTypeNotPermitted.xcore
new file mode 100644
index 000000000..0ccbd4b03
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-DataTypeNotPermitted.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'String' message 'The generic reference type must not refer to a data type'
+--- */
+
+class A
+{
+ refers String a
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-NoClass.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-NoClass.xcore
new file mode 100644
index 000000000..88fbcb09b
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-NoClass.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'T' message 'A generic super type must refer to a class'
+error at 'String' message 'A generic super type must refer to a class'
+--- */
+
+class A<T> extends T, String
+{
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-PrimitiveTypePermitted.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-PrimitiveTypePermitted.xcore
new file mode 100644
index 000000000..e224fe792
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EGenericType-PrimitiveTypePermitted.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'int' message 'The primitive type 'int' can not be used in this context'
+--- */
+
+class A<T>
+{
+ refers A<int> a
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EObject-EveryMapEntryUnique.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EObject-EveryMapEntryUnique.xcore
new file mode 100644
index 000000000..ddacf6afb
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EObject-EveryMapEntryUnique.xcore
@@ -0,0 +1,12 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'x='x'' message 'The feature 'details' has a map entry at index 1 with a key that collides with that of the map entry at index 0'
+--- */
+
+annotation "Foo" as Foo
+
+@Foo(x='x', x='x')
+class A
+{
+} \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EOperation-UniqueParameterNames.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EOperation-UniqueParameterNames.xcore
new file mode 100644
index 000000000..0a4d621b8
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EOperation-UniqueParameterNames.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at ' op void foo(A a, A a)' message 'There may not be two parameters named 'a''
+--- */
+
+class A
+{
+ op void foo(A a, A a)
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EOperation-UniqueTypeParameterNames.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EOperation-UniqueTypeParameterNames.xcore
new file mode 100644
index 000000000..1a5649355
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EOperation-UniqueTypeParameterNames.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at ' op <T, T> void foo()' message 'There may not be two type parameters named 'T''
+--- */
+
+class A
+{
+ op <T, T> void foo()
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EPackage-UniqueClassifierNames.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EPackage-UniqueClassifierNames.xcore
new file mode 100644
index 000000000..019828ee3
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EPackage-UniqueClassifierNames.xcore
@@ -0,0 +1,11 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'class A { }' message 'There may not be two classifiers named 'A''
+--- */
+
+class A
+{
+}
+
+type A wraps java.lang.String \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentContainer.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentContainer.xcore
new file mode 100644
index 000000000..85d743493
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentContainer.xcore
@@ -0,0 +1,22 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'contains A a oppos it e b' message 'A containment reference of a type with a container feature foo.A.c that requires instances to be contained elsewhere cannot be populated'
+error at 'contains A a opposite c' message 'A containment reference of a type with a container feature foo.A.b that requires instances to be contained elsewhere cannot be populated'
+--- */
+
+class A
+{
+ container B [1] b opposite a
+ container C [1] c opposite a
+}
+
+class B
+{
+ contains A a opposite b
+}
+
+class C
+{
+ contains A a opposite c
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeBadTransient.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeBadTransient.xcore
new file mode 100644
index 000000000..2b5598a39
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeBadTransient.xcore
@@ -0,0 +1,11 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'y' message 'The opposite of a transient reference must be transient if it is proxy resolving'
+--- */
+
+class A
+{
+ refers transient A x opposite y
+ refers A y opposite x
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeBothContainment.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeBothContainment.xcore
new file mode 100644
index 000000000..6ba281027
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeBothContainment.xcore
@@ -0,0 +1,12 @@
+package foo
+
+/* XPECT validationIssues ---
+error at ' y' message 'The opposite of a containment reference must not be a containment reference'
+error at ' x' message 'The opposite of a containment reference must not be a containment reference'
+--- */
+
+class A
+{
+ contains A x opposite y
+ contains A y opposite x
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeNotMatching.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeNotMatching.xcore
new file mode 100644
index 000000000..33306aec5
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-ConsistentOppositeNotMatching.xcore
@@ -0,0 +1,11 @@
+package foo
+
+/* XPECT validationIssues ---
+error at ' y' message 'The opposite of the opposite may not be a reference different from this one'
+--- */
+
+class A
+{
+ refers A x opposite y
+ refers A y
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-SingleContainer.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-SingleContainer.xcore
new file mode 100644
index 000000000..3260a0652
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/EReference-SingleContainer.xcore
@@ -0,0 +1,11 @@
+package foo
+
+/* XPECT validationIssues ---
+error at ' [*]' message 'A container reference must have upper bound of 1 not -1'
+--- */
+
+class A
+{
+ contains A x opposite y
+ container A [*] y opposite x
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/ETypedElement-ConsistentBounds.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/ETypedElement-ConsistentBounds.xcore
new file mode 100644
index 000000000..2bacdd0a0
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/ETypedElement-ConsistentBounds.xcore
@@ -0,0 +1,10 @@
+package foo
+
+/* XPECT validationIssues ---
+error at '[2..1]' message 'The lower bound 2 must be less than or equal to the upper bound 1'
+--- */
+
+class A
+{
+ String [2..1] a
+}
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/Linking.xcore b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/Linking.xcore
new file mode 100644
index 000000000..2208de2ea
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/Linking.xcore
@@ -0,0 +1,8 @@
+package foo
+
+/* XPECT validationIssues ---
+error at 'baz' message 'Couldn't resolve reference to GenBase 'baz'.'
+error at 'baz' message 'A generic super type must refer to a class'
+--- */
+
+class bar extends baz {} \ No newline at end of file
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/XcoreValidationTest.java b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/XcoreValidationTest.java
new file mode 100644
index 000000000..735fff4f2
--- /dev/null
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/validation/XcoreValidationTest.java
@@ -0,0 +1,87 @@
+package org.eclipse.emf.test.ecore.xcore.validation;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.util.EcoreValidator;
+import org.eclipse.emf.ecore.xcore.XcoreInjectorProvider;
+import org.eclipse.xtext.junit4.InjectWith;
+import org.eclipse.xtext.junit4.parameterized.InjectParameter;
+import org.eclipse.xtext.junit4.parameterized.ParameterizedXtextRunner;
+import org.eclipse.xtext.junit4.parameterized.ResourceURIs;
+import org.eclipse.xtext.junit4.parameterized.XpectLines;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.util.CancelIndicator;
+import org.eclipse.xtext.validation.CheckMode;
+import org.eclipse.xtext.validation.IResourceValidator;
+import org.eclipse.xtext.validation.Issue;
+import org.junit.runner.RunWith;
+
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+/**
+ * There are cases not covered because the grammar doesn't allow it, i.e.,
+ * {@link EcoreValidator#CONSISTENT_BOUNDS_NOT_ALLOWED},
+ * {@link EcoreValidator#CONSISTENT_BOUNDS_NO_BOUNDS_WITH_TYPE_PARAMETER_OR_CLASSIFIER}
+ * , {@link EcoreValidator#CONSISTENT_BOUNDS_NO_LOWER_AND_UPPER},
+ * {@link EcoreValidator#CONSISTENT_TYPE_NO_TYPE_PARAMETER_AND_CLASSIFIER},
+ * {@link EcoreValidator#CONSISTENT_TYPE_WILDCARD_NOT_PERMITTED},
+ * {@link EcoreValidator#INTERFACE_IS_ABSTRACT},
+ * {@link EcoreValidator#NO_REPEATING_VOID},
+ * {@link EcoreValidator#UNIQUE_NS_URIS},
+ * {@link EcoreValidator#UNIQUE_SUBPACKAGE_NAMES},
+ * {@link EcoreValidator#VALID_LOWER_BOUND}, {@link EcoreValidator#VALID_TYPE},
+ * {@link EcoreValidator#VALID_UPPER_BOUND},
+ * {@link EcoreValidator#WELL_FORMED_INSTANCE_TYPE_NAME}, or the scoping rules
+ * won't resolve that way, i.e., {@link EcoreValidator#CONSISTENT_KEYS},
+ * {@link EcoreValidator#CONSISTENT_OPPOSITE_NOT_FROM_TYPE},
+ * {@link EcoreValidator#CONSISTENT_TYPE_TYPE_PARAMETER_NOT_IN_SCOPE},
+ * {@link EcoreValidator#WELL_FORMED_NAME}, or we don't set the flags yet, i.e.,
+ * {@link EcoreValidator#CONSISTENT_TRANSIENT}, or we can't get into that state,
+ * i.e., {@link EcoreValidator#VALID_DEFAULT_VALUE_LITERAL},
+ * {@link EcoreValidator#CONSISTENT_UNIQUE}, or are TODO items
+ * {@link EcoreValidator#WELL_FORMED_NS_PREFIX},
+ * {@link EcoreValidator#WELL_FORMED_NS_URI},
+ * {@link EcoreValidator#WELL_FORMED_SOURCE_URI},
+ *
+ */
+@SuppressWarnings("restriction")
+@InjectWith(XcoreInjectorProvider.class)
+@RunWith(ParameterizedXtextRunner.class)
+@ResourceURIs(baseDir = "src/org/eclipse/emf/test/ecore/xcore/validation", fileExtensions = "xcore")
+public class XcoreValidationTest
+{
+
+ @InjectParameter
+ private XtextResource resource;
+
+ @Inject
+ private IResourceValidator validator;
+
+ protected String formatIssue(Issue issue)
+ {
+ StringBuilder result = new StringBuilder();
+ result.append(issue.getSeverity().name().toLowerCase());
+ if (issue.getOffset() != null && issue.getLength() != null)
+ {
+ result.append(" at '");
+ result.append(resource.getParseResult().getRootNode().getText()
+ .substring(issue.getOffset(), issue.getOffset() + issue.getLength()));
+ result.append("' ");
+ } else
+ result.append(" ");
+ result.append("message '");
+ result.append(issue.getMessage());
+ result.append("'");
+ return result.toString();
+ }
+
+ @XpectLines()
+ public List<String> validationIssues()
+ {
+ List<String> result = Lists.newArrayList();
+ for (Issue issue : validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl))
+ result.add(formatIssue(issue));
+ return result;
+ }
+}

Back to the top