Skip to content

Commit

Permalink
Fix more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbey committed Mar 3, 2024
1 parent 5cce4c0 commit 4dda371
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public void testLocalMappingPropertyParsing() throws Exception
")\n";

PureModelContextData data = PureGrammarParser.newInstance().parseModel(val);
String expected = "{\"_type\":\"data\",\"serializer\":null,\"origin\":null,\"elements\":[{\"_type\":\"mapping\",\"name\":\"myMapping\",\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":2,\"startColumn\":1,\"endLine\":9,\"endColumn\":1},\"classMappings\":[{\"_type\":\"relational\",\"id\":null,\"mappingClass\":null,\"extendsClassMappingId\":null,\"root\":false,\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":4,\"startColumn\":5,\"endLine\":8,\"endColumn\":5},\"classSourceInformation\":{\"sourceId\":\"\",\"startLine\":4,\"startColumn\":5,\"endLine\":4,\"endColumn\":10},\"primaryKey\":[],\"propertyMappings\":[{\"_type\":\"relationalPropertyMapping\",\"property\":{\"property\":\"firstName\",\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":6,\"startColumn\":9,\"endLine\":6,\"endColumn\":17},\"class\":\"Person\"},\"source\":null,\"target\":null,\"localMappingProperty\":null,\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":6,\"startColumn\":19,\"endLine\":6,\"endColumn\":45},\"enumMappingId\":null,\"relationalOperation\":{\"_type\":\"column\",\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":6,\"startColumn\":21,\"endLine\":6,\"endColumn\":45},\"table\":{\"_type\":\"Table\",\"table\":\"personTable\",\"schema\":\"default\",\"database\":\"db\",\"mainTableDb\":\"db\",\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":6,\"startColumn\":25,\"endLine\":6,\"endColumn\":35}},\"tableAlias\":\"personTable\",\"column\":\"firstName\"},\"bindingTransformer\":null},{\"_type\":\"relationalPropertyMapping\",\"property\":{\"property\":\"localProp\",\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":7,\"startColumn\":10,\"endLine\":7,\"endColumn\":18},\"class\":null},\"source\":null,\"target\":null,\"localMappingProperty\":{\"type\":\"String\",\"multiplicity\":{\"lowerBound\":1,\"upperBound\":1},\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":7,\"startColumn\":20,\"endLine\":7,\"endColumn\":30}},\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":7,\"startColumn\":32,\"endLine\":7,\"endColumn\":58},\"enumMappingId\":null,\"relationalOperation\":{\"_type\":\"column\",\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":7,\"startColumn\":34,\"endLine\":7,\"endColumn\":58},\"table\":{\"_type\":\"Table\",\"table\":\"personTable\",\"schema\":\"default\",\"database\":\"db\",\"mainTableDb\":\"db\",\"sourceInformation\":{\"sourceId\":\"mappingPackage::myMapping\",\"startLine\":7,\"startColumn\":38,\"endLine\":7,\"endColumn\":48}},\"tableAlias\":\"personTable\",\"column\":\"firstName\"},\"bindingTransformer\":null}],\"mainTable\":null,\"distinct\":false,\"groupBy\":[],\"filter\":null,\"class\":\"Person\"}],\"includedMappings\":[],\"associationMappings\":[],\"enumerationMappings\":[],\"tests\":[],\"testSuites\":null,\"package\":\"mappingPackage\"},{\"_type\":\"sectionIndex\",\"name\":\"SectionIndex\",\"sourceInformation\":null,\"sections\":[{\"_type\":\"importAware\",\"parserName\":\"Pure\",\"elements\":[],\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":1,\"startColumn\":1,\"endLine\":1,\"endColumn\":8},\"imports\":[]},{\"_type\":\"importAware\",\"parserName\":\"Mapping\",\"elements\":[\"mappingPackage::myMapping\"],\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":2,\"startColumn\":8,\"endLine\":11,\"endColumn\":2},\"imports\":[]}],\"package\":\"__internal__\"}]}";
String expected = "{\"_type\":\"data\",\"serializer\":null,\"origin\":null,\"elements\":[{\"_type\":\"mapping\",\"name\":\"myMapping\",\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":2,\"startColumn\":1,\"endLine\":9,\"endColumn\":1},\"classMappings\":[{\"_type\":\"relational\",\"id\":null,\"mappingClass\":null,\"extendsClassMappingId\":null,\"root\":false,\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":4,\"startColumn\":5,\"endLine\":8,\"endColumn\":5},\"classSourceInformation\":{\"sourceId\":\"\",\"startLine\":4,\"startColumn\":5,\"endLine\":4,\"endColumn\":10},\"primaryKey\":[],\"propertyMappings\":[{\"_type\":\"relationalPropertyMapping\",\"property\":{\"property\":\"firstName\",\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":6,\"startColumn\":9,\"endLine\":6,\"endColumn\":17},\"class\":\"Person\"},\"source\":null,\"target\":null,\"localMappingProperty\":null,\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":6,\"startColumn\":19,\"endLine\":6,\"endColumn\":45},\"enumMappingId\":null,\"relationalOperation\":{\"_type\":\"column\",\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":6,\"startColumn\":21,\"endLine\":6,\"endColumn\":45},\"table\":{\"_type\":\"Table\",\"table\":\"personTable\",\"schema\":\"default\",\"database\":\"db\",\"mainTableDb\":\"db\",\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":6,\"startColumn\":25,\"endLine\":6,\"endColumn\":35}},\"tableAlias\":\"personTable\",\"column\":\"firstName\"},\"bindingTransformer\":null},{\"_type\":\"relationalPropertyMapping\",\"property\":{\"property\":\"localProp\",\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":7,\"startColumn\":10,\"endLine\":7,\"endColumn\":18},\"class\":null},\"source\":null,\"target\":null,\"localMappingProperty\":{\"type\":\"String\",\"multiplicity\":{\"lowerBound\":1,\"upperBound\":1},\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":7,\"startColumn\":20,\"endLine\":7,\"endColumn\":30}},\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":7,\"startColumn\":32,\"endLine\":7,\"endColumn\":58},\"enumMappingId\":null,\"relationalOperation\":{\"_type\":\"column\",\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":7,\"startColumn\":34,\"endLine\":7,\"endColumn\":58},\"table\":{\"_type\":\"Table\",\"table\":\"personTable\",\"schema\":\"default\",\"database\":\"db\",\"mainTableDb\":\"db\",\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":7,\"startColumn\":38,\"endLine\":7,\"endColumn\":48}},\"tableAlias\":\"personTable\",\"column\":\"firstName\"},\"bindingTransformer\":null}],\"mainTable\":null,\"distinct\":false,\"groupBy\":[],\"filter\":null,\"class\":\"Person\"}],\"includedMappings\":[],\"associationMappings\":[],\"enumerationMappings\":[],\"tests\":[],\"testSuites\":null,\"package\":\"mappingPackage\"},{\"_type\":\"sectionIndex\",\"name\":\"SectionIndex\",\"sourceInformation\":null,\"sections\":[{\"_type\":\"importAware\",\"parserName\":\"Pure\",\"elements\":[],\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":1,\"startColumn\":1,\"endLine\":1,\"endColumn\":8},\"imports\":[]},{\"_type\":\"importAware\",\"parserName\":\"Mapping\",\"elements\":[\"mappingPackage::myMapping\"],\"sourceInformation\":{\"sourceId\":\"\",\"startLine\":2,\"startColumn\":8,\"endLine\":11,\"endColumn\":2},\"imports\":[]}],\"package\":\"__internal__\"}]}";

Assert.assertEquals(expected, PureProtocolObjectMapperFactory.getNewObjectMapper().writeValueAsString(data));
}
Expand Down

0 comments on commit 4dda371

Please sign in to comment.