forked from finos/legend-pure
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tests for DSL Graph * Delete stray file * generate test par on test-compile
- Loading branch information
1 parent
b88d5f0
commit 1be8c1e
Showing
7 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...c/test/java/org/finos/legend/pure/m2/inlinedsl/graph/GraphCodeTestRepositoryProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2024 Goldman Sachs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License | ||
|
||
package org.finos.legend.pure.m2.inlinedsl.graph; | ||
|
||
import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepository; | ||
import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider; | ||
import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository; | ||
|
||
public class GraphCodeTestRepositoryProvider implements CodeRepositoryProvider | ||
{ | ||
@Override | ||
public CodeRepository repository() | ||
{ | ||
return GenericCodeRepository.build("platform_dsl_graph_test.definition.json"); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...src/test/java/org/finos/legend/pure/m2/inlinedsl/graph/TestGraphDSLTestCodeIntegrity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2024 Goldman Sachs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License | ||
|
||
package org.finos.legend.pure.m2.inlinedsl.graph; | ||
|
||
import org.finos.legend.pure.m3.tests.AbstractCompiledStateIntegrityTest; | ||
import org.junit.BeforeClass; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
|
||
public class TestGraphDSLTestCodeIntegrity extends AbstractCompiledStateIntegrityTest | ||
{ | ||
@BeforeClass | ||
public static void initialize() | ||
{ | ||
initialize("platform_dsl_graph_test"); | ||
} | ||
|
||
@Test | ||
@Ignore | ||
@Override | ||
public void testReferenceUsages() | ||
{ | ||
super.testReferenceUsages(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...vices/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.finos.legend.pure.m2.inlinedsl.graph.GraphCodeTestRepositoryProvider |
8 changes: 8 additions & 0 deletions
8
...gend-pure-m2-dsl-graph-grammar/src/test/resources/platform_dsl_graph_test.definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "platform_dsl_graph_test", | ||
"pattern": "(meta::pure::graphFetch|meta::pure::functions::meta)(::.*)?", | ||
"dependencies": [ | ||
"platform", | ||
"platform_dsl_graph" | ||
] | ||
} |
62 changes: 62 additions & 0 deletions
62
...gend-pure-m2-dsl-graph-grammar/src/test/resources/platform_dsl_graph_test/graph_test.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import meta::pure::graphFetch::test::*; | ||
|
||
Class meta::pure::graphFetch::test::A | ||
{ | ||
a : String[1]; | ||
} | ||
|
||
function meta::pure::graphFetch::test::simpleFetchTree():Any[*] | ||
{ | ||
print(#{meta::pure::graphFetch::test::A{a}}#, 2); | ||
} | ||
|
||
Class meta::pure::graphFetch::test::Person | ||
{ | ||
firstName: String[1]; | ||
lastName: String[1]; | ||
address: Address[1]; | ||
|
||
nameWithTitle(title:String[1]) | ||
{ | ||
$title + ' ' + $this.firstName + ' ' + $this.lastName + ' '; | ||
} : String[1]; | ||
|
||
nameWithPrefixAndSuffix(prefix:String[0..1], suffixes:String[*]) | ||
{ | ||
if($prefix->isEmpty(), | ||
| if($suffixes->isEmpty(), | ||
| $this.firstName + ' ' + $this.lastName, | ||
| $this.firstName + ' ' + $this.lastName + ', ' + $suffixes->joinStrings(', ')), | ||
| if($suffixes->isEmpty(), | ||
| $prefix->toOne() + ' ' + $this.firstName + ' ' + $this.lastName, | ||
| $prefix->toOne() + ' ' + $this.firstName + ' ' + $this.lastName + ', ' + $suffixes->joinStrings(', '))) | ||
}:String[1]; | ||
} | ||
|
||
Class meta::pure::graphFetch::test::Address | ||
{ | ||
} | ||
|
||
Class meta::pure::graphFetch::test::PersonAddress extends Address | ||
{ | ||
} | ||
|
||
Class meta::pure::graphFetch::test::FirmAddress extends Address | ||
{ | ||
} | ||
|
||
Class meta::pure::graphFetch::test::Firm | ||
{ | ||
a: Address[1]; | ||
employees: Person[*]; | ||
} | ||
|
||
function meta::pure::graphFetch::test::subTypeInTree():Any[*] | ||
{ | ||
print(#{Firm{employees{address->subType(@PersonAddress)}}}#, 2); | ||
} | ||
|
||
function meta::pure::graphFetch::test::graphPropertyParameter():Any[*] | ||
{ | ||
print(#{Person { nameWithTitle('Ms')}}#, 2); | ||
} |
Empty file.