[OLINGO-530] Refactor Edm TechScenario Names again
This commit is contained in:
parent
6c894d7b66
commit
5a95029d70
|
@ -74,7 +74,7 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
|||
final List<TypeDefinition> providerTypeDefinitions = schema.getTypeDefinitions();
|
||||
if (providerTypeDefinitions != null) {
|
||||
for (TypeDefinition def : providerTypeDefinitions) {
|
||||
typeDefinitions.add(new EdmTypeDefinitionImpl(edm, new FullQualifiedName("namespace", def.getName()), def));
|
||||
typeDefinitions.add(new EdmTypeDefinitionImpl(edm, new FullQualifiedName(namespace, def.getName()), def));
|
||||
}
|
||||
}
|
||||
return typeDefinitions;
|
||||
|
|
|
@ -94,7 +94,7 @@ public class EdmSchemaImplTest {
|
|||
|
||||
@Test
|
||||
public void basicGetters() {
|
||||
assertEquals("namespace", schema.getNamespace());
|
||||
assertEquals("org.namespace", schema.getNamespace());
|
||||
assertEquals("alias", schema.getAlias());
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class EdmSchemaImplTest {
|
|||
assertEquals(2, typeDefinitions.size());
|
||||
|
||||
for (EdmTypeDefinition def : typeDefinitions) {
|
||||
assertTrue(def == edm.getTypeDefinition(new FullQualifiedName("namespace", def.getName())));
|
||||
assertTrue(def == edm.getTypeDefinition(new FullQualifiedName("org.namespace", def.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class EdmSchemaImplTest {
|
|||
assertEquals(2, enumTypes.size());
|
||||
|
||||
for (EdmEnumType enumType : enumTypes) {
|
||||
assertTrue(enumType == edm.getEnumType(new FullQualifiedName("namespace", enumType.getName())));
|
||||
assertTrue(enumType == edm.getEnumType(new FullQualifiedName("org.namespace", enumType.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class EdmSchemaImplTest {
|
|||
assertEquals(2, entityTypes.size());
|
||||
|
||||
for (EdmEntityType entityType : entityTypes) {
|
||||
assertTrue(entityType == edm.getEntityType(new FullQualifiedName("namespace", entityType.getName())));
|
||||
assertTrue(entityType == edm.getEntityType(new FullQualifiedName("org.namespace", entityType.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class EdmSchemaImplTest {
|
|||
assertEquals(2, complexTypes.size());
|
||||
|
||||
for (EdmComplexType complexType : complexTypes) {
|
||||
assertTrue(complexType == edm.getComplexType(new FullQualifiedName("namespace", complexType.getName())));
|
||||
assertTrue(complexType == edm.getComplexType(new FullQualifiedName("org.namespace", complexType.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class EdmSchemaImplTest {
|
|||
assertEquals(2, actions.size());
|
||||
|
||||
for (EdmAction action : actions) {
|
||||
assertTrue(action == edm.getUnboundAction(new FullQualifiedName("namespace", action.getName())));
|
||||
assertTrue(action == edm.getUnboundAction(new FullQualifiedName("org.namespace", action.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class EdmSchemaImplTest {
|
|||
assertEquals(2, functions.size());
|
||||
|
||||
for (EdmFunction function : functions) {
|
||||
FullQualifiedName functionName = new FullQualifiedName("namespace", function.getName());
|
||||
FullQualifiedName functionName = new FullQualifiedName("org.namespace", function.getName());
|
||||
assertTrue(function == edm.getUnboundFunction(functionName, null));
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +204,9 @@ public class EdmSchemaImplTest {
|
|||
|
||||
private class LocalProvider extends EdmProvider {
|
||||
|
||||
private static final String ALIAS = "alias";
|
||||
private static final String NAMESPACE = "org.namespace";
|
||||
|
||||
@Override
|
||||
public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
|
||||
throw new RuntimeException("Provider must not be called in the schema case");
|
||||
|
@ -277,36 +280,36 @@ public class EdmSchemaImplTest {
|
|||
@Override
|
||||
public List<Schema> getSchemas() throws ODataException {
|
||||
Schema providerSchema = new Schema();
|
||||
providerSchema.setNamespace("namespace");
|
||||
providerSchema.setAlias("alias");
|
||||
providerSchema.setNamespace(NAMESPACE);
|
||||
providerSchema.setAlias(ALIAS);
|
||||
EntityContainer container = new EntityContainer().setName("container");
|
||||
|
||||
List<EntitySet> entitySets = new ArrayList<EntitySet>();
|
||||
entitySets.add(new EntitySet().setName("entitySetName")
|
||||
.setType(new FullQualifiedName("namespace", "entityType1")));
|
||||
.setType(new FullQualifiedName(NAMESPACE, "entityType1")));
|
||||
entitySets
|
||||
.add(new EntitySet().setName("entitySetName2").setType(new FullQualifiedName("namespace", "entityType2")));
|
||||
.add(new EntitySet().setName("entitySetName2").setType(new FullQualifiedName(NAMESPACE, "entityType2")));
|
||||
container.setEntitySets(entitySets);
|
||||
|
||||
List<Singleton> singletons = new ArrayList<Singleton>();
|
||||
singletons.add(new Singleton().setName("singletonName")
|
||||
.setType(new FullQualifiedName("namespace", "entityType1")));
|
||||
.setType(new FullQualifiedName(NAMESPACE, "entityType1")));
|
||||
singletons
|
||||
.add(new Singleton().setName("singletonName2").setType(new FullQualifiedName("namespace", "entityType2")));
|
||||
.add(new Singleton().setName("singletonName2").setType(new FullQualifiedName(NAMESPACE, "entityType2")));
|
||||
container.setSingletons(singletons);
|
||||
|
||||
List<ActionImport> actionImports = new ArrayList<ActionImport>();
|
||||
actionImports.add(new ActionImport().setName("actionImportName").setAction(
|
||||
new FullQualifiedName("namespace", "action1")));
|
||||
new FullQualifiedName(NAMESPACE, "action1")));
|
||||
actionImports.add(new ActionImport().setName("actionImportName2").setAction(
|
||||
new FullQualifiedName("namespace", "action2")));
|
||||
new FullQualifiedName(NAMESPACE, "action2")));
|
||||
container.setActionImports(actionImports);
|
||||
|
||||
List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
|
||||
functionImports.add(new FunctionImport().setName("functionImportName").setFunction(
|
||||
new FullQualifiedName("namespace", "function1")));
|
||||
new FullQualifiedName(NAMESPACE, "function1")));
|
||||
functionImports.add(new FunctionImport().setName("functionImportName2").setFunction(
|
||||
new FullQualifiedName("namespace", "function2")));
|
||||
new FullQualifiedName(NAMESPACE, "function2")));
|
||||
container.setFunctionImports(functionImports);
|
||||
providerSchema.setEntityContainer(container);
|
||||
|
||||
|
@ -323,13 +326,13 @@ public class EdmSchemaImplTest {
|
|||
List<EntityType> entityTypes = new ArrayList<EntityType>();
|
||||
entityTypes.add(new EntityType().setName("entityType1"));
|
||||
entityTypes.add(new EntityType().setName("entityType2")
|
||||
.setBaseType(new FullQualifiedName("namespace", "entityType1")));
|
||||
.setBaseType(new FullQualifiedName(NAMESPACE, "entityType1")));
|
||||
providerSchema.setEntityTypes(entityTypes);
|
||||
|
||||
List<ComplexType> complexTypes = new ArrayList<ComplexType>();
|
||||
complexTypes.add(new ComplexType().setName("complexType1"));
|
||||
complexTypes.add(new ComplexType().setName("complexType2").setBaseType(
|
||||
new FullQualifiedName("namespace", "complexType1")));
|
||||
new FullQualifiedName(NAMESPACE, "complexType1")));
|
||||
providerSchema.setComplexTypes(complexTypes);
|
||||
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
|
|
|
@ -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 nameCTMixEnumDefColl = new FullQualifiedName(SchemaProvider.NAMESPACE,
|
||||
"CTMixEnumDefColl");
|
||||
public static final FullQualifiedName nameCTMixEnumDef = new FullQualifiedName(SchemaProvider.NAMESPACE,
|
||||
"CTMixEnumDef");
|
||||
|
||||
public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
|
||||
|
||||
|
@ -163,9 +163,9 @@ public class ComplexTypeProvider {
|
|||
.setName("CTTwoBasePrimCompNav")
|
||||
.setBaseType(nameCTBasePrimCompNav);
|
||||
|
||||
} else if (complexTypeName.equals(nameCTMixEnumDefColl)) {
|
||||
} else if (complexTypeName.equals(nameCTMixEnumDef)) {
|
||||
return new ComplexType()
|
||||
.setName(nameCTMixEnumDefColl.getName())
|
||||
.setName(nameCTMixEnumDef.getName())
|
||||
.setProperties(Arrays.asList(
|
||||
PropertyProvider.propertyEnumString_ENString,
|
||||
PropertyProvider.collPropertyEnumString_ENString,
|
||||
|
|
|
@ -517,12 +517,12 @@ public class PropertyProvider {
|
|||
.setType(ComplexTypeProvider.nameCTMixPrimCollComp);
|
||||
|
||||
public static final Property propertyComp_CTMixEnumTypeDefColl = new Property()
|
||||
.setName("PropertyCompMixedEnumTypeDefColl")
|
||||
.setType(ComplexTypeProvider.nameCTMixEnumDefColl);
|
||||
.setName("PropertyCompMixedEnumDef")
|
||||
.setType(ComplexTypeProvider.nameCTMixEnumDef);
|
||||
|
||||
public static final Property propertyCompColl_CTMixEnumTypeDefColl = new Property()
|
||||
.setName("CollPropertyCompMixedEnumDefColl")
|
||||
.setType(ComplexTypeProvider.nameCTMixEnumDefColl)
|
||||
.setName("CollPropertyCompMixedEnumDef")
|
||||
.setType(ComplexTypeProvider.nameCTMixEnumDef)
|
||||
.setCollection(true);
|
||||
|
||||
// Navigation Properties -------------------------------------------------------------------------------------------
|
||||
|
@ -600,10 +600,12 @@ public class PropertyProvider {
|
|||
// TypeDefinition Properties ---------------------------------------------------------------------------------------
|
||||
public static final Property propertyTypeDefinition_TDString = new Property()
|
||||
.setName("PropertyDefString")
|
||||
.setType(TypeDefinitionProvider.nameTDString);
|
||||
.setType(TypeDefinitionProvider.nameTDString)
|
||||
.setMaxLength(15);
|
||||
|
||||
public static final Property collPropertyTypeDefinition_TDString = new Property()
|
||||
.setName("CollPropertyDefString")
|
||||
.setType(TypeDefinitionProvider.nameTDString)
|
||||
.setMaxLength(15)
|
||||
.setCollection(true);
|
||||
}
|
||||
|
|
|
@ -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.nameCTMixEnumDefColl));
|
||||
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTMixEnumDef));
|
||||
|
||||
// TypeDefinitions
|
||||
List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();
|
||||
|
|
|
@ -434,7 +434,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
|
|||
assertNotNull(defProperty);
|
||||
assertEquals("string", defProperty.getValue());
|
||||
|
||||
Property complexProperty = entity.getProperty("PropertyCompMixedEnumTypeDefColl");
|
||||
Property complexProperty = entity.getProperty("PropertyCompMixedEnumDef");
|
||||
List<Property> value = (List<Property>) complexProperty.getValue();
|
||||
assertEquals((short) 2, value.get(0).getValue());
|
||||
}
|
||||
|
@ -1099,7 +1099,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
|
|||
public void eTMixEnumDefCollCompNavInvalidComplexEnumValueNull() throws Exception {
|
||||
String entityString = "{"
|
||||
+ "\"PropertyEnumString\" : 2,"
|
||||
+ "\"PropertyCompMixedEnumTypeDefColl\" : {"
|
||||
+ "\"PropertyCompMixedEnumDef\" : {"
|
||||
+ "\"PropertyEnumString\" : null"
|
||||
+ "}}";
|
||||
|
||||
|
|
|
@ -133,6 +133,12 @@ public class MetadataDocumentTest {
|
|||
assertThat(metadata, containsString("<EntityType Name=\"ETAbstract\" Abstract=\"true\">"));
|
||||
assertThat(metadata,
|
||||
containsString("<EntityType Name=\"ETAbstractBase\" BaseType=\"Namespace1_Alias.ETAbstract\">"));
|
||||
|
||||
// TypeDefCheck
|
||||
assertThat(metadata,
|
||||
containsString("<Property Name=\"PropertyDefString\" Type=\"Namespace1_Alias.TDString\" MaxLength=\"15\"/>"));
|
||||
assertThat(metadata, containsString("<Property Name=\"CollPropertyDefString\" " +
|
||||
"Type=\"Collection(Namespace1_Alias.TDString)\" MaxLength=\"15\"/>"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4460,11 +4460,11 @@ public class TestFullResourcePath {
|
|||
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
|
||||
|
||||
testFilter.runOnETMixEnumDefCollComp(
|
||||
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString has olingo.odata.test1.ENString'String2'")
|
||||
.is("<<PropertyCompMixedEnumTypeDefColl/PropertyEnumString> has <olingo.odata.test1.ENString<String2>>>")
|
||||
"PropertyCompMixedEnumDef/PropertyEnumString has olingo.odata.test1.ENString'String2'")
|
||||
.is("<<PropertyCompMixedEnumDef/PropertyEnumString> has <olingo.odata.test1.ENString<String2>>>")
|
||||
.isBinary(BinaryOperatorKind.HAS)
|
||||
.root().left().goPath()
|
||||
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
|
||||
.first().isComplex("PropertyCompMixedEnumDef")
|
||||
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
|
||||
.isType(EnumTypeProvider.nameENString)
|
||||
.goUpFilterValidator()
|
||||
|
@ -4472,14 +4472,14 @@ public class TestFullResourcePath {
|
|||
|
||||
testFilter
|
||||
.runOnETMixEnumDefCollComp(
|
||||
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString has olingo.odata.test1.ENString'String2' eq true")
|
||||
.is("<<<PropertyCompMixedEnumTypeDefColl/PropertyEnumString> has " +
|
||||
"PropertyCompMixedEnumDef/PropertyEnumString has olingo.odata.test1.ENString'String2' eq true")
|
||||
.is("<<<PropertyCompMixedEnumDef/PropertyEnumString> has " +
|
||||
"<olingo.odata.test1.ENString<String2>>> eq <true>>")
|
||||
.isBinary(BinaryOperatorKind.EQ)
|
||||
.root().left()
|
||||
.isBinary(BinaryOperatorKind.HAS)
|
||||
.root().left().left().goPath()
|
||||
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
|
||||
.first().isComplex("PropertyCompMixedEnumDef")
|
||||
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
|
||||
.goUpFilterValidator()
|
||||
.root().left().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
|
||||
|
@ -4734,26 +4734,26 @@ public class TestFullResourcePath {
|
|||
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
|
||||
|
||||
testFilter.runOnETMixEnumDefCollComp(
|
||||
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString eq olingo.odata.test1.ENString'String3'")
|
||||
.is("<<PropertyCompMixedEnumTypeDefColl/PropertyEnumString> eq <olingo.odata.test1.ENString<String3>>>")
|
||||
"PropertyCompMixedEnumDef/PropertyEnumString eq olingo.odata.test1.ENString'String3'")
|
||||
.is("<<PropertyCompMixedEnumDef/PropertyEnumString> eq <olingo.odata.test1.ENString<String3>>>")
|
||||
.isBinary(BinaryOperatorKind.EQ)
|
||||
.root().left().goPath()
|
||||
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
|
||||
.first().isComplex("PropertyCompMixedEnumDef")
|
||||
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
|
||||
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
|
||||
|
||||
testFilter
|
||||
.runOnETMixEnumDefCollComp(
|
||||
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString eq " +
|
||||
"PropertyCompMixedEnumTypeDefColl/PropertyEnumString")
|
||||
.is("<<PropertyCompMixedEnumTypeDefColl/PropertyEnumString> eq " +
|
||||
"<PropertyCompMixedEnumTypeDefColl/PropertyEnumString>>")
|
||||
"PropertyCompMixedEnumDef/PropertyEnumString eq " +
|
||||
"PropertyCompMixedEnumDef/PropertyEnumString")
|
||||
.is("<<PropertyCompMixedEnumDef/PropertyEnumString> eq " +
|
||||
"<PropertyCompMixedEnumDef/PropertyEnumString>>")
|
||||
.isBinary(BinaryOperatorKind.EQ)
|
||||
.root().left().goPath()
|
||||
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
|
||||
.first().isComplex("PropertyCompMixedEnumDef")
|
||||
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
|
||||
.root().right().goPath()
|
||||
.first().isComplex("PropertyCompMixedEnumTypeDefColl")
|
||||
.first().isComplex("PropertyCompMixedEnumDef")
|
||||
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator();
|
||||
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
"PropertyDefString" : "string",
|
||||
"CollPropertyEnumString" : [1, 2],
|
||||
"CollPropertyDefString" : ["string1", "string2"],
|
||||
"PropertyCompMixedEnumTypeDefColl" : {
|
||||
"PropertyCompMixedEnumDef" : {
|
||||
"PropertyEnumString" : 2,
|
||||
"PropertyDefString" : "string",
|
||||
"CollPropertyEnumString" : [1, 2],
|
||||
"CollPropertyDefString" : ["string1", "string2"]
|
||||
},
|
||||
"CollPropertyCompMixedEnumDefColl" : [{
|
||||
"CollPropertyCompMixedEnumDef" : [{
|
||||
"PropertyEnumString" : 2,
|
||||
"PropertyDefString" : "string",
|
||||
"CollPropertyEnumString" : [1, 2],
|
||||
|
|
Loading…
Reference in New Issue