-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(codegen) update HR model to use multiple namespaces
Signed-off-by: Dan Selman <[email protected]>
- Loading branch information
Showing
3 changed files
with
47 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,10 +37,15 @@ describe('codegen', function () { | |
versionedModelManager = new ModelManager(); | ||
unversionedModelManager = new ModelManager(); | ||
|
||
const base_cto = fs.readFileSync('./test/codegen/fromcto/data/model/hr_base.cto', 'utf-8'); | ||
const cto = fs.readFileSync('./test/codegen/fromcto/data/model/hr.cto', 'utf-8'); | ||
|
||
versionedModelManager.addCTOModel(base_cto, 'hr_base.cto'); | ||
versionedModelManager.addCTOModel(cto, 'hr.cto'); | ||
|
||
const unversionedBaseCto = base_cto.replace('namespace [email protected]', 'namespace org.acme.hr.base'); | ||
const unversionedCto = cto.replace('namespace [email protected]', 'namespace org.acme.hr'); | ||
unversionedModelManager.addCTOModel(unversionedBaseCto, 'hr_base.cto'); | ||
unversionedModelManager.addCTOModel(unversionedCto, 'hr.cto'); | ||
}); | ||
|
||
|
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 |
---|---|---|
@@ -1,62 +1,45 @@ | ||
namespace [email protected] | ||
|
||
enum State { | ||
o MA | ||
o NY | ||
o CO | ||
o WA | ||
o IL | ||
o CA | ||
} | ||
|
||
concept Address { | ||
o String street | ||
o String city | ||
o State state optional | ||
o String zipCode | ||
o String country | ||
o Map1 dictionary1 | ||
o Map2 dictionary2 | ||
o Map3 dictionary3 | ||
o Map4 dictionary4 | ||
o Map5 dictionary5 | ||
o Map6 dictionary6 | ||
} | ||
scalar Time extends DateTime | ||
|
||
map Map1 { | ||
import [email protected].{State, SSN, Time} | ||
|
||
map CompanyProperties { | ||
o String | ||
o String | ||
} | ||
|
||
map Map2 { | ||
map EmployeeLoginTimes { | ||
o String | ||
o DateTime | ||
o Time | ||
} | ||
|
||
map Map3 { | ||
map EmployeeSocialSecurityNumbers { | ||
o String | ||
o SSN | ||
} | ||
|
||
map Map4 { | ||
map EmployeeProfiles { | ||
o String | ||
o Concept | ||
} | ||
|
||
map Map5 { | ||
map EmployeeTShirtSizes { | ||
o SSN | ||
o String | ||
o TShirtSizeType | ||
} | ||
|
||
map Map6 { | ||
map EmployeeDirectory { | ||
o SSN | ||
o Employee | ||
} | ||
|
||
concept Company { | ||
o String name | ||
o Address headquarters | ||
o CompanyProperties companyProperties optional | ||
o EmployeeDirectory employeeDirectory optional | ||
o EmployeeTShirtSizes employeeTShirtSizes optional | ||
o EmployeeProfiles employeeProfiles optional | ||
o EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers optional | ||
} | ||
|
||
enum Department { | ||
|
@@ -82,8 +65,6 @@ asset Laptop extends Equipment { | |
o LaptopMake make | ||
} | ||
|
||
scalar SSN extends String default="000-00-0000" regex=/\d{3}-\d{2}-\{4}+/ | ||
|
||
@resource | ||
abstract participant Person identified by email { | ||
o String email | ||
|
@@ -107,9 +88,6 @@ participant Employee extends Person { | |
--> Manager manager optional | ||
} | ||
|
||
|
||
|
||
|
||
participant Contractor extends Person { | ||
o Company company | ||
--> Manager manager optional | ||
|
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,27 @@ | ||
namespace [email protected] | ||
|
||
enum State { | ||
o MA | ||
o NY | ||
o CO | ||
o WA | ||
o IL | ||
o CA | ||
} | ||
|
||
enum TShirtSizeType { | ||
o SMALL | ||
o MEDIUM | ||
o LARGE | ||
} | ||
|
||
concept Address { | ||
o String street | ||
o String city | ||
o State state optional | ||
o String zipCode | ||
o String country | ||
} | ||
|
||
scalar Time extends DateTime | ||
scalar SSN extends String default="000-00-0000" regex=/\d{3}-\d{2}-\{4}+/ |