http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java index 9b08277..6dddcfc 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java @@ -43,23 +43,23 @@ import org.apache.olingo.commons.api.edm.EdmSchema; import org.apache.olingo.commons.api.edm.EdmSingleton; import org.apache.olingo.commons.api.edm.EdmTypeDefinition; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.AbstractEdmProvider; -import org.apache.olingo.commons.api.edm.provider.Action; -import org.apache.olingo.commons.api.edm.provider.ActionImport; -import org.apache.olingo.commons.api.edm.provider.AliasInfo; -import org.apache.olingo.commons.api.edm.provider.ComplexType; -import org.apache.olingo.commons.api.edm.provider.EdmProvider; -import org.apache.olingo.commons.api.edm.provider.EntityContainer; -import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo; -import org.apache.olingo.commons.api.edm.provider.EntitySet; -import org.apache.olingo.commons.api.edm.provider.EntityType; -import org.apache.olingo.commons.api.edm.provider.EnumType; -import org.apache.olingo.commons.api.edm.provider.Function; -import org.apache.olingo.commons.api.edm.provider.FunctionImport; -import org.apache.olingo.commons.api.edm.provider.Schema; -import org.apache.olingo.commons.api.edm.provider.Singleton; -import org.apache.olingo.commons.api.edm.provider.Term; -import org.apache.olingo.commons.api.edm.provider.TypeDefinition; +import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider; +import org.apache.olingo.commons.api.edm.provider.CsdlAction; +import org.apache.olingo.commons.api.edm.provider.CsdlActionImport; +import org.apache.olingo.commons.api.edm.provider.CsdlAliasInfo; +import org.apache.olingo.commons.api.edm.provider.CsdlComplexType; +import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider; +import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer; +import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo; +import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet; +import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; +import org.apache.olingo.commons.api.edm.provider.CsdlEnumType; +import org.apache.olingo.commons.api.edm.provider.CsdlFunction; +import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport; +import org.apache.olingo.commons.api.edm.provider.CsdlSchema; +import org.apache.olingo.commons.api.edm.provider.CsdlSingleton; +import org.apache.olingo.commons.api.edm.provider.CsdlTerm; +import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition; import org.apache.olingo.commons.core.edm.EdmProviderImpl; import org.junit.Before; import org.junit.Test; @@ -71,7 +71,7 @@ public class EdmSchemaImplTest { @Before public void before() { - EdmProvider provider = new LocalProvider(); + CsdlEdmProvider provider = new LocalProvider(); edm = new EdmProviderImpl(provider); schema = edm.getSchemas().get(0); @@ -79,17 +79,17 @@ public class EdmSchemaImplTest { @Test public void initialSchemaTest() { - EdmProvider provider = mock(EdmProvider.class); + CsdlEdmProvider provider = mock(CsdlEdmProvider.class); edm = new EdmProviderImpl(provider); edm.getSchemas(); } @Test public void emptySchemaTest() throws Exception { - ArrayList<Schema> schemas = new ArrayList<Schema>(); - Schema providerSchema = new Schema(); + ArrayList<CsdlSchema> schemas = new ArrayList<CsdlSchema>(); + CsdlSchema providerSchema = new CsdlSchema(); schemas.add(providerSchema); - EdmProvider provider = mock(EdmProvider.class); + CsdlEdmProvider provider = mock(CsdlEdmProvider.class); when(provider.getSchemas()).thenReturn(schemas); edm = new EdmProviderImpl(provider); edm.getSchemas(); @@ -205,157 +205,158 @@ public class EdmSchemaImplTest { assertTrue(container == edm.getEntityContainer(null)); } - private class LocalProvider extends AbstractEdmProvider { + private class LocalProvider extends CsdlAbstractEdmProvider { private static final String ALIAS = "alias"; private static final String NAMESPACE = "org.namespace"; @Override - public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException { + public CsdlEnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException { + public CsdlTypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { + public CsdlEntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { + public CsdlComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public List<Action> getActions(final FullQualifiedName actionName) throws ODataException { + public List<CsdlAction> getActions(final FullQualifiedName actionName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException { + public List<CsdlFunction> getFunctions(final FullQualifiedName functionName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public Term getTerm(final FullQualifiedName termName) throws ODataException { + public CsdlTerm getTerm(final FullQualifiedName termName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName) + public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName) + public CsdlSingleton getSingleton(final FullQualifiedName entityContainer, final String singletonName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName) + public CsdlActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName) + public CsdlFunctionImport getFunctionImport(final FullQualifiedName entityContainer, + final String functionImportName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) + public CsdlEntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public List<AliasInfo> getAliasInfos() throws ODataException { + public List<CsdlAliasInfo> getAliasInfos() throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } @Override - public List<Schema> getSchemas() throws ODataException { - Schema providerSchema = new Schema(); + public List<CsdlSchema> getSchemas() throws ODataException { + CsdlSchema providerSchema = new CsdlSchema(); providerSchema.setNamespace(NAMESPACE); providerSchema.setAlias(ALIAS); - EntityContainer container = new EntityContainer().setName("container"); + CsdlEntityContainer container = new CsdlEntityContainer().setName("container"); - List<EntitySet> entitySets = new ArrayList<EntitySet>(); - entitySets.add(new EntitySet().setName("entitySetName") + List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>(); + entitySets.add(new CsdlEntitySet().setName("entitySetName") .setType(new FullQualifiedName(NAMESPACE, "entityType1"))); entitySets - .add(new EntitySet().setName("entitySetName2").setType(new FullQualifiedName(NAMESPACE, "entityType2"))); + .add(new CsdlEntitySet().setName("entitySetName2").setType(new FullQualifiedName(NAMESPACE, "entityType2"))); container.setEntitySets(entitySets); - List<Singleton> singletons = new ArrayList<Singleton>(); - singletons.add(new Singleton().setName("singletonName") + List<CsdlSingleton> singletons = new ArrayList<CsdlSingleton>(); + singletons.add(new CsdlSingleton().setName("singletonName") .setType(new FullQualifiedName(NAMESPACE, "entityType1"))); singletons - .add(new Singleton().setName("singletonName2").setType(new FullQualifiedName(NAMESPACE, "entityType2"))); + .add(new CsdlSingleton().setName("singletonName2").setType(new FullQualifiedName(NAMESPACE, "entityType2"))); container.setSingletons(singletons); - List<ActionImport> actionImports = new ArrayList<ActionImport>(); - actionImports.add(new ActionImport().setName("actionImportName").setAction( + List<CsdlActionImport> actionImports = new ArrayList<CsdlActionImport>(); + actionImports.add(new CsdlActionImport().setName("actionImportName").setAction( new FullQualifiedName(NAMESPACE, "action1"))); - actionImports.add(new ActionImport().setName("actionImportName2").setAction( + actionImports.add(new CsdlActionImport().setName("actionImportName2").setAction( new FullQualifiedName(NAMESPACE, "action2"))); container.setActionImports(actionImports); - List<FunctionImport> functionImports = new ArrayList<FunctionImport>(); - functionImports.add(new FunctionImport().setName("functionImportName").setFunction( + List<CsdlFunctionImport> functionImports = new ArrayList<CsdlFunctionImport>(); + functionImports.add(new CsdlFunctionImport().setName("functionImportName").setFunction( new FullQualifiedName(NAMESPACE, "function1"))); - functionImports.add(new FunctionImport().setName("functionImportName2").setFunction( + functionImports.add(new CsdlFunctionImport().setName("functionImportName2").setFunction( new FullQualifiedName(NAMESPACE, "function2"))); container.setFunctionImports(functionImports); providerSchema.setEntityContainer(container); - List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>(); - typeDefinitions.add(new TypeDefinition().setName("typeDefinition1").setUnderlyingType( + List<CsdlTypeDefinition> typeDefinitions = new ArrayList<CsdlTypeDefinition>(); + typeDefinitions.add(new CsdlTypeDefinition().setName("typeDefinition1").setUnderlyingType( EdmPrimitiveTypeKind.String.getFullQualifiedName())); - typeDefinitions.add(new TypeDefinition().setName("typeDefinition2").setUnderlyingType( + typeDefinitions.add(new CsdlTypeDefinition().setName("typeDefinition2").setUnderlyingType( EdmPrimitiveTypeKind.String.getFullQualifiedName())); providerSchema.setTypeDefinitions(typeDefinitions); - List<EnumType> enumTypes = new ArrayList<EnumType>(); - enumTypes.add(new EnumType().setName("enumType1")); - enumTypes.add(new EnumType().setName("enumType2")); + List<CsdlEnumType> enumTypes = new ArrayList<CsdlEnumType>(); + enumTypes.add(new CsdlEnumType().setName("enumType1")); + enumTypes.add(new CsdlEnumType().setName("enumType2")); providerSchema.setEnumTypes(enumTypes); - List<EntityType> entityTypes = new ArrayList<EntityType>(); - entityTypes.add(new EntityType().setName("entityType1")); - entityTypes.add(new EntityType().setName("entityType2") + List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>(); + entityTypes.add(new CsdlEntityType().setName("entityType1")); + entityTypes.add(new CsdlEntityType().setName("entityType2") .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( + List<CsdlComplexType> complexTypes = new ArrayList<CsdlComplexType>(); + complexTypes.add(new CsdlComplexType().setName("complexType1")); + complexTypes.add(new CsdlComplexType().setName("complexType2").setBaseType( new FullQualifiedName(NAMESPACE, "complexType1"))); providerSchema.setComplexTypes(complexTypes); - List<Action> actions = new ArrayList<Action>(); - actions.add(new Action().setName("action1")); - actions.add(new Action().setName("action2")); + List<CsdlAction> actions = new ArrayList<CsdlAction>(); + actions.add(new CsdlAction().setName("action1")); + actions.add(new CsdlAction().setName("action2")); providerSchema.setActions(actions); - List<Function> functions = new ArrayList<Function>(); - functions.add(new Function().setName("function1")); - functions.add(new Function().setName("function2")); + List<CsdlFunction> functions = new ArrayList<CsdlFunction>(); + functions.add(new CsdlFunction().setName("function1")); + functions.add(new CsdlFunction().setName("function2")); providerSchema.setFunctions(functions); - ArrayList<Schema> schemas = new ArrayList<Schema>(); + ArrayList<CsdlSchema> schemas = new ArrayList<CsdlSchema>(); schemas.add(providerSchema); return schemas; } @Override - public EntityContainer getEntityContainer() throws ODataException { + public CsdlEntityContainer getEntityContainer() throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java index f502e20..d1aeb20 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java @@ -31,12 +31,12 @@ import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmException; import org.apache.olingo.commons.api.edm.EdmSingleton; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.EdmProvider; -import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo; -import org.apache.olingo.commons.api.edm.provider.EntityType; -import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding; -import org.apache.olingo.commons.api.edm.provider.PropertyRef; -import org.apache.olingo.commons.api.edm.provider.Singleton; +import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider; +import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo; +import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; +import org.apache.olingo.commons.api.edm.provider.CsdlNavigationPropertyBinding; +import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef; +import org.apache.olingo.commons.api.edm.provider.CsdlSingleton; import org.apache.olingo.commons.core.edm.EdmEntityContainerImpl; import org.apache.olingo.commons.core.edm.EdmProviderImpl; import org.apache.olingo.commons.core.edm.EdmSingletonImpl; @@ -46,28 +46,28 @@ public class EdmSingletonImplTest { @Test public void singleton() throws Exception { - EdmProvider provider = mock(EdmProvider.class); + CsdlEdmProvider provider = mock(CsdlEdmProvider.class); EdmProviderImpl edm = new EdmProviderImpl(provider); final FullQualifiedName typeName = new FullQualifiedName("ns", "entityType"); - final EntityType entityTypeProvider = new EntityType() + final CsdlEntityType entityTypeProvider = new CsdlEntityType() .setName(typeName.getName()) - .setKey(Arrays.asList(new PropertyRef().setName("Id"))); + .setKey(Arrays.asList(new CsdlPropertyRef().setName("Id"))); when(provider.getEntityType(typeName)).thenReturn(entityTypeProvider); final FullQualifiedName containerName = new FullQualifiedName("ns", "container"); - final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName); + final CsdlEntityContainerInfo containerInfo = new CsdlEntityContainerInfo().setContainerName(containerName); when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo); final EdmEntityContainer entityContainer = new EdmEntityContainerImpl(edm, provider, containerInfo); final String singletonName = "singleton"; - final Singleton singletonProvider = - new Singleton() + final CsdlSingleton singletonProvider = + new CsdlSingleton() .setName(singletonName) .setType(typeName) .setNavigationPropertyBindings( Arrays.asList( - new NavigationPropertyBinding().setPath("path").setTarget( + new CsdlNavigationPropertyBinding().setPath("path").setTarget( containerName.getFullQualifiedNameAsString() + "/" + singletonName))); when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider); @@ -85,17 +85,17 @@ public class EdmSingletonImplTest { @Test(expected = EdmException.class) public void wrongTarget() throws Exception { - EdmProvider provider = mock(EdmProvider.class); + CsdlEdmProvider provider = mock(CsdlEdmProvider.class); EdmProviderImpl edm = new EdmProviderImpl(provider); final FullQualifiedName containerName = new FullQualifiedName("ns", "container"); - final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName); + final CsdlEntityContainerInfo containerInfo = new CsdlEntityContainerInfo().setContainerName(containerName); when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo); final String singletonName = "singleton"; - final Singleton singletonProvider = new Singleton() + final CsdlSingleton singletonProvider = new CsdlSingleton() .setNavigationPropertyBindings(Arrays.asList( - new NavigationPropertyBinding().setPath("path") + new CsdlNavigationPropertyBinding().setPath("path") .setTarget(containerName.getFullQualifiedNameAsString() + "/wrong"))); when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider); @@ -105,14 +105,14 @@ public class EdmSingletonImplTest { @Test(expected = EdmException.class) public void wrongTargetContainer() throws Exception { - EdmProvider provider = mock(EdmProvider.class); + CsdlEdmProvider provider = mock(CsdlEdmProvider.class); EdmProviderImpl edm = new EdmProviderImpl(provider); final FullQualifiedName containerName = new FullQualifiedName("ns", "container"); final String singletonName = "singleton"; - final Singleton singletonProvider = new Singleton() + final CsdlSingleton singletonProvider = new CsdlSingleton() .setNavigationPropertyBindings(Arrays.asList( - new NavigationPropertyBinding().setPath("path").setTarget("ns.wrongContainer/" + singletonName))); + new CsdlNavigationPropertyBinding().setPath("path").setTarget("ns.wrongContainer/" + singletonName))); when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider); final EdmSingleton singleton = new EdmSingletonImpl(edm, null, singletonProvider); @@ -121,10 +121,10 @@ public class EdmSingletonImplTest { @Test(expected = EdmException.class) public void nonExsistingEntityType() throws Exception { - EdmProvider provider = mock(EdmProvider.class); + CsdlEdmProvider provider = mock(CsdlEdmProvider.class); EdmProviderImpl edm = new EdmProviderImpl(provider); - Singleton singleton = new Singleton().setName("name"); + CsdlSingleton singleton = new CsdlSingleton().setName("name"); final EdmSingleton edmSingleton = new EdmSingletonImpl(edm, null, singleton); edmSingleton.getEntityType(); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java index 845dea7..cf610c3 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java @@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.EdmTypeDefinition; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; -import org.apache.olingo.commons.api.edm.provider.TypeDefinition; +import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; import org.apache.olingo.commons.core.edm.EdmProviderImpl; import org.apache.olingo.commons.core.edm.EdmTypeDefinitionImpl; @@ -39,8 +39,8 @@ public class EdmTypeDefinitionImplTest { @Test public void typeDefOnStringNoFacets() throws Exception { final FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name"); - final TypeDefinition providerTypeDef = - new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("Edm", "String")); + final CsdlTypeDefinition providerTypeDef = + new CsdlTypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("Edm", "String")); final EdmTypeDefinition typeDefImpl = new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef); @@ -68,8 +68,8 @@ public class EdmTypeDefinitionImplTest { @Test(expected = EdmException.class) public void invalidTypeResultsInEdmException() throws Exception { FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name"); - TypeDefinition providerTypeDef = - new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("wrong", "wrong")); + CsdlTypeDefinition providerTypeDef = + new CsdlTypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("wrong", "wrong")); EdmTypeDefinitionImpl def = new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef); def.getUnderlyingType(); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java index 5249de7..c440c9d 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java @@ -22,8 +22,8 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable; import org.apache.olingo.commons.api.edm.EdmType; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; -import org.apache.olingo.commons.api.edm.provider.Annotatable; -import org.apache.olingo.commons.api.edm.provider.Annotation; +import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable; +import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; import org.apache.olingo.commons.core.edm.EdmTypeImpl; import org.junit.Test; @@ -51,10 +51,10 @@ public class EdmTypeImplTest { } } - private class AnnoTester implements Annotatable { + private class AnnoTester implements CsdlAnnotatable { @Override - public List<Annotation> getAnnotations() { - Annotation annotation = new Annotation(); + public List<CsdlAnnotation> getAnnotations() { + CsdlAnnotation annotation = new CsdlAnnotation(); annotation.setTerm("NS.SimpleTerm"); return Arrays.asList(annotation); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java index 4333308..567e3a5 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java @@ -28,36 +28,36 @@ import org.apache.olingo.commons.api.ODataException; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.ComplexType; -import org.apache.olingo.commons.api.edm.provider.EdmProvider; -import org.apache.olingo.commons.api.edm.provider.NavigationProperty; -import org.apache.olingo.commons.api.edm.provider.Property; +import org.apache.olingo.commons.api.edm.provider.CsdlComplexType; +import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider; +import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; +import org.apache.olingo.commons.api.edm.provider.CsdlProperty; import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl; import org.apache.olingo.commons.core.edm.EdmProviderImpl; public class ComplexTypeHelper { public static EdmComplexType createType() throws ODataException { - EdmProvider provider = mock(EdmProvider.class); + CsdlEdmProvider provider = mock(CsdlEdmProvider.class); EdmProviderImpl edm = new EdmProviderImpl(provider); FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName"); - ComplexType baseComplexType = new ComplexType(); - List<Property> baseProperties = new ArrayList<Property>(); - baseProperties.add(new Property().setName("prop1").setType( + CsdlComplexType baseComplexType = new CsdlComplexType(); + List<CsdlProperty> baseProperties = new ArrayList<CsdlProperty>(); + baseProperties.add(new CsdlProperty().setName("prop1").setType( EdmPrimitiveTypeKind.String.getFullQualifiedName())); - List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>(); - baseNavigationProperties.add(new NavigationProperty().setName("nav1")); + List<CsdlNavigationProperty> baseNavigationProperties = new ArrayList<CsdlNavigationProperty>(); + baseNavigationProperties.add(new CsdlNavigationProperty().setName("nav1")); baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties) .setNavigationProperties(baseNavigationProperties); when(provider.getComplexType(baseName)).thenReturn(baseComplexType); FullQualifiedName name = new FullQualifiedName("namespace", "typeName"); - ComplexType complexType = new ComplexType().setBaseType(baseName); - List<Property> properties = new ArrayList<Property>(); - properties.add(new Property().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())); - List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>(); - navigationProperties.add(new NavigationProperty().setName("nav2")); + CsdlComplexType complexType = new CsdlComplexType().setBaseType(baseName); + List<CsdlProperty> properties = new ArrayList<CsdlProperty>(); + properties.add(new CsdlProperty().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())); + List<CsdlNavigationProperty> navigationProperties = new ArrayList<CsdlNavigationProperty>(); + navigationProperties.add(new CsdlNavigationProperty().setName("nav2")); complexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(properties) .setNavigationProperties(navigationProperties); when(provider.getComplexType(name)).thenReturn(complexType); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java index af5b421..df4ed77 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java @@ -33,10 +33,10 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.ComplexType; -import org.apache.olingo.commons.api.edm.provider.EdmProvider; -import org.apache.olingo.commons.api.edm.provider.NavigationProperty; -import org.apache.olingo.commons.api.edm.provider.Property; +import org.apache.olingo.commons.api.edm.provider.CsdlComplexType; +import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider; +import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; +import org.apache.olingo.commons.api.edm.provider.CsdlProperty; import org.apache.olingo.commons.core.edm.primitivetype.EdmString; import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl; import org.apache.olingo.commons.core.edm.EdmProviderImpl; @@ -175,16 +175,16 @@ public class ContextURLBuilderTest { @Test public void buildComplexType() throws Exception { - EdmProvider provider = mock(EdmProvider.class); + CsdlEdmProvider provider = mock(CsdlEdmProvider.class); EdmProviderImpl edm = new EdmProviderImpl(provider); FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName"); - ComplexType baseComplexType = new ComplexType(); - List<Property> baseProperties = new ArrayList<Property>(); - baseProperties.add(new Property().setName("prop1").setType( + CsdlComplexType baseComplexType = new CsdlComplexType(); + List<CsdlProperty> baseProperties = new ArrayList<CsdlProperty>(); + baseProperties.add(new CsdlProperty().setName("prop1").setType( EdmPrimitiveTypeKind.String.getFullQualifiedName())); - List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>(); - baseNavigationProperties.add(new NavigationProperty().setName("nav1")); + List<CsdlNavigationProperty> baseNavigationProperties = new ArrayList<CsdlNavigationProperty>(); + baseNavigationProperties.add(new CsdlNavigationProperty().setName("nav1")); baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties) .setNavigationProperties(baseNavigationProperties); when(provider.getComplexType(baseName)).thenReturn(baseComplexType); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java index d1b73f7..560685b 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java @@ -38,25 +38,25 @@ import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.EdmSchema; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.AbstractEdmProvider; -import org.apache.olingo.commons.api.edm.provider.Action; -import org.apache.olingo.commons.api.edm.provider.ActionImport; -import org.apache.olingo.commons.api.edm.provider.AliasInfo; -import org.apache.olingo.commons.api.edm.provider.ComplexType; -import org.apache.olingo.commons.api.edm.provider.EdmProvider; -import org.apache.olingo.commons.api.edm.provider.EntityContainer; -import org.apache.olingo.commons.api.edm.provider.EntitySet; -import org.apache.olingo.commons.api.edm.provider.EntityType; -import org.apache.olingo.commons.api.edm.provider.EnumMember; -import org.apache.olingo.commons.api.edm.provider.EnumType; -import org.apache.olingo.commons.api.edm.provider.Function; -import org.apache.olingo.commons.api.edm.provider.FunctionImport; -import org.apache.olingo.commons.api.edm.provider.Parameter; -import org.apache.olingo.commons.api.edm.provider.Property; -import org.apache.olingo.commons.api.edm.provider.PropertyRef; -import org.apache.olingo.commons.api.edm.provider.ReturnType; -import org.apache.olingo.commons.api.edm.provider.Schema; -import org.apache.olingo.commons.api.edm.provider.Singleton; +import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider; +import org.apache.olingo.commons.api.edm.provider.CsdlAction; +import org.apache.olingo.commons.api.edm.provider.CsdlActionImport; +import org.apache.olingo.commons.api.edm.provider.CsdlAliasInfo; +import org.apache.olingo.commons.api.edm.provider.CsdlComplexType; +import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider; +import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer; +import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet; +import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; +import org.apache.olingo.commons.api.edm.provider.CsdlEnumMember; +import org.apache.olingo.commons.api.edm.provider.CsdlEnumType; +import org.apache.olingo.commons.api.edm.provider.CsdlFunction; +import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport; +import org.apache.olingo.commons.api.edm.provider.CsdlParameter; +import org.apache.olingo.commons.api.edm.provider.CsdlProperty; +import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef; +import org.apache.olingo.commons.api.edm.provider.CsdlReturnType; +import org.apache.olingo.commons.api.edm.provider.CsdlSchema; +import org.apache.olingo.commons.api.edm.provider.CsdlSingleton; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl; import org.apache.olingo.server.api.OData; @@ -212,7 +212,7 @@ public class MetadataDocumentXmlSerializerTest { @Test public void aliasTest() throws Exception { - EdmProvider provider = new LocalProvider(); + CsdlEdmProvider provider = new LocalProvider(); ServiceMetadata serviceMetadata = new ServiceMetadataImpl(provider, Collections.<EdmxReference> emptyList()); InputStream metadataStream = serializer.metadataDocument(serviceMetadata).getContent(); String metadata = IOUtils.toString(metadataStream); @@ -240,14 +240,14 @@ public class MetadataDocumentXmlSerializerTest { List<EdmComplexType> complexTypes = new ArrayList<EdmComplexType>(); FullQualifiedName name = new FullQualifiedName("namespace", "ComplexType"); - ComplexType complexType = new ComplexType(); + CsdlComplexType complexType = new CsdlComplexType(); complexType.setAbstract(true); complexType.setName(name.getName()); complexType.setOpenType(true); - List<Property> properties = new ArrayList<Property>(); + List<CsdlProperty> properties = new ArrayList<CsdlProperty>(); - properties.add(new Property().setName("prop1").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())); - properties.add(new Property().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())); + properties.add(new CsdlProperty().setName("prop1").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())); + properties.add(new CsdlProperty().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())); complexType.setProperties(properties); EdmComplexTypeImpl c1 = new EdmComplexTypeImpl(edm, name, complexType); @@ -263,7 +263,7 @@ public class MetadataDocumentXmlSerializerTest { + "</ComplexType>")); } - private class LocalProvider extends AbstractEdmProvider { + private class LocalProvider extends CsdlAbstractEdmProvider { private final static String nameSpace = "namespace"; private final FullQualifiedName nameETAbstract = new FullQualifiedName(nameSpace, "ETAbstract"); @@ -272,11 +272,11 @@ public class MetadataDocumentXmlSerializerTest { private final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName(); private final FullQualifiedName nameString = EdmPrimitiveTypeKind.String.getFullQualifiedName(); private final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam"); - private final Property propertyInt16_NotNullable = new Property() + private final CsdlProperty propertyInt16_NotNullable = new CsdlProperty() .setName("PropertyInt16") .setType(nameInt16) .setNullable(false); - private final Property propertyString = new Property() + private final CsdlProperty propertyString = new CsdlProperty() .setName("PropertyString") .setType(nameString); @@ -287,35 +287,35 @@ public class MetadataDocumentXmlSerializerTest { private final FullQualifiedName nameENString = new FullQualifiedName(nameSpace, "ENString"); @Override - public List<AliasInfo> getAliasInfos() throws ODataException { + public List<CsdlAliasInfo> getAliasInfos() throws ODataException { return Arrays.asList( - new AliasInfo().setAlias("Alias").setNamespace(nameSpace) + new CsdlAliasInfo().setAlias("Alias").setNamespace(nameSpace) ); } @Override - public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException { - return new EnumType() + public CsdlEnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException { + return new CsdlEnumType() .setName("ENString") .setFlags(true) .setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()) .setMembers(Arrays.asList( - new EnumMember().setName("String1").setValue("1"))); + new CsdlEnumMember().setName("String1").setValue("1"))); } @Override - public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { + public CsdlEntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { if (entityTypeName.equals(nameETAbstract)) { - return new EntityType() + return new CsdlEntityType() .setName("ETAbstract") .setAbstract(true) .setProperties(Arrays.asList(propertyString)); } else if (entityTypeName.equals(nameETAbstractBase)) { - return new EntityType() + return new CsdlEntityType() .setName("ETAbstractBase") .setBaseType(nameETAbstract) - .setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16"))) + .setKey(Arrays.asList(new CsdlPropertyRef().setName("PropertyInt16"))) .setProperties(Arrays.asList( propertyInt16_NotNullable)); } @@ -323,15 +323,15 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { + public CsdlComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { if (complexTypeName.equals(nameCTTwoPrim)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTTwoPrim") .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString)); } if (complexTypeName.equals(nameCTTwoPrimBase)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTTwoPrimBase") .setBaseType(nameCTTwoPrim) .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString)); @@ -342,14 +342,14 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public List<Action> getActions(final FullQualifiedName actionName) throws ODataException { + public List<CsdlAction> getActions(final FullQualifiedName actionName) throws ODataException { if (actionName.equals(nameUARTPrimParam)) { return Arrays.asList( - new Action().setName("UARTPrimParam") + new CsdlAction().setName("UARTPrimParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(nameInt16))) + new CsdlParameter().setName("ParameterInt16").setType(nameInt16))) - .setReturnType(new ReturnType().setType(nameString)) + .setReturnType(new CsdlReturnType().setType(nameString)) ); } @@ -357,14 +357,14 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException { + public List<CsdlFunction> getFunctions(final FullQualifiedName functionName) throws ODataException { if (functionName.equals(nameUFNRTInt16)) { return Arrays.asList( - new Function() + new CsdlFunction() .setName("UFNRTInt16") - .setParameters(new ArrayList<Parameter>()) + .setParameters(new ArrayList<CsdlParameter>()) .setReturnType( - new ReturnType().setType(nameInt16)) + new CsdlReturnType().setType(nameInt16)) ); } @@ -372,10 +372,10 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName) + public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName) throws ODataException { if (entitySetName.equals("ESAllPrim")) { - return new EntitySet() + return new CsdlEntitySet() .setName("ESAllPrim") .setType(nameETAbstractBase); @@ -384,10 +384,10 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName) + public CsdlSingleton getSingleton(final FullQualifiedName entityContainer, final String singletonName) throws ODataException { if (singletonName.equals("SI")) { - return new Singleton() + return new CsdlSingleton() .setName("SI") .setType(nameETAbstractBase); @@ -396,11 +396,11 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName) + public CsdlActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName) throws ODataException { if (entityContainer.equals(nameContainer)) { if (actionImportName.equals("AIRTPrimParam")) { - return new ActionImport() + return new CsdlActionImport() .setName("AIRTPrimParam") .setAction(nameUARTPrimParam); @@ -410,11 +410,12 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName) + public CsdlFunctionImport getFunctionImport(final FullQualifiedName entityContainer, + final String functionImportName) throws ODataException { if (entityContainer.equals(nameContainer)) { if (functionImportName.equals("FINRTInt16")) { - return new FunctionImport() + return new CsdlFunctionImport() .setName("FINRTInt16") .setFunction(nameUFNRTInt16) .setIncludeInServiceDocument(true); @@ -425,25 +426,25 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public List<Schema> getSchemas() throws ODataException { - List<Schema> schemas = new ArrayList<Schema>(); - Schema schema = new Schema(); + public List<CsdlSchema> getSchemas() throws ODataException { + List<CsdlSchema> schemas = new ArrayList<CsdlSchema>(); + CsdlSchema schema = new CsdlSchema(); schema.setNamespace(nameSpace); schema.setAlias("Alias"); schemas.add(schema); // EnumTypes - List<EnumType> enumTypes = new ArrayList<EnumType>(); + List<CsdlEnumType> enumTypes = new ArrayList<CsdlEnumType>(); schema.setEnumTypes(enumTypes); enumTypes.add(getEnumType(nameENString)); // EntityTypes - List<EntityType> entityTypes = new ArrayList<EntityType>(); + List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>(); schema.setEntityTypes(entityTypes); entityTypes.add(getEntityType(nameETAbstract)); entityTypes.add(getEntityType(nameETAbstractBase)); // ComplexTypes - List<ComplexType> complexType = new ArrayList<ComplexType>(); + List<CsdlComplexType> complexType = new ArrayList<CsdlComplexType>(); schema.setComplexTypes(complexType); complexType.add(getComplexType(nameCTTwoPrim)); complexType.add(getComplexType(nameCTTwoPrimBase)); @@ -451,12 +452,12 @@ public class MetadataDocumentXmlSerializerTest { // TypeDefinitions // Actions - List<Action> actions = new ArrayList<Action>(); + List<CsdlAction> actions = new ArrayList<CsdlAction>(); schema.setActions(actions); actions.addAll(getActions(nameUARTPrimParam)); // Functions - List<Function> functions = new ArrayList<Function>(); + List<CsdlFunction> functions = new ArrayList<CsdlFunction>(); schema.setFunctions(functions); functions.addAll(getFunctions(nameUFNRTInt16)); @@ -468,27 +469,27 @@ public class MetadataDocumentXmlSerializerTest { } @Override - public EntityContainer getEntityContainer() throws ODataException { - EntityContainer container = new EntityContainer(); + public CsdlEntityContainer getEntityContainer() throws ODataException { + CsdlEntityContainer container = new CsdlEntityContainer(); container.setName("container"); // EntitySets - List<EntitySet> entitySets = new ArrayList<EntitySet>(); + List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>(); container.setEntitySets(entitySets); entitySets.add(getEntitySet(nameContainer, "ESAllPrim")); // Singletons - List<Singleton> singletons = new ArrayList<Singleton>(); + List<CsdlSingleton> singletons = new ArrayList<CsdlSingleton>(); container.setSingletons(singletons); singletons.add(getSingleton(nameContainer, "SI")); // ActionImports - List<ActionImport> actionImports = new ArrayList<ActionImport>(); + List<CsdlActionImport> actionImports = new ArrayList<CsdlActionImport>(); container.setActionImports(actionImports); actionImports.add(getActionImport(nameContainer, "AIRTPrimParam")); // FunctionImports - List<FunctionImport> functionImports = new ArrayList<FunctionImport>(); + List<CsdlFunctionImport> functionImports = new ArrayList<CsdlFunctionImport>(); container.setFunctionImports(functionImports); functionImports.add(getFunctionImport(nameContainer, "FINRTInt16")); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java index 6426327..a7ecb9f 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java @@ -24,9 +24,9 @@ import java.util.List; import org.apache.olingo.commons.api.ODataException; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.Action; -import org.apache.olingo.commons.api.edm.provider.Parameter; -import org.apache.olingo.commons.api.edm.provider.ReturnType; +import org.apache.olingo.commons.api.edm.provider.CsdlAction; +import org.apache.olingo.commons.api.edm.provider.CsdlParameter; +import org.apache.olingo.commons.api.edm.provider.CsdlReturnType; public class ActionProvider { @@ -79,176 +79,176 @@ public class ActionProvider { new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTTwoParam"); - public List<Action> getActions(final FullQualifiedName actionName) throws ODataException { + public List<CsdlAction> getActions(final FullQualifiedName actionName) throws ODataException { if (actionName.equals(nameUARTString)) { return Collections.singletonList( - new Action().setName(nameUARTString.getName()) - .setReturnType(new ReturnType().setType(PropertyProvider.nameString))); + new CsdlAction().setName(nameUARTString.getName()) + .setReturnType(new CsdlReturnType().setType(PropertyProvider.nameString))); } else if (actionName.equals(nameUARTCollStringTwoParam)) { return Collections.singletonList( - new Action().setName(nameUARTCollStringTwoParam.getName()) + new CsdlAction().setName(nameUARTCollStringTwoParam.getName()) .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16), - new Parameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration))) - .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setCollection(true))); + new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16), + new CsdlParameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration))) + .setReturnType(new CsdlReturnType().setType(PropertyProvider.nameString).setCollection(true))); } else if (actionName.equals(nameUARTCTTwoPrimParam)) { return Collections.singletonList( - new Action().setName(nameUARTCTTwoPrimParam.getName()) + new CsdlAction().setName(nameUARTCTTwoPrimParam.getName()) .setParameters(Collections.singletonList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16) + new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16) .setNullable(false))) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))); + new CsdlReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))); } else if (actionName.equals(nameUARTCollCTTwoPrimParam)) { return Collections.singletonList( - new Action().setName(nameUARTCollCTTwoPrimParam.getName()) + new CsdlAction().setName(nameUARTCollCTTwoPrimParam.getName()) .setParameters(Collections.singletonList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))); + new CsdlReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))); } else if (actionName.equals(nameUARTETTwoKeyTwoPrimParam)) { return Collections.singletonList( - new Action().setName(nameUARTETTwoKeyTwoPrimParam.getName()) + new CsdlAction().setName(nameUARTETTwoKeyTwoPrimParam.getName()) .setParameters(Collections.singletonList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim))); + new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim))); } else if (actionName.equals(nameUARTCollETKeyNavParam)) { return Collections.singletonList( - new Action().setName(nameUARTCollETKeyNavParam.getName()) + new CsdlAction().setName(nameUARTCollETKeyNavParam.getName()) .setParameters(Collections.singletonList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))); + new CsdlReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))); } else if (actionName.equals(nameUARTETAllPrimParam)) { return Collections.singletonList( - new Action().setName(nameUARTETAllPrimParam.getName()) + new CsdlAction().setName(nameUARTETAllPrimParam.getName()) .setParameters(Collections.singletonList( - new Parameter().setName("ParameterDate").setType(PropertyProvider.nameDate))) + new CsdlParameter().setName("ParameterDate").setType(PropertyProvider.nameDate))) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim))); + new CsdlReturnType().setType(EntityTypeProvider.nameETAllPrim))); } else if (actionName.equals(nameUARTCollETAllPrimParam)) { return Collections.singletonList( - new Action().setName(nameUARTCollETAllPrimParam.getName()) + new CsdlAction().setName(nameUARTCollETAllPrimParam.getName()) .setParameters(Collections.singletonList( - new Parameter().setName("ParameterTimeOfDay") + new CsdlParameter().setName("ParameterTimeOfDay") .setType(PropertyProvider.nameTimeOfDay))) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true))); + new CsdlReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true))); } else if (actionName.equals(nameUART)) { - return Collections.singletonList(new Action().setName(nameUART.getName())); + return Collections.singletonList(new CsdlAction().setName(nameUART.getName())); } else if (actionName.equals(nameUARTParam)) { return Collections.singletonList( - new Action() + new CsdlAction() .setName(nameUARTParam.getName()) .setParameters(Collections.singletonList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))); + new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))); } else if (actionName.equals(nameUARTTwoParam)) { return Collections.singletonList( - new Action() + new CsdlAction() .setName(nameUARTTwoParam.getName()) .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16), - new Parameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration)))); + new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16), + new CsdlParameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration)))); } else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) { return Arrays.asList( - new Action().setName("BAETTwoKeyNavRTETTwoKeyNav") + new CsdlAction().setName("BAETTwoKeyNavRTETTwoKeyNav") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) + new CsdlParameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) .setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) + new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) , - new Action().setName("BAETTwoKeyNavRTETTwoKeyNav") + new CsdlAction().setName("BAETTwoKeyNavRTETTwoKeyNav") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav) + new CsdlParameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav) .setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) + new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) ); } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) { return Arrays.asList( - new Action().setName("BAESAllPrimRTETAllPrim") + new CsdlAction().setName("BAESAllPrimRTETAllPrim") .setParameters(Arrays.asList( - new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim) + new CsdlParameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim) .setCollection(true).setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim))); + new CsdlReturnType().setType(EntityTypeProvider.nameETAllPrim))); } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) { return Arrays.asList( - new Action().setName("BAESTwoKeyNavRTESTwoKeyNav") + new CsdlAction().setName("BAESTwoKeyNavRTESTwoKeyNav") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) + new CsdlParameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) .setCollection(true).setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))); + new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))); } else if(actionName.equals(nameBAESTwoKeyNavRTESKeyNav)) { return Arrays.asList( - new Action().setName("BAESTwoKeyNavRTESKeyNav") + new CsdlAction().setName("BAESTwoKeyNavRTESKeyNav") .setBound(true) .setEntitySetPath("BindingParam/NavPropertyETKeyNavMany") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav") + new CsdlParameter().setName("ParameterETTwoKeyNav") .setType(EntityTypeProvider.nameETTwoKeyNav) .setCollection(true) .setNullable(false))) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))); + new CsdlReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))); } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) { return Arrays.asList( - new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav") + new CsdlAction().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + new CsdlParameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav) .setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))); + new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))); } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) { return Arrays.asList( - new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav") + new CsdlAction().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoBaseTwoKeyNav") + new CsdlParameter().setName("ParameterETTwoBaseTwoKeyNav") .setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav) .setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav))); + new CsdlReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav))); } else if(actionName.equals(nameBAETAllPrimRT)) { return Arrays.asList( - new Action().setName("BAETAllPrimRT") + new CsdlAction().setName("BAETAllPrimRT") .setBound(true) .setParameters(Arrays.asList( - new Parameter().setName("ParameterETAllPrim") + new CsdlParameter().setName("ParameterETAllPrim") .setNullable(false) .setType(EntityTypeProvider.nameETAllPrim) ))); } else if(actionName.equals(nameBAESAllPrimRT)) { return Arrays.asList( - new Action().setName("BAESAllPrimRT") + new CsdlAction().setName("BAESAllPrimRT") .setBound(true) .setParameters(Arrays.asList( - new Parameter().setName("ParameterETAllPrim") + new CsdlParameter().setName("ParameterETAllPrim") .setNullable(false) .setCollection(true) .setType(EntityTypeProvider.nameETAllPrim) http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2318953c/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java index b8b4895..819c19f 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java @@ -23,9 +23,9 @@ import java.util.Arrays; import org.apache.olingo.commons.api.ODataException; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.ComplexType; -import org.apache.olingo.commons.api.edm.provider.NavigationProperty; -import org.apache.olingo.commons.api.edm.provider.Property; +import org.apache.olingo.commons.api.edm.provider.CsdlComplexType; +import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; +import org.apache.olingo.commons.api.edm.provider.CsdlProperty; public class ComplexTypeProvider { @@ -54,15 +54,15 @@ public class ComplexTypeProvider { "CTMixEnumDef"); public static final FullQualifiedName nameCTNavCont = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTNavCont"); - public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { + public CsdlComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { if (complexTypeName.equals(nameCTPrim)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTPrim") .setProperties(Arrays.asList(PropertyProvider.propertyInt16)); } else if (complexTypeName.equals(nameCTAllPrim)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTAllPrim") .setProperties( Arrays.asList(PropertyProvider.propertyString, PropertyProvider.propertyBinary, @@ -73,7 +73,7 @@ public class ComplexTypeProvider { PropertyProvider.propertyInt64, PropertyProvider.propertySByte, PropertyProvider.propertyTimeOfDay_Precision)); } else if (complexTypeName.equals(nameCTCollAllPrim)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTCollAllPrim") .setProperties( Arrays.asList( @@ -88,72 +88,72 @@ public class ComplexTypeProvider { )); } else if (complexTypeName.equals(nameCTTwoPrim)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTTwoPrim") .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable)); } else if (complexTypeName.equals(nameCTCompNav)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTCompNav") .setProperties(Arrays.asList(PropertyProvider.propertyString, PropertyProvider.propertyCompNav_CTNavFiveProp)); } else if (complexTypeName.equals(nameCTMixPrimCollComp)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTMixPrimCollComp") .setProperties( Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.collPropertyString, PropertyProvider.propertyComp_CTTwoPrim, PropertyProvider.collPropertyComp_CTTwoPrim)); } else if (complexTypeName.equals(nameCTBase)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTBase") .setBaseType(nameCTTwoPrim) .setProperties(Arrays.asList( - new Property() + new CsdlProperty() .setName("AdditionalPropString") .setType(new FullQualifiedName("Edm", "String")))); } else if (complexTypeName.equals(nameCTTwoBase)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTTwoBase") .setBaseType(nameCTBase); } else if (complexTypeName.equals(nameCTCompComp)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTCompComp") .setProperties(Arrays.asList(PropertyProvider.propertyComp_CTTwoPrim)); } else if (complexTypeName.equals(nameCTCompCollComp)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTCompCollComp") .setProperties(Arrays.asList(PropertyProvider.collPropertyComp_CTTwoPrim)); } else if (complexTypeName.equals(nameCTPrimComp)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTPrimComp") .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyComp_CTAllPrim)); } else if (complexTypeName.equals(nameCTNavFiveProp)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTNavFiveProp") .setProperties(Arrays.asList(PropertyProvider.propertyInt16)) .setNavigationProperties((Arrays.asList( PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav, PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav_WithPartnerERKeyNavOne, - new NavigationProperty() + new CsdlNavigationProperty() .setName("NavPropertyETMediaOne") .setType(EntityTypeProvider.nameETMedia), - new NavigationProperty() + new CsdlNavigationProperty() .setName("NavPropertyETMediaMany") .setType(EntityTypeProvider.nameETMedia).setCollection(true) ))); } else if (complexTypeName.equals(nameCTNavCont)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTNavCont") - .setProperties(new ArrayList<Property>()) + .setProperties(new ArrayList<CsdlProperty>()) .setNavigationProperties(Arrays.asList( PropertyProvider.collectionNavPropertyETKeyNavContMany_CT_ETKeyNav, PropertyProvider.navPropertyETKeyNavContOne_CT_ETeyNav, @@ -161,7 +161,7 @@ public class ComplexTypeProvider { PropertyProvider.navPropertyETTwoKeyNavContOne_CT_ETKeyNav)); } else if (complexTypeName.equals(nameCTBasePrimCompNav)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTBasePrimCompNav") .setBaseType(nameCTPrimComp) .setNavigationProperties(Arrays.asList( @@ -171,12 +171,12 @@ public class ComplexTypeProvider { PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav)); } else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) { - return new ComplexType() + return new CsdlComplexType() .setName("CTTwoBasePrimCompNav") .setBaseType(nameCTBasePrimCompNav); } else if (complexTypeName.equals(nameCTMixEnumDef)) { - return new ComplexType() + return new CsdlComplexType() .setName(nameCTMixEnumDef.getName()) .setProperties(Arrays.asList( PropertyProvider.propertyEnumString_ENString_Nullable,
