Skip to content

Commit

Permalink
Add support for eClass (fixes #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
agarciadom committed Oct 9, 2022
1 parent d4a53f2 commit 870d916
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ public void getFeatureValue(GetFeatureValueRequest request, StreamObserver<Value
vBuilder.setReferenceValues(coll);
break;
}
case "eClass": {
EClass klass = mdObject.eClass();
if (klass != null) {
encoder.encodeReference(vBuilder, klass);
}
break;
}
default:
vBuilder.setNotDefined(true);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,17 @@ public void cannotSetNameOfFeature() throws Exception {
@Test
public void eContents() throws Exception {
EolModule module = createEOLModule();

module.parse("return Class.all.selectOne(c|c.name = 'Animal').eContents.size;");
assertEquals("The size of the contents of the Animal class should be 5", 5, module.execute());
}

@Test
public void eClass() throws Exception {
EolModule module = createEOLModule();
module.parse("return Class.all.first.eClass.name;");
assertEquals("Class", module.execute());
}

private void assumeTypeExists(String typeName) {
try {
m.getAllOfKind(typeName);
Expand Down

0 comments on commit 870d916

Please sign in to comment.