This repository was archived by the owner on Nov 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Move examples from rosetta translate to translate demo
Hugo Hills edited this page Jul 20, 2022
·
14 revisions
This page contains instructions on how to migrate rosetta-translate unit tests to translate-demo examples. A few tools have been created to help.
based on categoryName (e.g. single-cardinality) and exampleSuffix (e.g. 4, example-4)
- In translate-demo, open ExampleTemplateGenerator, set categoryName and exampleSuffix, run.
- Note: ExampleTemplateGenerator run configuration should have working dir of
$MODULE_DIR$
- Note: ExampleTemplateGenerator run configuration should have working dir of
- Template (or empty) xml, xsd, rosetta and md files should be created in the correctly named folder structure inside the inputs folder
to translate-demo inputs folder
2.1 Copy rosetta code
- In rosetta-translate copy the unit test rosetta code, excluding the top level element (e.g. Top4), as this is named Root in the template
- Once copied into translate-demo:
- Format code (intenting, naming etc)
- Update synonyms source to template value (e.g. change Bank_A to SINGLE_CARDINALITY_EXAMPLE_4)
2.2 Copy xsd content
- In rosetta-translate copy the unit test xsd content excluding other schema tag into translate-demo xsd template
2.3 Copy xml content
- In rosetta-translate copy the unit test xml content into translate-demo xml template
- Clean up old element schema attributes
2.4 Write short description of test into empty md file
3.1 Copy inputs to correct folder structure and generate config and unit tests.
- In translate-demo, open ExampleGenerator, and run to create full examples from inputs folder.
- Note: ExampleTemplateGenerator run configuration should have working dir of
$MODULE_DIR$
- Note: ExampleTemplateGenerator run configuration should have working dir of
3.2 Generate rosetta
- Run maven plugins "resources:copy-resources xtext:generate -f pom.xml"
- Code should now compile
3.3 Run unit tests and generate expectations by running all tests with update flags set
- Set up run all unit tests configuration with env vars:
- TEST_WRITE_BASE_PATH=/Users/hugohills/dev/github/rosetta-models/translate-demo/rosetta-source/src/main/resources;WRITE_EXPECTATIONS=true;CREATE_EXPECTATION_FILES=true