[OLINGO-530] Refactor Edm Names again

This commit is contained in:
Christian Amend 2015-01-22 11:14:53 +01:00
parent f2ed0ddb09
commit 6a6730fbaa
7 changed files with 54 additions and 50 deletions

View File

@ -49,8 +49,8 @@ public class ComplexTypeProvider {
public static final FullQualifiedName nameCTTwoBasePrimCompNav =
new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoBasePrimCompNav");
public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoPrim");
public static final FullQualifiedName nameCTMixEnumTypeDefColl = new FullQualifiedName(SchemaProvider.NAMESPACE,
"CTMixEnumTypeDefColl");
public static final FullQualifiedName nameCTMixEnumDefColl = new FullQualifiedName(SchemaProvider.NAMESPACE,
"CTMixEnumDefColl");
public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
@ -163,9 +163,9 @@ public class ComplexTypeProvider {
.setName("CTTwoBasePrimCompNav")
.setBaseType(nameCTBasePrimCompNav);
} else if (complexTypeName.equals(nameCTMixEnumTypeDefColl)) {
} else if (complexTypeName.equals(nameCTMixEnumDefColl)) {
return new ComplexType()
.setName(nameCTMixEnumTypeDefColl.getName())
.setName(nameCTMixEnumDefColl.getName())
.setProperties(Arrays.asList(
PropertyProvider.propertyEnumString_ENString,
PropertyProvider.collPropertyEnumString_ENString,

View File

@ -95,7 +95,7 @@ public class ContainerProvider {
entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBaseTwoKeyNav"));
entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompMixPrimCollComp"));
entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESFourKeyAlias"));
entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixEnumTypeDefCollComp"));
entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixEnumDefCollComp"));
// Singletons
List<Singleton> singletons = new ArrayList<Singleton>();
@ -263,9 +263,10 @@ public class ContainerProvider {
return new EntitySet()
.setName("ESFourKeyAlias")
.setType(EntityTypeProvider.nameETFourKeyAlias);
} else if (name.equals("ESMixEnumTypeDefCollComp")) {
return new EntitySet().setName("ESMixEnumTypeDefCollComp").setType(
EntityTypeProvider.nameETMixEnumTypeDefCollComp);
} else if (name.equals("ESMixEnumDefCollComp")) {
return new EntitySet().setName("ESMixEnumDefCollComp").setType(
EntityTypeProvider.nameETMixEnumDefCollComp);
}
}

View File

@ -76,8 +76,8 @@ public class EntityTypeProvider {
public static final FullQualifiedName nameETAbstractBase = new FullQualifiedName(SchemaProvider.NAMESPACE,
"ETAbstractBase");
public static final FullQualifiedName nameETMixEnumTypeDefCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
"ETMixEnumTypeDefCollComp");
public static final FullQualifiedName nameETMixEnumDefCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
"ETMixEnumDefCollComp");
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
if (entityTypeName.equals(nameETAllPrim)) {
@ -418,9 +418,9 @@ public class EntityTypeProvider {
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable));
} else if (entityTypeName.equals(nameETMixEnumTypeDefCollComp)) {
} else if (entityTypeName.equals(nameETMixEnumDefCollComp)) {
return new EntityType()
.setName(nameETMixEnumTypeDefCollComp.getName())
.setName(nameETMixEnumDefCollComp.getName())
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable,

View File

@ -517,12 +517,12 @@ public class PropertyProvider {
.setType(ComplexTypeProvider.nameCTMixPrimCollComp);
public static final Property propertyComp_CTMixEnumTypeDefColl = new Property()
.setName("PropertyCTMixEnumTypeDefColl")
.setType(ComplexTypeProvider.nameCTMixEnumTypeDefColl);
.setName("PropertyCompMixedEnumTypeDefColl")
.setType(ComplexTypeProvider.nameCTMixEnumDefColl);
public static final Property propertyCompColl_CTMixEnumTypeDefColl = new Property()
.setName("CollPropertyCTMixEnumTypeDefColl")
.setType(ComplexTypeProvider.nameCTMixEnumTypeDefColl)
.setName("CollPropertyCompMixedEnumDefColl")
.setType(ComplexTypeProvider.nameCTMixEnumDefColl)
.setCollection(true);
// Navigation Properties -------------------------------------------------------------------------------------------
@ -599,11 +599,11 @@ public class PropertyProvider {
// TypeDefinition Properties ---------------------------------------------------------------------------------------
public static final Property propertyTypeDefinition_TDString = new Property()
.setName("PropertyTypeDefinitionString")
.setName("PropertyDefString")
.setType(TypeDefinitionProvider.nameTDString);
public static final Property collPropertyTypeDefinition_TDString = new Property()
.setName("CollPropertyTypeDefinitionString")
.setName("CollPropertyDefString")
.setType(TypeDefinitionProvider.nameTDString)
.setCollection(true);
}

View File

@ -78,7 +78,7 @@ public class SchemaProvider {
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETKeyPrimNav));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAbstract));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAbstractBase));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMixEnumTypeDefCollComp));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMixEnumDefCollComp));
// ComplexTypes
List<ComplexType> complexType = new ArrayList<ComplexType>();
@ -97,7 +97,7 @@ public class SchemaProvider {
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTBasePrimCompNav));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoBasePrimCompNav));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompNav));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTMixEnumTypeDefColl));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTMixEnumDefColl));
// TypeDefinitions
List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();

View File

@ -4452,39 +4452,39 @@ public class TestFullResourcePath {
@Test
public void testHas() throws ExpressionVisitException, ODataApplicationException, UriParserException {
testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String1'")
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String1'")
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>")
.isBinary(BinaryOperatorKind.HAS)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
testFilter.runOnETMixEnumTypeDefCollComp(
"PropertyCTMixEnumTypeDefColl/PropertyEnumString has olingo.odata.test1.ENString'String2'")
.is("<<PropertyCTMixEnumTypeDefColl/PropertyEnumString> has <olingo.odata.test1.ENString<String2>>>")
testFilter.runOnETMixEnumDefCollComp(
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString has olingo.odata.test1.ENString'String2'")
.is("<<PropertyCompMixedEnumTypeDefColl/PropertyEnumString> has <olingo.odata.test1.ENString<String2>>>")
.isBinary(BinaryOperatorKind.HAS)
.root().left().goPath()
.first().isComplex("PropertyCTMixEnumTypeDefColl")
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
testFilter
.runOnETMixEnumTypeDefCollComp(
"PropertyCTMixEnumTypeDefColl/PropertyEnumString has olingo.odata.test1.ENString'String2' eq true")
.is("<<<PropertyCTMixEnumTypeDefColl/PropertyEnumString> has " +
.runOnETMixEnumDefCollComp(
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString has olingo.odata.test1.ENString'String2' eq true")
.is("<<<PropertyCompMixedEnumTypeDefColl/PropertyEnumString> has " +
"<olingo.odata.test1.ENString<String2>>> eq <true>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left()
.isBinary(BinaryOperatorKind.HAS)
.root().left().left().goPath()
.first().isComplex("PropertyCTMixEnumTypeDefColl")
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().left().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String3'")
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String3'")
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String3>>>")
.isBinary(BinaryOperatorKind.HAS)
.root().left().goPath()
@ -4493,7 +4493,7 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String,String3'")
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String,String3'")
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String,String3>>>")
.isBinary(BinaryOperatorKind.HAS)
.root().left().goPath()
@ -4502,7 +4502,7 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String", "String3"));
testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString has null")
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has null")
.is("<<PropertyEnumString> has <null>>")
.root()
.isBinary(BinaryOperatorKind.HAS)
@ -4719,38 +4719,41 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.root().right().isLiteral("12:34:55.12345678901");
testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
.is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String1>>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String2'")
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String2'")
.is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String2>>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
testFilter.runOnETMixEnumTypeDefCollComp(
"PropertyCTMixEnumTypeDefColl/PropertyEnumString eq olingo.odata.test1.ENString'String3'")
.is("<<PropertyCTMixEnumTypeDefColl/PropertyEnumString> eq <olingo.odata.test1.ENString<String3>>>")
testFilter.runOnETMixEnumDefCollComp(
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString eq olingo.odata.test1.ENString'String3'")
.is("<<PropertyCompMixedEnumTypeDefColl/PropertyEnumString> eq <olingo.odata.test1.ENString<String3>>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left().goPath()
.first().isComplex("PropertyCTMixEnumTypeDefColl")
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
testFilter.runOnETMixEnumTypeDefCollComp(
"PropertyCTMixEnumTypeDefColl/PropertyEnumString eq PropertyCTMixEnumTypeDefColl/PropertyEnumString")
.is("<<PropertyCTMixEnumTypeDefColl/PropertyEnumString> eq <PropertyCTMixEnumTypeDefColl/PropertyEnumString>>")
testFilter
.runOnETMixEnumDefCollComp(
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString eq " +
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString")
.is("<<PropertyCompMixedEnumTypeDefColl/PropertyEnumString> eq " +
"<PropertyCompMixedEnumTypeDefColl/PropertyEnumString>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left().goPath()
.first().isComplex("PropertyCTMixEnumTypeDefColl")
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
.root().right().goPath()
.first().isComplex("PropertyCTMixEnumTypeDefColl")
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator();
}
@ -5070,12 +5073,12 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.goOrder(0).right().isLiteral("12:34:55.123456789012");
testFilter.runOrderByOnETMixEnumTypeDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
testFilter.runOrderByOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
.isSortOrder(0, false)
.goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator()
.goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
testFilter.runOrderByOnETMixEnumTypeDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1' desc")
testFilter.runOrderByOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1' desc")
.isSortOrder(0, true)
.goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator()
.goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));

View File

@ -113,8 +113,8 @@ public class FilterValidator implements TestValidator {
return runUriOrderBy("ESTwoKeyNav", "$orderby=" + orderBy.trim());
}
public FilterValidator runOrderByOnETMixEnumTypeDefCollComp(final String orderBy) throws UriParserException {
return runUriOrderBy("ESMixEnumTypeDefCollComp", "$orderby=" + orderBy.trim());
public FilterValidator runOrderByOnETMixEnumDefCollComp(final String orderBy) throws UriParserException {
return runUriOrderBy("ESMixEnumDefCollComp", "$orderby=" + orderBy.trim());
}
public FilterValidator runOrderByOnETTwoKeyNavEx(final String orderBy) throws UriParserException {
@ -125,8 +125,8 @@ public class FilterValidator implements TestValidator {
return runUri("ESTwoKeyNav", "$filter=" + filter.trim());
}
public FilterValidator runOnETMixEnumTypeDefCollComp(final String filter) throws UriParserException {
return runUri("ESMixEnumTypeDefCollComp", "$filter=" + filter.trim());
public FilterValidator runOnETMixEnumDefCollComp(final String filter) throws UriParserException {
return runUri("ESMixEnumDefCollComp", "$filter=" + filter.trim());
}
public FilterValidator runOnETTwoKeyNavSingle(final String filter) throws UriParserException {