From 554c795e4c5f7999d49ba99e2c92a2cb41f31658 Mon Sep 17 00:00:00 2001 From: Stephan Klevenz Date: Fri, 9 May 2014 11:09:55 +0200 Subject: [PATCH 1/7] [OLINGO-266] move provider and test to ref module --- lib/ref/pom.xml | 43 +- .../core/testutil/EdmTechTestProvider.java | 0 .../server/core/testutil/StringUtils.java | 0 .../testutil/techprovider/ActionProvider.java | 0 .../techprovider/ComplexTypeProvider.java | 0 .../techprovider/ContainerProvider.java | 0 .../techprovider/EdmTechProvider.java | 0 .../techprovider/EntityTypeProvider.java | 0 .../techprovider/EnumTypeProvider.java | 0 .../techprovider/FunctionProvider.java | 0 .../techprovider/PropertyProvider.java | 0 .../testutil/techprovider/SchemaProvider.java | 0 .../techprovider/TypeDefinitionProvider.java | 0 .../serializer/json/ServiceDocumentTest.java | 0 .../serializer/xml/MetadataDocumentTest.java | 0 .../olingo/server/core/uri/RawUriTest.java | 0 .../server/core/uri/UriInfoImplTest.java | 0 .../server/core/uri/UriResourceImplTest.java | 0 .../core/uri/antlr/TestFullResourcePath.java | 0 .../server/core/uri/antlr/TestLexer.java | 0 .../core/uri/antlr/TestUriParserImpl.java | 0 .../core/uri/queryoption/QueryOptionTest.java | 0 .../expression/ExpressionTest.java | 0 .../core/uri/testutil/ExpandValidator.java | 0 .../core/uri/testutil/FilterTreeToText.java | 0 .../core/uri/testutil/FilterValidator.java | 0 .../core/uri/testutil/ParseTreeToText.java | 0 .../core/uri/testutil/ParserValidator.java | 0 .../core/uri/testutil/ParserWithLogging.java | 0 .../core/uri/testutil/ResourceValidator.java | 0 .../core/uri/testutil/TestErrorLogger.java | 0 .../core/uri/testutil/TestUriValidator.java | 0 .../core/uri/testutil/TestValidator.java | 0 .../core/uri/testutil/TokenValidator.java | 0 .../core/uri/testutil/UriLexerWithTrace.java | 0 .../core/uri/validator/UriValidatorTest.java | 2 +- .../server/core/testutil/EdmTechProvider.java | 1976 ----------------- 37 files changed, 28 insertions(+), 1993 deletions(-) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/StringUtils.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java (100%) rename lib/{server-core/src/test => ref/src/main}/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java (100%) rename lib/{server-core => ref}/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java (99%) delete mode 100644 lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java diff --git a/lib/ref/pom.xml b/lib/ref/pom.xml index c92841889..fe1da602c 100644 --- a/lib/ref/pom.xml +++ b/lib/ref/pom.xml @@ -1,26 +1,26 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 olingo-ref @@ -42,9 +42,20 @@ org.apache.olingo - olingo-client-api + olingo-server-core ${project.version} + runtime + + + junit + junit + + + org.mockito + mockito-all + + diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/StringUtils.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/StringUtils.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java b/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java rename to lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java similarity index 100% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java similarity index 99% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java rename to lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java index c3c24662c..0374b25af 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java +++ b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java @@ -26,7 +26,7 @@ import java.util.ArrayList; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.server.api.uri.UriInfo; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechProvider; +import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider; import org.apache.olingo.server.core.uri.parser.Parser; import org.apache.olingo.server.core.uri.parser.UriParserException; import org.junit.Before; diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java deleted file mode 100644 index ff3e537b5..000000000 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java +++ /dev/null @@ -1,1976 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.server.core.testutil; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.olingo.commons.api.ODataException; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.Target; -import org.apache.olingo.server.api.edm.provider.Action; -import org.apache.olingo.server.api.edm.provider.ActionImport; -import org.apache.olingo.server.api.edm.provider.AliasInfo; -import org.apache.olingo.server.api.edm.provider.ComplexType; -import org.apache.olingo.server.api.edm.provider.EdmProvider; -import org.apache.olingo.server.api.edm.provider.EntityContainerInfo; -import org.apache.olingo.server.api.edm.provider.EntitySet; -import org.apache.olingo.server.api.edm.provider.EntityType; -import org.apache.olingo.server.api.edm.provider.EnumMember; -import org.apache.olingo.server.api.edm.provider.EnumType; -import org.apache.olingo.server.api.edm.provider.Function; -import org.apache.olingo.server.api.edm.provider.FunctionImport; -import org.apache.olingo.server.api.edm.provider.NavigationProperty; -import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding; -import org.apache.olingo.server.api.edm.provider.Parameter; -import org.apache.olingo.server.api.edm.provider.Property; -import org.apache.olingo.server.api.edm.provider.PropertyRef; -import org.apache.olingo.server.api.edm.provider.ReferentialConstraint; -import org.apache.olingo.server.api.edm.provider.ReturnType; -import org.apache.olingo.server.api.edm.provider.Singleton; - -public class EdmTechProvider extends EdmProvider { - - public static final String nameSpace = "com.sap.odata.test1"; - - public static final FullQualifiedName nameBAESAllPrimRTETAllPrim = - new FullQualifiedName(nameSpace, "BAESAllPrimRTETAllPrim"); - - public static final FullQualifiedName nameBAESTwoKeyNavRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BAESTwoKeyNavRTESTwoKeyNav"); - - public static final FullQualifiedName nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav = - new FullQualifiedName(nameSpace, "BAETBaseTwoKeyNavRTETBaseTwoKeyNav"); - - public static final FullQualifiedName nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav = - new FullQualifiedName(nameSpace, "BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav"); - - public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav = - new FullQualifiedName(nameSpace, "BAETTwoKeyNavRTETTwoKeyNav"); - - public static final FullQualifiedName nameBFCCollCTPrimCompRTESAllPrim = - new FullQualifiedName(nameSpace, "BFCCollCTPrimCompRTESAllPrim"); - - public static final FullQualifiedName nameBFCCollStringRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCCollStringRTESTwoKeyNav"); - - public static final FullQualifiedName nameBFCCTPrimCompRTESBaseTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESBaseTwoKeyNav"); - - public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESTwoKeyNav"); - - public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNavParam = - new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESTwoKeyNavParam"); - - public static final FullQualifiedName nameBFCCTPrimCompRTETTwoKeyNavParam = - new FullQualifiedName(nameSpace, "BFCCTPrimCompRTETTwoKeyNavParam"); - - public static final FullQualifiedName nameBFCESAllPrimRTCTAllPrim = - new FullQualifiedName(nameSpace, "BFCESAllPrimRTCTAllPrim"); - - public static final FullQualifiedName nameBFCESBaseTwoKeyNavRTESBaseTwoKey = - new FullQualifiedName(nameSpace, "BFCESBaseTwoKeyNavRTESBaseTwoKey"); - - public static final FullQualifiedName nameBFCESKeyNavRTETKeyNav = - new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNav"); - - public static final FullQualifiedName nameBFCESKeyNavRTETKeyNavParam = - new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNavParam"); - - public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTTwoPrim = - new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollCTTwoPrim"); - - public static final FullQualifiedName nameBFCESTwoKeyNavRTCollString = - new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollString"); - - public static final FullQualifiedName nameBFCESTwoKeyNavRTCTTwoPrim = - new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCTTwoPrim"); - - public static final FullQualifiedName nameBFCESTwoKeyNavRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTESTwoKeyNav"); - - public static final FullQualifiedName nameBFCESTwoKeyNavRTString = - new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTString"); - - public static final FullQualifiedName nameBFCESTwoKeyNavRTStringParam = - new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTStringParam"); - - public static final FullQualifiedName nameBFCESTwoKeyNavRTTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTTwoKeyNav"); - - public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESBaseTwoKey = - new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESBaseTwoKey"); - - public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESTwoKeyNav"); - - public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTETTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTETTwoKeyNav"); - - public static final FullQualifiedName nameBFCETKeyNavRTETKeyNav = - new FullQualifiedName(nameSpace, "BFCETKeyNavRTETKeyNav"); - - public static final FullQualifiedName nameBFCETTwoKeyNavRTCTTwoPrim = - new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTCTTwoPrim"); - - public static final FullQualifiedName nameBFCETTwoKeyNavRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTESTwoKeyNav"); - - public static final FullQualifiedName nameBFCETTwoKeyNavRTETTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTETTwoKeyNav"); - - public static final FullQualifiedName nameBFCSINavRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCSINavRTESTwoKeyNav"); - - public static final FullQualifiedName nameBFCStringRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BFCStringRTESTwoKeyNav"); - - public static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav = - new FullQualifiedName(nameSpace, "BFESTwoKeyNavRTESTwoKeyNav"); - - public static final FullQualifiedName nameBinary = EdmPrimitiveTypeKind.Binary.getFullQualifiedName(); - public static final FullQualifiedName nameBoolean = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName(); - public static final FullQualifiedName nameByte = EdmPrimitiveTypeKind.Byte.getFullQualifiedName(); - public static final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "Container"); - public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(nameSpace, "CTAllPrim"); - public static final FullQualifiedName nameCTBase = new FullQualifiedName(nameSpace, "CTBase"); - public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(nameSpace, "CTBasePrimCompNav"); - public static final FullQualifiedName nameCTCollAllPrim = new FullQualifiedName(nameSpace, "CTCollAllPrim"); - public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(nameSpace, "CTCompCollComp"); - public static final FullQualifiedName nameCTCompComp = new FullQualifiedName(nameSpace, "CTCompComp"); - public static final FullQualifiedName nameCTCompNav = new FullQualifiedName(nameSpace, "CTCompNav"); - - public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(nameSpace, "CTMixPrimCollComp"); - public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(nameSpace, "CTNavFiveProp"); - public static final FullQualifiedName nameCTPrim = new FullQualifiedName(nameSpace, "CTPrim"); - public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(nameSpace, "CTPrimComp"); - public static final FullQualifiedName nameCTPrimEnum = new FullQualifiedName(nameSpace, "CTPrimEnum"); - public static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(nameSpace, "CTTwoBase"); - public static final FullQualifiedName nameCTTwoBasePrimCompNav = - new FullQualifiedName(nameSpace, "CTTwoBasePrimCompNav"); - public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(nameSpace, "CTTwoPrim"); - public static final FullQualifiedName nameDate = EdmPrimitiveTypeKind.Date.getFullQualifiedName(); - public static final FullQualifiedName nameDateTimeOffset = - EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName(); - - public static final FullQualifiedName nameDecimal = EdmPrimitiveTypeKind.Decimal.getFullQualifiedName(); - public static final FullQualifiedName nameDouble = EdmPrimitiveTypeKind.Double.getFullQualifiedName(); - public static final FullQualifiedName nameDuration = EdmPrimitiveTypeKind.Duration.getFullQualifiedName(); - public static final FullQualifiedName nameENString = new FullQualifiedName(nameSpace, "ENString"); - public static final FullQualifiedName nameETAllKey = new FullQualifiedName(nameSpace, "ETAllKey"); - public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(nameSpace, "ETAllNullable"); - public static final FullQualifiedName nameETAllPrim = new FullQualifiedName(nameSpace, "ETAllPrim"); - public static final FullQualifiedName nameETBase = new FullQualifiedName(nameSpace, "ETBase"); - public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(nameSpace, "ETBaseTwoKeyNav"); - public static final FullQualifiedName nameETBaseTwoKeyTwoPrim = - new FullQualifiedName(nameSpace, "ETBaseTwoKeyTwoPrim"); - public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(nameSpace, "ETCollAllPrim"); - public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(nameSpace, "ETCompAllPrim"); - public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(nameSpace, "ETCompCollAllPrim"); - public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(nameSpace, "ETCompCollComp"); - public static final FullQualifiedName nameETCompComp = new FullQualifiedName(nameSpace, "ETCompComp"); - public static final FullQualifiedName nameETCompMixPrimCollComp = - new FullQualifiedName(nameSpace, "ETCompMixPrimCollComp"); - public static final FullQualifiedName nameETFourKeyAlias = new FullQualifiedName(nameSpace, "ETFourKeyAlias"); - public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(nameSpace, "ETKeyNav"); - public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(nameSpace, "ETKeyPrimNav"); - public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(nameSpace, "ETKeyTwoKeyComp"); - public static final FullQualifiedName nameETMedia = new FullQualifiedName(nameSpace, "ETMedia"); - public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(nameSpace, "ETMixPrimCollComp"); - public static final FullQualifiedName nameETServerSidePaging = - new FullQualifiedName(nameSpace, "ETServerSidePaging"); - public static final FullQualifiedName nameETTwoBase = new FullQualifiedName(nameSpace, "ETTwoBase"); - public static final FullQualifiedName nameETTwoBaseTwoKeyNav = - new FullQualifiedName(nameSpace, "ETTwoBaseTwoKeyNav"); - public static final FullQualifiedName nameETTwoBaseTwoKeyTwoPrim = - new FullQualifiedName(nameSpace, "ETTwoBaseTwoKeyTwoPrim"); - public static final FullQualifiedName nameETTwoKeyNav = new FullQualifiedName(nameSpace, "ETTwoKeyNav"); - public static final FullQualifiedName nameETTwoKeyTwoPrim = new FullQualifiedName(nameSpace, "ETTwoKeyTwoPrim"); - public static final FullQualifiedName nameETTwoPrim = new FullQualifiedName(nameSpace, "ETTwoPrim"); - public static final FullQualifiedName nameGuid = EdmPrimitiveTypeKind.Guid.getFullQualifiedName(); - public static final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName(); - public static final FullQualifiedName nameInt32 = EdmPrimitiveTypeKind.Int32.getFullQualifiedName(); - public static final FullQualifiedName nameInt64 = EdmPrimitiveTypeKind.Int64.getFullQualifiedName(); - - public static final FullQualifiedName nameSByte = EdmPrimitiveTypeKind.SByte.getFullQualifiedName(); - public static final FullQualifiedName nameSingle = EdmPrimitiveTypeKind.Single.getFullQualifiedName(); - - public static final FullQualifiedName nameString = EdmPrimitiveTypeKind.String.getFullQualifiedName(); - public static final FullQualifiedName nameTimeOfDay = EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName(); - public static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(nameSpace, "UARTCompCollParam"); - public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(nameSpace, "UARTCompParam"); - public static final FullQualifiedName nameUARTETCollAllPrimParam = - new FullQualifiedName(nameSpace, "UARTETCollAllPrimParam"); - - public static final FullQualifiedName nameUARTETParam = new FullQualifiedName(nameSpace, "UARTETParam"); - public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam"); - public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(nameSpace, "UARTPrimCollParam"); - public static final FullQualifiedName nameUFCRTCollCTTwoPrim = - new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrim"); - public static final FullQualifiedName nameUFCRTCollCTTwoPrimParam = - new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrimParam"); - public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(nameSpace, "UFCRTCollString"); - public static final FullQualifiedName nameUFCRTCollStringTwoParam = - new FullQualifiedName(nameSpace, "UFCRTCollStringTwoParam"); - public static final FullQualifiedName nameUFCRTCTAllPrimTwoParam = - new FullQualifiedName(nameSpace, "UFCRTCTAllPrimTwoParam"); - public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(nameSpace, "UFCRTCTTwoPrim"); - public static final FullQualifiedName nameUFCRTCTTwoPrimParam = - new FullQualifiedName(nameSpace, "UFCRTCTTwoPrimParam"); - public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam = - new FullQualifiedName(nameSpace, "UFCRTESMixPrimCollCompTwoParam"); - public static final FullQualifiedName nameUFCRTESTwoKeyNavParam = - new FullQualifiedName(nameSpace, "UFCRTESTwoKeyNavParam"); - public static final FullQualifiedName nameUFCRTETAllPrimTwoParam = - new FullQualifiedName(nameSpace, "UFCRTETAllPrimTwoParam"); - public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(nameSpace, "UFCRTETKeyNav"); - public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(nameSpace, "UFCRTETMedia"); - - public static final FullQualifiedName nameUFCRTETTwoKeyNavParam = - new FullQualifiedName(nameSpace, "UFCRTETTwoKeyNavParam"); - - public static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim = - new FullQualifiedName(nameSpace, "UFCRTETTwoKeyNavParamCTTwoPrim"); - - public static final FullQualifiedName nameUFCRTString = new FullQualifiedName(nameSpace, "UFCRTString"); - - public static final FullQualifiedName nameUFCRTStringTwoParam = - new FullQualifiedName(nameSpace, "UFCRTStringTwoParam"); - - public static final FullQualifiedName nameUFNRTESMixPrimCollCompTwoParam = - new FullQualifiedName(nameSpace, "UFNRTESMixPrimCollCompTwoParam"); - public static final FullQualifiedName nameUFNRTInt16 = - new FullQualifiedName(nameSpace, "UFNRTInt16"); - - NavigationProperty collectionNavPropertyETKeyNavMany_ETKeyNav = new NavigationProperty() - .setName("NavPropertyETKeyNavMany") - .setType(nameETKeyNav) - .setCollection(true); - - NavigationProperty collectionNavPropertyETMediaMany_ETMedia = new NavigationProperty() - .setName("NavPropertyETMediaMany") - .setType(nameETMedia) - .setCollection(true); - - NavigationProperty collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav = new NavigationProperty() - .setName("NavPropertyETTwoKeyNavMany") - .setType(nameETTwoKeyNav) - .setCollection(true) - .setPartner("NavPropertyETKeyNavOne"); - - NavigationProperty collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty() - .setName("NavPropertyETTwoKeyNavOne") - .setType(nameETTwoKeyNav); - - Property collPropertyBinary = new Property() - .setName("CollPropertyBinary") - .setType(nameBinary) - .setCollection(true); - - Property collPropertyBoolean = new Property() - .setName("CollPropertyBoolean") - .setType(nameBoolean) - .setCollection(true); - - Property collPropertyByte = new Property() - .setName("CollPropertyByte") - .setType(nameByte) - .setCollection(true); - - Property collPropertyComplex_CTPrimComp = new Property() - .setName("CollPropertyComplex") - .setType(nameCTPrimComp) - .setCollection(true); - - Property collPropertyComplex_CTTwoPrim = new Property() - .setName("CollPropertyComplex") - .setType(nameCTTwoPrim) - .setCollection(true); - - Property collPropertyDate = new Property() - .setName("CollPropertyDate") - .setType(nameDate) - .setCollection(true); - - Property collPropertyDateTimeOffset = new Property() - .setName("CollPropertyDateTimeOffset") - .setType(nameDateTimeOffset) - .setCollection(true); - - Property collPropertyDecimal = new Property() - .setName("CollPropertyDecimal") - .setType(nameDecimal) - .setCollection(true); - - Property collPropertyDouble = new Property() - .setName("CollPropertyDouble") - .setType(nameDouble) - .setCollection(true); - - Property collPropertyDuration = new Property() - .setName("CollPropertyDuration") - .setType(nameDuration) - .setCollection(true); - Property collPropertyGuid = new Property() - .setName("CollPropertyGuid") - .setType(nameGuid) - .setCollection(true); - Property collPropertyInt16 = new Property() - .setName("CollPropertyInt16") - .setType(nameInt16) - .setCollection(true); - Property collPropertyInt32 = new Property() - .setName("CollPropertyInt32") - .setType(nameInt32) - .setCollection(true); - Property collPropertyInt64 = new Property() - .setName("CollPropertyInt64") - .setType(nameInt64) - .setCollection(true); - - Property collPropertySByte = new Property() - .setName("CollPropertySByte") - .setType(nameSByte) - .setCollection(true); - - Property collPropertySingle = new Property() - .setName("CollPropertySingle") - .setType(nameSingle) - .setCollection(true); - Property collPropertyString = new Property() - .setName("CollPropertyString") - .setType(nameString) - .setCollection(true); - Property collPropertyTimeOfDay = new Property() - .setName("CollPropertyTimeOfDay") - .setType(nameTimeOfDay) - .setCollection(true); - EntityContainerInfo entityContainerInfoTest1 = - new EntityContainerInfo().setContainerName(nameContainer); - NavigationProperty navPropertyETKeyNavOne_ETKeyNav = new NavigationProperty() - .setName("NavPropertyETKeyNavOne") - .setType(nameETKeyNav); - NavigationProperty navPropertyETMediaOne_ETMedia = new NavigationProperty() - .setName("NavPropertyETMediaOne") - .setType(nameETMedia); - - /* - * TODO add propertyStream - * Property propertyStream = new Property() - * .setName("PropertyStream") - * .setType(EdmStream.getFullQualifiedName()); - */ - - NavigationProperty navPropertyETKeyPrimNavOne = new NavigationProperty() - .setName("NavPropertyETKeyPrimNavOne") - .setType(nameETKeyPrimNav); - - NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty() - .setName("NavPropertyETTwoKeyNavOne") - .setType(nameETTwoKeyNav); - Property propertyBinary = new Property() - .setName("PropertyBinary") - .setType(nameBinary); - Property propertyBoolean = new Property() - .setName("PropertyBoolean") - .setType(nameBoolean); - Property propertyByte = new Property() - .setName("PropertyByte") - .setType(nameByte); - Property propertyComplex_CTAllPrim = new Property() - .setName("PropertyComplex") - .setType(nameCTAllPrim); - Property propertyComplex_CTCollAllPrim = new Property() - .setName("PropertyComplex") - .setType(nameCTCollAllPrim); - Property propertyComplex_CTCompCollComp = new Property() - .setName("PropertyComplex") - .setType(nameCTCompCollComp); - Property propertyComplex_CTCompComp = new Property() - .setName("PropertyComplex") - .setType(nameCTCompComp); - Property propertyComplex_CTNavFiveProp = new Property() - .setName("PropertyComplex") - .setType(nameCTNavFiveProp); - Property propertyComplex_CTPrimComp_NotNullable = new Property() - .setName("PropertyComplex") - .setType(nameCTPrimComp); - Property propertyComplex_CTTwoPrim = new Property() - .setName("PropertyComplex") - .setType(nameCTTwoPrim); - Property propertyComplexAllPrim_CTAllPrim = new Property() - .setName("PropertyComplexAllPrim") - .setType(nameCTAllPrim); - Property propertyComplexComplex_CTCompComp = new Property() - .setName("PropertyComplexComplex") - .setType(nameCTCompComp); - Property propertyComplexEnum_CTPrimEnum_NotNullable = new Property() - .setName("PropertyComplexEnum") - .setType(nameCTPrimEnum); - Property propertyComplexTwoPrim_CTTwoPrim = new Property() - .setName("PropertyComplexTwoPrim") - .setType(nameCTTwoPrim); - Property propertyDate = new Property() - .setName("PropertyDate") - .setType(nameDate); - - Property propertyDateTimeOffset = new Property() - .setName("PropertyDateTimeOffset") - .setType(nameDateTimeOffset); - - Property propertyDecimal = new Property() - .setName("PropertyDecimal") - .setType(nameDecimal); - - Property propertyDouble = new Property() - .setName("PropertyDouble") - .setType(nameDouble); - - Property propertyDuration = new Property() - .setName("PropertyDuration") - .setType(nameDuration); - - Property propertyEnumString_ENString = new Property() - .setName("PropertyEnumString") - .setType(nameENString); - - Property propertyGuid = new Property() - .setName("PropertyGuid") - .setType(nameGuid); - - Property propertyInt16 = new Property() - .setName("PropertyInt16") - .setType(nameInt16); - - Property propertyInt16_NotNullable = new Property() - .setName("PropertyInt16") - .setType(nameInt16); - Property propertyInt32 = new Property() - .setName("PropertyInt32") - .setType(nameInt32); - - Property propertyInt64 = new Property() - .setName("PropertyInt64") - .setType(nameInt64); - - Property propertyMixedPrimCollComp_CTMixPrimCollComp = new Property() - .setName("PropertyMixedPrimCollComp") - .setType(nameCTMixPrimCollComp) - .setCollection(true); - - Property propertySByte = new Property() - .setName("PropertySByte") - .setType(nameSByte); - - Property propertySingle = new Property() - .setName("PropertySingle") - .setType(nameSingle); - - Property propertyString = new Property() - .setName("PropertyString") - .setType(nameString); - - Property propertyString_NotNullable = new Property() - .setName("PropertyString") - .setType(nameString); - - Property propertyTimeOfDay = new Property().setName("PropertyTimeOfDay") - .setType(nameTimeOfDay); - - @Override - public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name) throws ODataException - { - if (entityContainer.equals(nameContainer)) { - if (name.equals("AIRTPrimParam")) { - return new ActionImport() - .setName("AIRTPrimParam") - .setAction(nameUARTPrimParam); - - } else if (name.equals("AIRTPrimCollParam")) { - return new ActionImport() - .setName("AIRTPrimCollParam") - .setAction(nameUARTPrimCollParam); - - } else if (name.equals("AIRTCompParam")) { - return new ActionImport() - .setName("AIRTCompParam") - .setAction(nameUARTCompParam); - - } else if (name.equals("AIRTCompCollParam")) { - return new ActionImport() - .setName("AIRTCompCollParam") - .setAction(nameUARTCompCollParam); - - } else if (name.equals("AIRTETParam")) { - return new ActionImport() - .setName("AIRTETParam") - .setAction(nameUARTETParam); - - } else if (name.equals("AIRTETCollAllPrimParam")) { - return new ActionImport() - .setName("AIRTETCollAllPrimParam") - .setAction(nameUARTETCollAllPrimParam); - } - } - - return null; - } - - @Override - public List getActions(final FullQualifiedName actionName) throws ODataException { - if (actionName.equals(nameUARTPrimParam)) { - return Arrays.asList( - new Action().setName("UARTPrimParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(nameInt16))) - - .setReturnType(new ReturnType().setType(nameString)) - ); - - } else if (actionName.equals(nameUARTPrimCollParam)) { - return Arrays.asList( - new Action().setName("UARTPrimCollParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(nameInt16))) - - .setReturnType( - new ReturnType().setType(nameString).setCollection(true)) - ); - - } else if (actionName.equals(nameUARTCompParam)) { - return Arrays.asList( - new Action().setName("UARTCompParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(nameInt16))) - - .setReturnType( - new ReturnType().setType(nameCTTwoPrim)) - ); - - } else if (actionName.equals(nameUARTCompCollParam)) { - return Arrays.asList( - new Action().setName("UARTCompCollParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(nameInt16))) - - .setReturnType( - new ReturnType().setType(nameCTTwoPrim).setCollection(true)) - ); - - } else if (actionName.equals(nameUARTETParam)) { - return Arrays.asList( - new Action().setName("UARTCompCollParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(nameInt16))) - .setReturnType( - new ReturnType().setType(nameETTwoKeyTwoPrim)) - ); - - } else if (actionName.equals(nameUARTETCollAllPrimParam)) { - return Arrays.asList( - new Action().setName("UARTETCollAllPrimParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(nameInt16))) - - .setReturnType( - new ReturnType().setType(nameETCollAllPrim).setCollection(true)) - ); - - } else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) { - return Arrays.asList( - new Action().setName("BAETTwoKeyNavRTETTwoKeyNav") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(nameETTwoKeyNav))) - .setBound(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav)) - , - new Action().setName("BAETTwoKeyNavRTETTwoKeyNav") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterETKeyNav").setType(nameETKeyNav))) - .setBound(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav)) - ); - - } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) { - return Arrays.asList( - new Action().setName("BAESAllPrimRTETAllPrim") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterESAllPrim").setType(nameETAllPrim).setCollection(true))) - .setBound(true) - .setReturnType( - new ReturnType().setType(nameETAllPrim)) - ); - - } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) { - return Arrays.asList( - new Action().setName("BAESTwoKeyNavRTESTwoKeyNav") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(nameETTwoKeyNav).setCollection(true))) - .setBound(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) { - return Arrays.asList( - new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(nameETBaseTwoKeyNav))) - .setBound(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav)) - ); - - } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) { - return Arrays.asList( - new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType(nameETTwoBaseTwoKeyNav))) - .setBound(true) - .setReturnType( - new ReturnType().setType(nameETBaseTwoKeyNav)) - ); - } - - return null; - } - - @Override - public List getAliasInfos() throws ODataException { - return Arrays.asList( - new AliasInfo().setAlias("Namespace1_Alias").setNamespace(nameSpace) - ); - } - - @Override - public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { - - if (complexTypeName.equals(nameCTPrim)) { - return new ComplexType() - .setName("CTPrim") - .setProperties(Arrays.asList(propertyInt16)); - - } else if (complexTypeName.equals(nameCTAllPrim)) { - return new ComplexType() - .setName("CTAllPrim") - .setProperties(Arrays.asList(propertyString, propertyBinary, propertyBoolean, - propertyByte, propertyDate, propertyDateTimeOffset, - propertyDecimal, propertySingle, propertyDouble, - propertyDuration, propertyGuid, propertyInt16, - propertyInt32, propertyInt64, propertySByte, - propertyTimeOfDay/* TODO add propertyStream */)); - - } else if (complexTypeName.equals(nameCTCollAllPrim)) { - return new ComplexType() - .setName("CTCollAllPrim") - .setProperties(Arrays.asList( - collPropertyString, - collPropertyBoolean, collPropertyByte, - collPropertySByte, - collPropertyInt16, collPropertyInt32, collPropertyInt64, - collPropertySingle, collPropertyDouble, - collPropertyDecimal, collPropertyBinary, - collPropertyDate, collPropertyDateTimeOffset, - collPropertyDuration, collPropertyGuid, - collPropertyTimeOfDay /* TODO add collectionPropertyStream */)); - - } else if (complexTypeName.equals(nameCTTwoPrim)) { - return new ComplexType() - .setName("CTTwoPrim") - .setProperties(Arrays.asList(propertyInt16, propertyString)); - - } else if (complexTypeName.equals(nameCTCompNav)) { - return new ComplexType() - .setName("CTCompNav") - .setProperties(Arrays.asList(propertyInt16, propertyComplex_CTNavFiveProp)); - - } else if (complexTypeName.equals(nameCTMixPrimCollComp)) { - return new ComplexType() - .setName("CTMixPrimCollComp") - .setProperties(Arrays.asList( - propertyInt16, collPropertyString, propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim)); - - } else if (complexTypeName.equals(nameCTBase)) { - return new ComplexType() - .setName("CTBase") - .setBaseType(nameCTTwoPrim) - .setProperties(Arrays.asList( - new Property() - .setName("AdditionalPropString") - .setType(new FullQualifiedName("Edm", "String")))); - - } else if (complexTypeName.equals(nameCTTwoBase)) { - return new ComplexType() - .setName("CTTwoBase") - .setBaseType(nameCTBase) - .setProperties(Arrays.asList( - new Property() - .setName("AdditionalPropString") - .setType(new FullQualifiedName("Edm", "String")))); - - } else if (complexTypeName.equals(nameCTCompComp)) { - return new ComplexType() - .setName("CTCompComp") - .setProperties(Arrays.asList(propertyComplex_CTTwoPrim)); - - } else if (complexTypeName.equals(nameCTCompCollComp)) { - return new ComplexType() - .setName("CTCompComp") - .setProperties(Arrays.asList(collPropertyComplex_CTTwoPrim)); - - } else if (complexTypeName.equals(nameCTPrimComp)) { - return new ComplexType() - .setName("CTPrimComp") - .setProperties(Arrays.asList(propertyInt16, propertyComplex_CTAllPrim)); - - } else if (complexTypeName.equals(nameCTNavFiveProp)) { - return new ComplexType() - .setName("CTNavFiveProp") - .setProperties(Arrays.asList(propertyInt16)) - .setNavigationProperties((Arrays.asList( - collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav, - collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, - new NavigationProperty() - .setName("NavPropertyETMediaOne") - .setType(nameETMedia), - new NavigationProperty() - .setName("NavPropertyETMediaMany") - .setType(nameETMedia).setCollection(true) - ))); - - } else if (complexTypeName.equals(nameCTBasePrimCompNav)) { - return new ComplexType() - .setName("CTBasePrimCompNav") - .setBaseType(nameCTPrimComp) - .setNavigationProperties(Arrays.asList( - collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, - collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav)); - - } else if (complexTypeName.equals(nameCTPrimEnum)) { - return new ComplexType() - .setName("CTPrimEnum") - .setProperties(Arrays.asList(propertyInt16, propertyEnumString_ENString)); - - } else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) { - return new ComplexType() - .setName("CTTwoBasePrimCompNav") - .setBaseType(nameCTBasePrimCompNav); - - } - - return null; - } - - @Override - public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException { - if (entityContainerName == null) { - return entityContainerInfoTest1; - } else if (entityContainerName.equals(nameContainer)) { - return entityContainerInfoTest1; - } - - return null; - } - - @Override - public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException { - if (entityContainer == nameContainer) { - if (name.equals("ESAllPrim")) { - return new EntitySet() - .setName("ESAllPrim") - .setType(nameETAllPrim); - - } else if (name.equals("ESCollAllPrim")) { - return new EntitySet() - .setName("ESCollAllPrim") - .setType(nameETCollAllPrim); - - } else if (name.equals("ESTwoPrim")) { - return new EntitySet() - .setName("ESTwoPrim") - .setType(nameETTwoPrim); - - } else if (name.equals("ESMixPrimCollComp")) { - return new EntitySet() - .setName("ESMixPrimCollComp") - .setType(nameETMixPrimCollComp); - - } else if (name.equals("ESBase")) { - return new EntitySet() - .setName("ESBase") - .setType(nameETBase); - - } else if (name.equals("ESTwoBase")) { - return new EntitySet() - .setName("ESTwoBase") - .setType(nameETTwoBase); - - } else if (name.equals("ESTwoKeyTwoPrim")) { - return new EntitySet() - .setName("ESTwoKeyTwoPrim") - .setType(nameETTwoKeyTwoPrim); - - } else if (name.equals("ESBaseTwoKeyTwoPrim")) { - return new EntitySet() - .setName("ESBaseTwoKeyTwoPrim") - .setType(nameETBaseTwoKeyTwoPrim); - - } else if (name.equals("ESTwoBaseTwoKeyTwoPrim")) { - return new EntitySet() - .setName("ESTwoBaseTwoKeyTwoPrim") - .setType(nameETTwoBaseTwoKeyTwoPrim); - - } else if (name.equals("ESAllKey")) { - return new EntitySet() - .setName("ESAllKey") - .setType(nameETAllKey); - - } else if (name.equals("ESCompAllPrim")) { - return new EntitySet() - .setName("ESCompAllPrim") - .setType(nameETCompAllPrim); - - } else if (name.equals("ESCompCollAllPrim")) { - return new EntitySet() - .setName("ESCompCollAllPrim") - .setType(nameETCompCollAllPrim); - - } else if (name.equals("ESCompComp")) { - return new EntitySet() - .setName("ESCompComp") - .setType(nameETCompComp); - - } else if (name.equals("ESCompCollComp")) { - return new EntitySet() - .setName("ESCompCollComp") - .setType(nameETCompCollComp); - - } else if (name.equals("ESMedia")) { - return new EntitySet() - .setName("ESMedia") - .setType(nameETMedia) - .setIncludeInServiceDocument(true); - - } else if (name.equals("ESKeyTwoKeyComp")) { - return new EntitySet() - .setName("ESKeyTwoKeyComp") - .setType(nameETKeyTwoKeyComp); - } else if (name.equals("ESInvisible")) { - return new EntitySet() - .setName("ESInvisible") - .setType(nameETAllPrim); - } else if (name.equals("ESServerSidePaging")) { - return new EntitySet() - .setName("ESServerSidePaging") - .setType(nameETServerSidePaging); - } else if (name.equals("ESAllNullable")) { - return new EntitySet() - .setName("ESAllNullable") - .setType(nameETAllNullable); - } else if (name.equals("ESKeyNav")) { - return new EntitySet() - .setName("ESKeyNav") - .setType(nameETKeyNav); - } else if (name.equals("ESTwoKeyNav")) { - return new EntitySet() - .setName("ESTwoKeyNav") - .setType(nameETTwoKeyNav); - } else if (name.equals("ESBaseTwoKeyNav")) { - return new EntitySet() - .setName("ESBaseTwoKeyNav") - .setType(nameETBaseTwoKeyNav); - } else if (name.equals("ESCompMixPrimCollComp")) { - return new EntitySet() - .setName("ESCompMixPrimCollComp") - .setType(nameETCompMixPrimCollComp); - } else if (name.equals("ESFourKeyAlias")) { - return new EntitySet() - .setName("ESFourKeyAlias") - .setType(nameETFourKeyAlias); - } - } - - return null; - } - - @Override - public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { - - if (entityTypeName.equals(nameETAllPrim)) { - return new EntityType() - .setName("ETAllPrim") - .setKey(Arrays.asList( - new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList( - propertyInt16_NotNullable, propertyString, - propertyBoolean, propertyByte, propertySByte, - propertyInt32, propertyInt64, - propertySingle, propertyDouble, propertyDecimal, - propertyBinary, propertyDate, propertyDateTimeOffset, - propertyDuration, propertyGuid, - propertyTimeOfDay /* TODO add propertyStream */)); - - } else if (entityTypeName.equals(nameETCollAllPrim)) { - return new EntityType() - .setName("ETCollAllPrim") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - - .setProperties(Arrays.asList( - propertyInt16_NotNullable, - collPropertyString, collPropertyBoolean, - collPropertyByte, collPropertySByte, - collPropertyInt16, collPropertyInt32, collPropertyInt64, - collPropertySingle, collPropertyDouble, collPropertyDecimal, - collPropertyBinary, collPropertyDate, collPropertyDateTimeOffset, - collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add propertyStream */)); - - } else if (entityTypeName.equals(nameETTwoPrim)) { - return new EntityType() - .setName("ETTwoPrim") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - - .setProperties(Arrays.asList( - propertyInt16_NotNullable, propertyString)); - - } else if (entityTypeName.equals(nameETMixPrimCollComp)) { - return new EntityType() - .setName("ETMixPrimCollComp") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - - .setProperties(Arrays.asList( - propertyInt16_NotNullable, collPropertyString, - propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim)); - - } else if (entityTypeName.equals(nameETTwoKeyTwoPrim)) { - return new EntityType() - .setName("ETTwoKeyTwoPrim") - .setKey(Arrays.asList( - new PropertyRef().setPropertyName("PropertyInt16"), - new PropertyRef().setPropertyName("PropertyString"))) - .setProperties(Arrays.asList( - propertyInt16_NotNullable, propertyString)); - - } else if (entityTypeName.equals(nameETBaseTwoKeyTwoPrim)) { - return new EntityType() - .setName("ETBaseTwoKeyTwoPrim") - .setBaseType(nameETTwoKeyTwoPrim); - - } else if (entityTypeName.equals(nameETTwoBaseTwoKeyTwoPrim)) { - return new EntityType() - .setName("ETTwoBaseTwoKeyTwoPrim") - .setBaseType(nameETTwoKeyTwoPrim); - - } else if (entityTypeName.equals(nameETBase)) { - return new EntityType() - .setName("ETBase") - .setBaseType(nameETTwoPrim) - .setProperties(Arrays.asList(new Property() - .setName("AdditionalPropertyString_5") - .setType(nameString))); - - } else if (entityTypeName.equals(nameETTwoBase)) { - return new EntityType() - .setName("ETTwoBase") - .setBaseType(nameETBase) - .setProperties(Arrays.asList(new Property() - .setName("AdditionalPropertyString_6") - .setType(nameString)) - ); - - } else if (entityTypeName.equals(nameETAllKey)) { - return new EntityType() - .setName("ETAllKey") - .setKey(Arrays.asList( - new PropertyRef().setPropertyName("PropertyString"), - new PropertyRef().setPropertyName("PropertyBoolean"), - new PropertyRef().setPropertyName("PropertyByte"), - new PropertyRef().setPropertyName("PropertySByte"), - new PropertyRef().setPropertyName("PropertyInt16"), - new PropertyRef().setPropertyName("PropertyInt32"), - new PropertyRef().setPropertyName("PropertyInt64"), - new PropertyRef().setPropertyName("PropertyDecimal"), - new PropertyRef().setPropertyName("PropertyDate"), - new PropertyRef().setPropertyName("PropertyDateTimeOffset"), - new PropertyRef().setPropertyName("PropertyDuration"), - new PropertyRef().setPropertyName("PropertyGuid"), - new PropertyRef().setPropertyName("PropertyTimeOfDay"))) - .setProperties(Arrays.asList( - propertyString, propertyBoolean, - propertyByte, propertySByte, - propertyInt16, propertyInt32, propertyInt64, - propertyDecimal, propertyDate, - propertySingle, propertyDouble, propertyDateTimeOffset, - propertyDuration, propertyGuid, - propertyTimeOfDay /* TODO add propertyStream */)); - - } else if (entityTypeName.equals(nameETCompAllPrim)) { - return new EntityType() - .setName("ETCompAllPrim") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTAllPrim)); - - } else if (entityTypeName.equals(nameETCompCollAllPrim)) { - return new EntityType() - .setName("ETCompAllPrim") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - - .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCollAllPrim)); - - } else if (entityTypeName.equals(nameETCompComp)) { - return new EntityType() - .setName("ETCompComp") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCompComp)); - - } else if (entityTypeName.equals(nameETCompCollComp)) { - return new EntityType() - .setName("ETCompCollComp") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCompCollComp)); - - } else if (entityTypeName.equals(nameETMedia)) { - return new EntityType() - .setName("ETCompCollComp") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList(propertyInt16_NotNullable)) - .setHasStream(true); - - } else if (entityTypeName.equals(nameETKeyTwoKeyComp)) { - return new EntityType() - .setName("ETKeyTwoKeyComp") - .setKey(Arrays.asList( - new PropertyRef() - .setPropertyName("PropertyInt16"), - new PropertyRef() - .setPropertyName("PropertyComplex/PropertyInt16") - .setAlias("KeyAlias1"), - new PropertyRef() - .setPropertyName("PropertyComplex/PropertyString") - .setAlias("KeyAlias2"), - new PropertyRef() - .setPropertyName("PropertyComplexComplex/PropertyComplex/PropertyString") - .setAlias("KeyAlias3"))) - .setProperties(Arrays.asList( - propertyInt16_NotNullable, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp)); - - } else if (entityTypeName.equals(nameETServerSidePaging)) { - return new EntityType() - .setName("ETKeyTwoKeyComp") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString)); - - } else if (entityTypeName.equals(nameETAllNullable)) { - return new EntityType() - .setName("ETAllNullable") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyKey"))) - .setProperties(Arrays.asList( - new Property() - .setName("PropertyKey").setType(nameInt16), - propertyInt16, - propertyString, propertyBoolean, - propertyByte, propertySByte, - propertyInt32, propertyInt64, - propertySingle, propertyDouble, - propertyDecimal, propertyBinary, propertyDate, - propertyDateTimeOffset, - propertyDuration, propertyGuid, propertyTimeOfDay /* TODO add propertyStream */, - collPropertyString, collPropertyBoolean, - collPropertyByte, collPropertySByte, - collPropertyInt16, - collPropertyInt32, collPropertyInt64, - collPropertySingle, collPropertyDouble, - collPropertyDecimal, collPropertyBinary, collPropertyDate, - collPropertyDateTimeOffset, - collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add propertyStream */)); - - } else if (entityTypeName.equals(nameETKeyNav)) { - return new EntityType() - .setName("ETKeyNav") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList( - propertyInt16_NotNullable, propertyString_NotNullable, propertyComplex_CTNavFiveProp, - propertyComplexAllPrim_CTAllPrim, propertyComplexTwoPrim_CTTwoPrim, - collPropertyString, collPropertyInt16, collPropertyComplex_CTPrimComp, - new Property() - .setName("PropertyComplexComplex").setType(nameCTCompNav) - )) - .setNavigationProperties(Arrays.asList( - navPropertyETTwoKeyNavOne_ETTwoKeyNav, collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, - navPropertyETKeyNavOne_ETKeyNav, collectionNavPropertyETKeyNavMany_ETKeyNav, - navPropertyETMediaOne_ETMedia, collectionNavPropertyETMediaMany_ETMedia - )); - } else if (entityTypeName.equals(nameETKeyPrimNav)) { - return new EntityType() - .setName("ETKeyNav") - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList( - propertyInt16_NotNullable, propertyString_NotNullable)) - .setNavigationProperties(Arrays.asList( - navPropertyETTwoKeyNavOne_ETTwoKeyNav, collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, - navPropertyETKeyNavOne_ETKeyNav, collectionNavPropertyETKeyNavMany_ETKeyNav, - navPropertyETMediaOne_ETMedia, collectionNavPropertyETMediaMany_ETMedia - )); - - } else if (entityTypeName.equals(nameETTwoKeyNav)) { - return new EntityType() - .setName("ETTwoKeyNav") - .setKey(Arrays.asList( - new PropertyRef().setPropertyName("PropertyInt16"), - new PropertyRef().setPropertyName("PropertyString"))) - .setProperties(Arrays.asList( - propertyInt16, propertyString, propertyComplex_CTPrimComp_NotNullable, - new Property().setName("PropertyComplexNav").setType(nameCTBasePrimCompNav), - propertyComplexEnum_CTPrimEnum_NotNullable, - collPropertyComplex_CTPrimComp, - new Property().setName("CollPropertyComplexNav").setType(nameCTNavFiveProp).setCollection(true), - collPropertyString, propertyComplexTwoPrim_CTTwoPrim, - propertyEnumString_ENString - )) - .setNavigationProperties(Arrays.asList( - new NavigationProperty() - .setName("NavPropertyETKeyNavOne") - .setType(nameETKeyNav) - .setReferentialConstraints(Arrays.asList( - new ReferentialConstraint() - .setProperty("PropertyInt16") - .setReferencedProperty("PropertyInt16"))), - collectionNavPropertyETKeyNavMany_ETKeyNav, - navPropertyETTwoKeyNavOne_ETTwoKeyNav, - collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav)); - - } else if (entityTypeName.equals(nameETBaseTwoKeyNav)) { - return new EntityType() - .setName("ETBaseTwoKeyNav") - .setBaseType(nameETTwoKeyNav) - .setProperties(Arrays.asList(propertyDate)) - .setNavigationProperties(Arrays.asList( - new NavigationProperty() - .setName("NavPropertyETBaseTwoKeyNav") - .setType(nameETBaseTwoKeyNav), - new NavigationProperty() - .setName("NavPropertyETTwoBaseTwoKeyNav") - .setType(nameETTwoBaseTwoKeyNav))) - .setHasStream(true); - - } else if (entityTypeName.equals(nameETTwoBaseTwoKeyNav)) { - return new EntityType() - .setName("ETTwoBaseTwoKeyNav") - .setBaseType(nameETBaseTwoKeyNav) - .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList(propertyGuid)) - .setNavigationProperties(Arrays.asList( - new NavigationProperty() - .setName("NavPropertyETBaseTwoKeyNavOne") - .setType(nameETBaseTwoKeyNav), - new NavigationProperty() - .setName("NavPropertyETBaseTwoKeyNavMany") - .setType(nameETBaseTwoKeyNav) - .setCollection(true) - )); - - } else if (entityTypeName.equals(nameETFourKeyAlias)) { - return new EntityType() - .setName("ETFourKeyAlias") - .setKey(Arrays.asList( - new PropertyRef() - .setPropertyName("PropertyInt16"), - new PropertyRef() - .setPropertyName("PropertyComplex/PropertyInt16").setAlias("KeyAlias1"), - new PropertyRef() - .setPropertyName("PropertyComplex/PropertyString").setAlias("KeyAlias2"), - new PropertyRef() - .setPropertyName("PropertyComplexComplex/PropertyComplex/PropertyString") - .setAlias("KeyAlias3"))) - .setProperties(Arrays.asList(propertyGuid, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp)); - } - - return null; - } - - @Override - public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException { - if (enumTypeName.equals(nameENString)) { - return new EnumType() - .setName("ENString") - .setMembers(Arrays.asList( - new EnumMember().setName("String1").setValue("1"), - new EnumMember().setName("String2").setValue("2"), - new EnumMember().setName("String3").setValue("3"))); - } - - return null; - } - - @Override - public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String name) - throws ODataException { - - if (entityContainer.equals(nameContainer)) { - if (name.equals("FINRTInt16")) { - return new FunctionImport() - .setName("FINRTInt16") - .setFunction(nameUFNRTInt16) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FINInvisibleRTInt16")) { - return new FunctionImport() - .setName("FINInvisibleRTInt16") - .setFunction(nameUFNRTInt16); - - } else if (name.equals("FINInvisible2RTInt16")) { - return new FunctionImport() - .setName("FINInvisible2RTInt16") - .setFunction(nameUFNRTInt16); - - } else if (name.equals("FICRTETKeyNav")) { - return new FunctionImport() - .setName("FICRTETKeyNav") - .setFunction(nameUFCRTETKeyNav); - - } else if (name.equals("FICRTETTwoKeyNavParam")) { - return new FunctionImport() - .setName("FICRTETTwoKeyNavParam") - .setFunction(nameUFCRTETTwoKeyNavParam) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTStringTwoParam")) { - return new FunctionImport() - .setName("FICRTStringTwoParam") - .setFunction(nameUFCRTStringTwoParam) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTCollStringTwoParam")) { - return new FunctionImport() - .setName("FICRTCollStringTwoParam") - .setFunction(nameUFCRTCollStringTwoParam) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTCTAllPrimTwoParam")) { - return new FunctionImport() - .setName("FICRTCTAllPrimTwoParam") - .setFunction(nameUFCRTCTAllPrimTwoParam) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTESMixPrimCollCompTwoParam")) { - return new FunctionImport() - .setName("FICRTESMixPrimCollCompTwoParam") - .setFunction(nameUFCRTESMixPrimCollCompTwoParam) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FINRTESMixPrimCollCompTwoParam")) { - return new FunctionImport() - .setName("FINRTESMixPrimCollCompTwoParam") - .setFunction(nameUFNRTESMixPrimCollCompTwoParam) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTCollCTTwoPrim")) { - return new FunctionImport() - .setName("FICRTCollCTTwoPrim") - .setFunction(nameUFCRTCollCTTwoPrim) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTETMedia")) { - return new FunctionImport() - .setName("FICRTETMedia") - .setFunction(nameUFCRTETMedia) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTCTTwoPrimParam")) { - return new FunctionImport() - .setName("FICRTCTTwoPrimParam") - .setFunction(nameUFCRTCTTwoPrimParam) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTCTTwoPrim")) { - return new FunctionImport() - .setName("FICRTCTTwoPrim") - .setFunction(nameUFCRTCTTwoPrim) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTCollString")) { - return new FunctionImport() - .setName("FICRTCollString") - .setFunction(nameUFCRTCollString) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTString")) { - return new FunctionImport() - .setName("FICRTString") - .setFunction(nameUFCRTString) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTESTwoKeyNavParam")) { - return new FunctionImport() - .setName("FICRTESTwoKeyNavParam") - .setFunction(nameUFCRTESTwoKeyNavParam) - .setIncludeInServiceDocument(true); - - } else if (name.equals("FICRTCollCTTwoPrimParam")) { - return new FunctionImport() - .setName("FICRTCollCTTwoPrimParam") - .setFunction(nameUFCRTCollCTTwoPrimParam) - .setIncludeInServiceDocument(true); - - } - } - - return null; - } - - @Override - public List getFunctions(final FullQualifiedName functionName) throws ODataException { - - if (functionName.equals(nameUFNRTInt16)) { - return Arrays.asList( - new Function() - .setName("UFNRTInt16") - .setParameters(new ArrayList()) - .setReturnType( - new ReturnType().setType(nameString)) - ); - - } else if (functionName.equals(nameUFCRTETKeyNav)) { - return Arrays.asList( - new Function() - .setName("UFCRTETKeyNav") - .setParameters(new ArrayList()) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETKeyNav)) - ); - - } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTETTwoKeyNavParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav) - ) - ); - - } else if (functionName.equals(nameUFCRTETTwoKeyNavParamCTTwoPrim)) { - return Arrays.asList( - new Function() - .setName("UFCRTETTwoKeyNavParamCTTwoPrim") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterCTTwoPrim").setType(nameCTTwoPrim))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav) - ) - ); - - } else if (functionName.equals(nameUFCRTStringTwoParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTStringTwoParam") - .setParameters(Arrays.asList( - new Parameter() - .setName("ParameterInt16") - .setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameString)), - new Function() - .setName("UFCRTStringTwoParam") - .setParameters(Arrays.asList( - new Parameter() - .setName("ParameterString") - .setType(nameString), - new Parameter() - .setName("ParameterInt16") - .setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameString)) - - ); - - } else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTESTwoKeyNavParam") - .setParameters(Arrays.asList( - new Parameter() - .setName("ParameterInt16") - .setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameUFCRTString)) { - return Arrays.asList( - new Function() - .setName("UFCRTString") - - .setComposable(true) - .setParameters(new ArrayList()) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameString) - ) - ); - - } else if (functionName.equals(nameUFCRTCollStringTwoParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTCollStringTwoParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(nameString), - new Parameter().setName("ParameterInt16").setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameString).setCollection(true)) - ); - - } else if (functionName.equals(nameUFCRTCollString)) { - return Arrays.asList( - new Function() - .setName("UFCRTCollString") - .setParameters(new ArrayList()) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameString).setCollection(true)) - ); - - } else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTCTAllPrimTwoParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(nameString), - new Parameter().setName("ParameterInt16").setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTAllPrim)) - ); - - } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTCTTwoPrimParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(nameString), - new Parameter().setName("ParameterInt16").setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim)) - ); - } else if (functionName.equals(nameUFCRTCollCTTwoPrimParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTCollCTTwoPrimParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(nameString), - new Parameter().setName("ParameterInt16").setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim).setCollection(true)) - ); - - } else if (functionName.equals(nameUFCRTCTTwoPrim)) { - return Arrays.asList( - new Function() - .setName("UFCRTCTTwoPrim") - .setParameters(new ArrayList()) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim)) - ); - - } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) { - return Arrays.asList( - new Function() - .setName("UFCRTCTTwoPrim") - - .setParameters(new ArrayList()) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim).setCollection(true)) - ); - - } else if (functionName.equals(nameUFCRTETMedia)) { - return Arrays.asList( - new Function() - .setName("UFCRTETMedia") - .setParameters(new ArrayList()) - .setReturnType( - new ReturnType().setType(nameETMedia)) - ); - - } else if (functionName.equals(nameUFCRTString)) { - return Arrays.asList( - new Function() - .setName("UFCRTString") - .setParameters(new ArrayList()) - .setReturnType(new ReturnType() - .setType(nameString) - ) - ); - - } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) { - return Arrays.asList( - new Function() - .setName("UFCRTCollCTTwoPrim") - .setComposable(true) - .setParameters(new ArrayList()) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim).setCollection(true)) - ); - - } else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) { - return Arrays.asList( - new Function() - .setName("UFNRTESMixPrimCollCompTwoParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(nameString), - new Parameter().setName("ParameterInt16").setType(nameInt16))) - .setComposable(false) - .setReturnType( - new ReturnType().setType(nameETMixPrimCollComp).setCollection(true)) - ); - - } else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTETAllPrimTwoParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(nameString), - new Parameter().setName("ParameterInt16").setType(nameInt16))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETAllPrim)) - ); - - } else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) { - return Arrays.asList( - new Function() - .setName("UFCRTESMixPrimCollCompTwoParam") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(nameString), - new Parameter().setName("ParameterInt16").setType(nameInt16) - )) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETMixPrimCollComp).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCESTwoKeyNavRTESTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCESTwoKeyNavRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)), - - new Function() - .setName("BFCESTwoKeyNavRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true), - new Parameter().setName("ParameterString").setType(nameString).setCollection(false))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)), - new Function() - .setName("BFCESTwoKeyNavRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)), - new Function() - .setName("BFCESTwoKeyNavRTESTwoKeyNav") - .setBound(true) - .setParameters( - Arrays.asList(new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true), - new Parameter().setName("ParameterString").setType(nameString).setCollection(false))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) { - return Arrays.asList( - new Function().setName("BFCStringRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameString))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCETBaseTwoKeyNavRTETTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav) - ) - ); - - } else if (functionName.equals(nameBFCESBaseTwoKeyNavRTESBaseTwoKey)) { - return Arrays.asList( - new Function() - .setName("BFCESBaseTwoKeyNavRTESBaseTwoKey") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav) - .setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) { - return Arrays.asList( - new Function() - .setName("BFCESAllPrimRTCTAllPrim") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETAllPrim).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTAllPrim)) - ); - - } else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) { - return Arrays.asList( - new Function() - .setName("BFCESTwoKeyNavRTCTTwoPrim") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim)) - ); - - } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) { - return Arrays.asList( - new Function() - .setName("BFCESTwoKeyNavRTCollCTTwoPrim") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCESTwoKeyNavRTString)) { - return Arrays.asList( - new Function() - .setName("BFCESTwoKeyNavRTString") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameString)) - ); - - } else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) { - return Arrays.asList( - new Function() - .setName("BFCESTwoKeyNavRTCollString") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameString).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCETTwoKeyNavRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCETBaseTwoKeyNavRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCSINavRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) { - return Arrays.asList( - new Function() - .setName("BFCETBaseTwoKeyNavRTESBaseTwoKey") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCCollStringRTESTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCCollStringRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameString).setCollection(true))) - .setComposable(true) - .setReturnType(new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCCTPrimCompRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameCTPrimComp))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCCTPrimCompRTESBaseTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameCTPrimComp))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCCollCTPrimCompRTESAllPrim)) { - return Arrays.asList( - new Function() - .setName("BFCCollCTPrimCompRTESAllPrim") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameCTPrimComp).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETAllPrim).setCollection(true)) - ); - - } else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCESTwoKeyNavRTTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav)) - ); - - } else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCESKeyNavRTETKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETKeyNav)) - ); - - } else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCETKeyNavRTETKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETKeyNav))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETKeyNav)) - ); - } else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFESTwoKeyNavRTESTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true))) - .setComposable(true) - .setReturnType(new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - - ); - - } else if (functionName.equals(nameBFCETTwoKeyNavRTETTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BFCETTwoKeyNavRTETTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav)) - ); - - } else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) { - return Arrays.asList( - new Function() - .setName("BFCETTwoKeyNavRTCTTwoPrim") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim)) - ); - } else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) { - return Arrays.asList( - new Function() - .setName("BFCESTwoKeyNavRTStringParam") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true), - new Parameter().setName("ParameterComplex").setType(nameCTTwoPrim))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameString)) - ); - - } else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) { - return Arrays.asList( - new Function() - .setName("BFCESKeyNavRTETKeyNavParam") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true), - new Parameter().setName("ParameterString").setType(nameString))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETKeyNav)) - ); - } else if (functionName.equals(nameBFCCTPrimCompRTETTwoKeyNavParam)) { - return Arrays.asList( - new Function() - .setName("BFCCTPrimCompRTETTwoKeyNavParam") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameCTPrimComp), - new Parameter().setName("ParameterString").setType(nameString))) - .setComposable(true) - .setReturnType(new ReturnType() - .setType(nameETTwoKeyNav) - ) - ); - } else if (functionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BAETTwoKeyNavRTETTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameInt16).setCollection(true), - new Parameter().setName("ParameterString").setType(nameString).setNullable(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameCTTwoPrim).setCollection(true)) - ); - } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNavParam)) { - return Arrays.asList( - new Function() - .setName("BFCCTPrimCompRTESTwoKeyNavParam") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(nameCTPrimComp), - new Parameter().setName("ParameterString").setType(nameString))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(nameETTwoKeyNav).setCollection(true)) - ); - } - - return null; - } - - @Override - public Singleton getSingleton(final FullQualifiedName entityContainer, final String name) throws ODataException { - if (entityContainer.equals(nameContainer)) { - - if (name.equals("SI")) { - return new Singleton() - .setName("SI") - .setType(nameETTwoPrim); - - } else if (name.equals("SINav")) { - return new Singleton() - .setName("SINav") - .setType(nameETTwoKeyNav) - .setNavigationPropertyBindings(Arrays.asList( - new NavigationPropertyBinding() - .setPath("NavPropertyETTwoKeyNavMany") - .setTarget(new Target().setTargetName("ESTwoKeyNav")))); - - } else if (name.equals("SIMedia")) { - return new Singleton() - .setName("SIMedia") - .setType(nameETMedia); - } - } - return null; - }; -} From 54aef8866493a4b6cfeca07ca1fd1f85681f25fb Mon Sep 17 00:00:00 2001 From: Stephan Klevenz Date: Fri, 9 May 2014 14:22:51 +0200 Subject: [PATCH 2/7] [OLINGO-266] initial reference scenario servlet --- lib/ref/pom.xml | 10 ++++- .../apache/olingo/ref/ReferenceServlet.java | 42 +++++++++++++++++++ .../main/resources/simplelogger.properties | 20 +++++++++ lib/ref/src/main/webapp/WEB-INF/web.xml | 42 +++++++++++++++++++ lib/ref/src/main/webapp/index.html | 32 ++++++++++++++ lib/server-api/pom.xml | 40 ++++++++++-------- .../apache/olingo/server/api/ODataServer.java | 5 +++ lib/server-core/pom.xml | 36 ++++++++-------- .../olingo/server/core/ODataServerImpl.java | 16 +++++++ 9 files changed, 206 insertions(+), 37 deletions(-) create mode 100644 lib/ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java create mode 100644 lib/ref/src/main/resources/simplelogger.properties create mode 100644 lib/ref/src/main/webapp/WEB-INF/web.xml create mode 100644 lib/ref/src/main/webapp/index.html diff --git a/lib/ref/pom.xml b/lib/ref/pom.xml index fe1da602c..76ea18874 100644 --- a/lib/ref/pom.xml +++ b/lib/ref/pom.xml @@ -24,7 +24,7 @@ 4.0.0 olingo-ref - jar + war ${project.artifactId} @@ -35,6 +35,13 @@ + + javax.servlet + servlet-api + 2.5 + provided + + org.apache.olingo olingo-server-api @@ -55,7 +62,6 @@ org.mockito mockito-all - diff --git a/lib/ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java b/lib/ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java new file mode 100644 index 000000000..a3d30ee66 --- /dev/null +++ b/lib/ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.ref; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.olingo.server.api.ODataServer; + +public class ReferenceServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + @Override + protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + + ODataServer server = ODataServer.newInstance(); + server.handle(req, resp); + + } + +} diff --git a/lib/ref/src/main/resources/simplelogger.properties b/lib/ref/src/main/resources/simplelogger.properties new file mode 100644 index 000000000..2a3350c78 --- /dev/null +++ b/lib/ref/src/main/resources/simplelogger.properties @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +org.slf4j.simpleLogger.defaultLogLevel=debug +org.slf4j.simpleLogger.logFile=System.out \ No newline at end of file diff --git a/lib/ref/src/main/webapp/WEB-INF/web.xml b/lib/ref/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..cc7de77e3 --- /dev/null +++ b/lib/ref/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,42 @@ + + + + + Apache Olingo OData 4.0 Reference Scenario Service + + + index.html + + + + ODataServlet + org.apache.olingo.ref.ReferenceServlet + 1 + + + + ODataServlet + /odata.svc/* + + + diff --git a/lib/ref/src/main/webapp/index.html b/lib/ref/src/main/webapp/index.html new file mode 100644 index 000000000..e25f4fb6e --- /dev/null +++ b/lib/ref/src/main/webapp/index.html @@ -0,0 +1,32 @@ + + + + +

Olingo OData 4.0 Reference Scenario Service

+
+

Reference Scenario Service

+ +
  • Service Document
  • +
  • Metadata
  • +
    + + + + \ No newline at end of file diff --git a/lib/server-api/pom.xml b/lib/server-api/pom.xml index b0bdda339..3d8fa8788 100644 --- a/lib/server-api/pom.xml +++ b/lib/server-api/pom.xml @@ -1,26 +1,26 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 olingo-server-api @@ -33,13 +33,19 @@ 0.1.0-SNAPSHOT .. - + org.apache.olingo olingo-commons-api ${project.version} + + javax.servlet + servlet-api + 2.5 + provided + - + diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java index a657392dc..739018912 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java @@ -18,6 +18,9 @@ */ package org.apache.olingo.server.api; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.apache.olingo.commons.api.ODataRuntimeException; import org.apache.olingo.server.api.serializer.ODataFormat; import org.apache.olingo.server.api.serializer.ODataSerializer; @@ -45,4 +48,6 @@ public abstract class ODataServer { public abstract ODataSerializer getSerializer(ODataFormat format); + public abstract void handle(HttpServletRequest req, HttpServletResponse resp); + } diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml index 28693fc66..bc7ae718f 100644 --- a/lib/server-core/pom.xml +++ b/lib/server-core/pom.xml @@ -1,26 +1,26 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 olingo-server-core @@ -45,7 +45,7 @@ olingo-commons-core ${project.version} - + javax.servlet javax.servlet-api ${servlet.version} @@ -97,8 +97,8 @@ true true - + src/main/antlr4/org/apache/olingo/server/core/uri/antlr diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java index 7beb90dad..933422d81 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java @@ -18,6 +18,11 @@ */ package org.apache.olingo.server.core; +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.apache.olingo.commons.api.ODataRuntimeException; import org.apache.olingo.server.api.ODataServer; import org.apache.olingo.server.api.serializer.ODataFormat; @@ -44,4 +49,15 @@ public class ODataServerImpl extends ODataServer { return serializer; } + @Override + public void handle(HttpServletRequest req, HttpServletResponse resp) { + + try { + resp.getWriter().print("Hello World!"); + } catch (IOException e) { + throw new ODataRuntimeException(e); + } + + } + } From 8ca9b3c616864dbbdf0c07a0dd443fc7655e884a Mon Sep 17 00:00:00 2001 From: Stephan Klevenz Date: Fri, 9 May 2014 14:27:56 +0200 Subject: [PATCH 3/7] [OLINGO-266] refactor ref module to server-ref --- lib/pom.xml | 10 +++++----- lib/{ref => server-ref}/pom.xml | 2 +- .../java/org/apache/olingo/ref/ReferenceServlet.java | 0 .../server/core/testutil/EdmTechTestProvider.java | 0 .../olingo/server/core/testutil/StringUtils.java | 0 .../core/testutil/techprovider/ActionProvider.java | 0 .../testutil/techprovider/ComplexTypeProvider.java | 0 .../core/testutil/techprovider/ContainerProvider.java | 0 .../core/testutil/techprovider/EdmTechProvider.java | 0 .../core/testutil/techprovider/EntityTypeProvider.java | 0 .../core/testutil/techprovider/EnumTypeProvider.java | 0 .../core/testutil/techprovider/FunctionProvider.java | 0 .../core/testutil/techprovider/PropertyProvider.java | 0 .../core/testutil/techprovider/SchemaProvider.java | 0 .../testutil/techprovider/TypeDefinitionProvider.java | 0 .../src/main/resources/simplelogger.properties | 0 .../src/main/webapp/WEB-INF/web.xml | 0 lib/{ref => server-ref}/src/main/webapp/index.html | 0 .../core/serializer/json/ServiceDocumentTest.java | 0 .../core/serializer/xml/MetadataDocumentTest.java | 0 .../org/apache/olingo/server/core/uri/RawUriTest.java | 0 .../apache/olingo/server/core/uri/UriInfoImplTest.java | 0 .../olingo/server/core/uri/UriResourceImplTest.java | 0 .../server/core/uri/antlr/TestFullResourcePath.java | 0 .../apache/olingo/server/core/uri/antlr/TestLexer.java | 0 .../server/core/uri/antlr/TestUriParserImpl.java | 0 .../server/core/uri/queryoption/QueryOptionTest.java | 0 .../uri/queryoption/expression/ExpressionTest.java | 0 .../server/core/uri/testutil/ExpandValidator.java | 0 .../server/core/uri/testutil/FilterTreeToText.java | 0 .../server/core/uri/testutil/FilterValidator.java | 0 .../server/core/uri/testutil/ParseTreeToText.java | 0 .../server/core/uri/testutil/ParserValidator.java | 0 .../server/core/uri/testutil/ParserWithLogging.java | 0 .../server/core/uri/testutil/ResourceValidator.java | 0 .../server/core/uri/testutil/TestErrorLogger.java | 0 .../server/core/uri/testutil/TestUriValidator.java | 0 .../olingo/server/core/uri/testutil/TestValidator.java | 0 .../server/core/uri/testutil/TokenValidator.java | 0 .../server/core/uri/testutil/UriLexerWithTrace.java | 0 .../server/core/uri/validator/UriValidatorTest.java | 0 41 files changed, 6 insertions(+), 6 deletions(-) rename lib/{ref => server-ref}/pom.xml (97%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/ref/ReferenceServlet.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java (100%) rename lib/{ref => server-ref}/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java (100%) rename lib/{ref => server-ref}/src/main/resources/simplelogger.properties (100%) rename lib/{ref => server-ref}/src/main/webapp/WEB-INF/web.xml (100%) rename lib/{ref => server-ref}/src/main/webapp/index.html (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java (100%) rename lib/{ref => server-ref}/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java (100%) diff --git a/lib/pom.xml b/lib/pom.xml index ae179b791..ed0cdd73a 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -36,12 +36,12 @@ - server-api - server-core - client-api - client-core commons-api commons-core - ref + client-api + client-core + server-api + server-core + server-ref diff --git a/lib/ref/pom.xml b/lib/server-ref/pom.xml similarity index 97% rename from lib/ref/pom.xml rename to lib/server-ref/pom.xml index 76ea18874..fc5cf4ea2 100644 --- a/lib/ref/pom.xml +++ b/lib/server-ref/pom.xml @@ -23,7 +23,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - olingo-ref + olingo-server-ref war ${project.artifactId} diff --git a/lib/ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java b/lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java rename to lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java diff --git a/lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java similarity index 100% rename from lib/ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java diff --git a/lib/ref/src/main/resources/simplelogger.properties b/lib/server-ref/src/main/resources/simplelogger.properties similarity index 100% rename from lib/ref/src/main/resources/simplelogger.properties rename to lib/server-ref/src/main/resources/simplelogger.properties diff --git a/lib/ref/src/main/webapp/WEB-INF/web.xml b/lib/server-ref/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from lib/ref/src/main/webapp/WEB-INF/web.xml rename to lib/server-ref/src/main/webapp/WEB-INF/web.xml diff --git a/lib/ref/src/main/webapp/index.html b/lib/server-ref/src/main/webapp/index.html similarity index 100% rename from lib/ref/src/main/webapp/index.html rename to lib/server-ref/src/main/webapp/index.html diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java similarity index 100% rename from lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java From 70a989ce99fa1cfa628a0a5fb1ddb39de8cc0354 Mon Sep 17 00:00:00 2001 From: Stephan Klevenz Date: Fri, 9 May 2014 14:44:04 +0200 Subject: [PATCH 4/7] [OLINGO-266] ref package refactoring --- lib/server-ref/pom.xml | 5 ++ .../server/core/testutil/StringUtils.java | 52 ------------------- .../{ => server}/ref/ReferenceServlet.java | 2 +- .../provider}/ActionProvider.java | 2 +- .../provider}/ComplexTypeProvider.java | 2 +- .../provider}/ContainerProvider.java | 2 +- .../provider}/EdmTechProvider.java | 2 +- .../provider}/EntityTypeProvider.java | 2 +- .../provider}/EnumTypeProvider.java | 2 +- .../provider}/FunctionProvider.java | 2 +- .../provider}/PropertyProvider.java | 2 +- .../provider}/SchemaProvider.java | 2 +- .../provider}/TypeDefinitionProvider.java | 2 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../serializer/json/ServiceDocumentTest.java | 4 +- .../serializer/xml/MetadataDocumentTest.java | 10 ++-- .../server/core/uri/UriInfoImplTest.java | 4 +- .../server/core/uri/UriResourceImplTest.java | 8 +-- .../core/uri/antlr/TestFullResourcePath.java | 10 ++-- .../core/uri/antlr/TestUriParserImpl.java | 8 +-- .../core/uri/queryoption/QueryOptionTest.java | 2 +- .../expression/ExpressionTest.java | 10 ++-- .../uri}/testutil/EdmTechTestProvider.java | 4 +- .../core/uri/validator/UriValidatorTest.java | 2 +- pom.xml | 2 +- 25 files changed, 50 insertions(+), 95 deletions(-) delete mode 100644 lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java rename lib/server-ref/src/main/java/org/apache/olingo/{ => server}/ref/ReferenceServlet.java (97%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/ActionProvider.java (99%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/ComplexTypeProvider.java (99%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/ContainerProvider.java (99%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/EdmTechProvider.java (98%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/EntityTypeProvider.java (99%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/EnumTypeProvider.java (96%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/FunctionProvider.java (99%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/PropertyProvider.java (99%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/SchemaProvider.java (99%) rename lib/server-ref/src/main/java/org/apache/olingo/server/{core/testutil/techprovider => ref/provider}/TypeDefinitionProvider.java (94%) rename lib/server-ref/src/{main/java/org/apache/olingo/server/core => test/java/org/apache/olingo/server/core/uri}/testutil/EdmTechTestProvider.java (96%) diff --git a/lib/server-ref/pom.xml b/lib/server-ref/pom.xml index fc5cf4ea2..8e69f8121 100644 --- a/lib/server-ref/pom.xml +++ b/lib/server-ref/pom.xml @@ -62,6 +62,11 @@ org.mockito mockito-all + + commons-io + commons-io + test + diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java deleted file mode 100644 index 8cabcf1bf..000000000 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.server.core.testutil; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; - -public class StringUtils { - - public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) { - try { - final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8"))); - final StringBuilder stringBuilder = new StringBuilder(); - String line = null; - - while ((line = bufferedReader.readLine()) != null) { - stringBuilder.append(line); - if (preserveLineBreaks) { - stringBuilder.append("\n"); - } - } - - bufferedReader.close(); - - final String result = stringBuilder.toString(); - - return result; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java similarity index 97% rename from lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java index a3d30ee66..0be695fc9 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.ref; +package org.apache.olingo.server.ref; import java.io.IOException; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ActionProvider.java similarity index 99% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ActionProvider.java index f1748a726..d5c529660 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ActionProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import java.util.Arrays; import java.util.List; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ComplexTypeProvider.java similarity index 99% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ComplexTypeProvider.java index 2db6d0e69..f14d22f2b 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ComplexTypeProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import java.util.Arrays; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ContainerProvider.java similarity index 99% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ContainerProvider.java index 5b923177a..2790db469 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/ContainerProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import java.util.Arrays; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EdmTechProvider.java similarity index 98% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EdmTechProvider.java index 93e9c9dbf..13faf9049 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EdmTechProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import java.util.Arrays; import java.util.List; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EntityTypeProvider.java similarity index 99% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EntityTypeProvider.java index 9072234e1..88cc8ccc3 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EntityTypeProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import java.util.Arrays; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EnumTypeProvider.java similarity index 96% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EnumTypeProvider.java index 94ea6ea78..2583782d2 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/EnumTypeProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import java.util.Arrays; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/FunctionProvider.java similarity index 99% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/FunctionProvider.java index fe6fefbec..606d75133 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/FunctionProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import java.util.ArrayList; import java.util.Arrays; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/PropertyProvider.java similarity index 99% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/PropertyProvider.java index 5d1ad3bb9..92b8d6eeb 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/PropertyProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/SchemaProvider.java similarity index 99% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/SchemaProvider.java index 70d998794..c4fa3aea4 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/SchemaProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import java.util.ArrayList; import java.util.List; diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/TypeDefinitionProvider.java similarity index 94% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java rename to lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/TypeDefinitionProvider.java index dc34b316a..0cc566a2d 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/provider/TypeDefinitionProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil.techprovider; +package org.apache.olingo.server.ref.provider; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.server.api.edm.provider.TypeDefinition; diff --git a/lib/server-ref/src/main/webapp/WEB-INF/web.xml b/lib/server-ref/src/main/webapp/WEB-INF/web.xml index cc7de77e3..b828a8eec 100644 --- a/lib/server-ref/src/main/webapp/WEB-INF/web.xml +++ b/lib/server-ref/src/main/webapp/WEB-INF/web.xml @@ -30,7 +30,7 @@ ODataServlet - org.apache.olingo.ref.ReferenceServlet + org.apache.olingo.server.ref.ReferenceServlet 1 diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java index 4bf5a9981..8713348b1 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java @@ -28,6 +28,7 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import org.apache.commons.io.IOUtils; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmEntityContainer; import org.apache.olingo.commons.api.edm.EdmEntitySet; @@ -36,7 +37,6 @@ import org.apache.olingo.commons.api.edm.EdmSingleton; import org.apache.olingo.server.api.ODataServer; import org.apache.olingo.server.api.serializer.ODataFormat; import org.apache.olingo.server.api.serializer.ODataSerializer; -import org.apache.olingo.server.core.testutil.StringUtils; import org.junit.Before; import org.junit.Test; @@ -116,7 +116,7 @@ public class ServiceDocumentTest { InputStream result = serializer.serviceDocument(edm, serviceRoot); assertNotNull(result); - String jsonString = StringUtils.inputStreamToString(result, true); + String jsonString = IOUtils.toString(result); assertTrue(jsonString.contains("entitySetName1")); assertTrue(jsonString.contains("entitySetName2")); diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java index 6a1936451..7d3dee5a8 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java @@ -22,11 +22,13 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; +import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.apache.commons.io.IOUtils; import org.apache.olingo.commons.api.ODataException; import org.apache.olingo.commons.api.ODataRuntimeException; import org.apache.olingo.commons.api.edm.Edm; @@ -56,8 +58,7 @@ import org.apache.olingo.server.api.edm.provider.TypeDefinition; import org.apache.olingo.server.api.serializer.ODataFormat; import org.apache.olingo.server.api.serializer.ODataSerializer; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.StringUtils; -import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider; +import org.apache.olingo.server.ref.provider.EdmTechProvider; import org.junit.Test; public class MetadataDocumentTest { @@ -76,12 +77,13 @@ public class MetadataDocumentTest { } @Test - public void writeMetadataWithLocalTestEdm() { + public void writeMetadataWithLocalTestEdm() throws Exception { ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML); Edm edm = new EdmProviderImpl(new TestMetadataProvider()); InputStream metadata = serializer.metadataDocument(edm); assertNotNull(metadata); - String metadataString = StringUtils.inputStreamToString(metadata, false); + + String metadataString = IOUtils.toString(metadata); assertTrue(metadataString .contains("")); diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java index a9d516d8d..f84562a53 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java @@ -36,8 +36,6 @@ import org.apache.olingo.server.api.uri.UriInfoResource; import org.apache.olingo.server.api.uri.UriInfoService; import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl; import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl; import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl; @@ -52,6 +50,8 @@ import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl; import org.apache.olingo.server.core.uri.queryoption.SkipOptionImpl; import org.apache.olingo.server.core.uri.queryoption.SkipTokenOptionImpl; import org.apache.olingo.server.core.uri.queryoption.TopOptionImpl; +import org.apache.olingo.server.core.uri.testutil.EdmTechTestProvider; +import org.apache.olingo.server.ref.provider.EntityTypeProvider; import org.junit.Test; public class UriInfoImplTest { diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java index bd4ac6853..61ca4ef6b 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java @@ -41,12 +41,12 @@ import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl; import org.apache.olingo.server.core.edm.provider.EdmEntitySetImpl; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.server.core.edm.provider.EdmSingletonImpl; -import org.apache.olingo.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.server.core.testutil.techprovider.ActionProvider; -import org.apache.olingo.server.core.testutil.techprovider.ComplexTypeProvider; -import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl; import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl; +import org.apache.olingo.server.core.uri.testutil.EdmTechTestProvider; +import org.apache.olingo.server.ref.provider.ActionProvider; +import org.apache.olingo.server.ref.provider.ComplexTypeProvider; +import org.apache.olingo.server.ref.provider.EntityTypeProvider; import org.junit.Test; public class UriResourceImplTest { diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java index 702d5594b..1478cfebb 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java @@ -30,15 +30,15 @@ import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKin import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException; import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.server.core.testutil.techprovider.ComplexTypeProvider; -import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; -import org.apache.olingo.server.core.testutil.techprovider.EnumTypeProvider; -import org.apache.olingo.server.core.testutil.techprovider.PropertyProvider; import org.apache.olingo.server.core.uri.parser.UriParserException; +import org.apache.olingo.server.core.uri.testutil.EdmTechTestProvider; import org.apache.olingo.server.core.uri.testutil.FilterValidator; import org.apache.olingo.server.core.uri.testutil.ResourceValidator; import org.apache.olingo.server.core.uri.testutil.TestUriValidator; +import org.apache.olingo.server.ref.provider.ComplexTypeProvider; +import org.apache.olingo.server.ref.provider.EntityTypeProvider; +import org.apache.olingo.server.ref.provider.EnumTypeProvider; +import org.apache.olingo.server.ref.provider.PropertyProvider; import org.junit.Test; public class TestFullResourcePath { diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java index 9a05cfbe6..4e5acf8c4 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java @@ -28,14 +28,14 @@ import org.apache.olingo.server.api.uri.UriInfoKind; import org.apache.olingo.server.api.uri.UriResourceKind; import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.server.core.testutil.techprovider.ComplexTypeProvider; -import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; -import org.apache.olingo.server.core.testutil.techprovider.PropertyProvider; import org.apache.olingo.server.core.uri.parser.UriParserException; +import org.apache.olingo.server.core.uri.testutil.EdmTechTestProvider; import org.apache.olingo.server.core.uri.testutil.FilterValidator; import org.apache.olingo.server.core.uri.testutil.ResourceValidator; import org.apache.olingo.server.core.uri.testutil.TestUriValidator; +import org.apache.olingo.server.ref.provider.ComplexTypeProvider; +import org.apache.olingo.server.ref.provider.EntityTypeProvider; +import org.apache.olingo.server.ref.provider.PropertyProvider; import org.junit.Test; public class TestUriParserImpl { diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java index cce237edc..7dcf5a5f1 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java @@ -28,11 +28,11 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.server.api.uri.UriInfoResource; import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechTestProvider; import org.apache.olingo.server.core.uri.UriInfoImpl; import org.apache.olingo.server.core.uri.queryoption.expression.AliasImpl; import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl; import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl; +import org.apache.olingo.server.core.uri.testutil.EdmTechTestProvider; import org.junit.Test; //TOOD add getKind check to all diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java index 2902bdc0f..c4d992664 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java @@ -36,15 +36,15 @@ import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitEx import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.server.core.testutil.techprovider.ActionProvider; -import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; -import org.apache.olingo.server.core.testutil.techprovider.EnumTypeProvider; -import org.apache.olingo.server.core.testutil.techprovider.FunctionProvider; import org.apache.olingo.server.core.uri.UriInfoImpl; import org.apache.olingo.server.core.uri.UriResourceActionImpl; import org.apache.olingo.server.core.uri.UriResourceFunctionImpl; +import org.apache.olingo.server.core.uri.testutil.EdmTechTestProvider; import org.apache.olingo.server.core.uri.testutil.FilterTreeToText; +import org.apache.olingo.server.ref.provider.ActionProvider; +import org.apache.olingo.server.ref.provider.EntityTypeProvider; +import org.apache.olingo.server.ref.provider.EnumTypeProvider; +import org.apache.olingo.server.ref.provider.FunctionProvider; import org.junit.Test; public class ExpressionTest { diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java similarity index 96% rename from lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java rename to lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java index bee5f90bc..9a4b5fb33 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core.testutil; +package org.apache.olingo.server.core.uri.testutil; import java.util.Arrays; import java.util.List; @@ -29,7 +29,7 @@ import org.apache.olingo.server.api.edm.provider.EntitySet; import org.apache.olingo.server.api.edm.provider.EntityType; import org.apache.olingo.server.api.edm.provider.Property; import org.apache.olingo.server.api.edm.provider.PropertyRef; -import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider; +import org.apache.olingo.server.ref.provider.EdmTechProvider; /** * Implement the EdmTechProvider and diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java index 0374b25af..719a229ea 100644 --- a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java +++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java @@ -26,9 +26,9 @@ import java.util.ArrayList; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.server.api.uri.UriInfo; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider; import org.apache.olingo.server.core.uri.parser.Parser; import org.apache.olingo.server.core.uri.parser.UriParserException; +import org.apache.olingo.server.ref.provider.EdmTechProvider; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; diff --git a/pom.xml b/pom.xml index 761127a74..5493dda6a 100644 --- a/pom.xml +++ b/pom.xml @@ -139,7 +139,7 @@ httpclient ${hc.client.version} - + com.fasterxml.jackson.core jackson-core From 7ba791e54227be759853434b782ffd8da058d10f Mon Sep 17 00:00:00 2001 From: Stephan Klevenz Date: Fri, 9 May 2014 16:28:16 +0200 Subject: [PATCH 5/7] [OLINGO-266] first draft of ref handler --- .../olingo/server/api/ODataHandler.java | 28 ++++++ .../apache/olingo/server/api/ODataServer.java | 7 +- .../olingo/server/core/ODataHandlerImpl.java | 81 +++++++++++++++++ .../olingo/server/core/ODataServerImpl.java | 19 ++-- .../server/core/servlet/ODataServlet.java | 86 ------------------- .../olingo/server/ref/ReferenceServlet.java | 7 +- 6 files changed, 123 insertions(+), 105 deletions(-) create mode 100644 lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHandler.java create mode 100644 lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerImpl.java delete mode 100644 lib/server-core/src/main/java/org/apache/olingo/server/core/servlet/ODataServlet.java diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHandler.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHandler.java new file mode 100644 index 000000000..ff0ab064e --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHandler.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.api; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public interface ODataHandler { + + void process(HttpServletRequest request, HttpServletResponse response); + +} diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java index 739018912..6ab027013 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java @@ -18,10 +18,8 @@ */ package org.apache.olingo.server.api; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.server.api.edm.provider.EdmProvider; import org.apache.olingo.server.api.serializer.ODataFormat; import org.apache.olingo.server.api.serializer.ODataSerializer; @@ -38,6 +36,7 @@ public abstract class ODataServer { * and avoid class loading issues also during hot deployment. */ final Object object = clazz.newInstance(); + return (ODataServer) object; } catch (final Exception e) { @@ -48,6 +47,6 @@ public abstract class ODataServer { public abstract ODataSerializer getSerializer(ODataFormat format); - public abstract void handle(HttpServletRequest req, HttpServletResponse resp); + public abstract ODataHandler getHandler(EdmProvider edmProvider); } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerImpl.java new file mode 100644 index 000000000..b4e7bab43 --- /dev/null +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerImpl.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.core; + +import java.io.IOException; +import java.io.InputStream; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.server.api.ODataHandler; +import org.apache.olingo.server.api.ODataServer; +import org.apache.olingo.server.api.edm.provider.EdmProvider; +import org.apache.olingo.server.api.serializer.ODataFormat; +import org.apache.olingo.server.api.serializer.ODataSerializer; +import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; + +public class ODataHandlerImpl implements ODataHandler { + + private EdmProvider edmProvider; + private ODataServer server; + + public ODataHandlerImpl(ODataServer server, EdmProvider edmProvider) { + this.edmProvider = edmProvider; + this.server = server; + } + + @Override + public void process(HttpServletRequest request, HttpServletResponse response) { + try { + EdmProviderImpl edm = new EdmProviderImpl(edmProvider); + + InputStream responseEntity = null; + if (request.getPathInfo().contains("$metadata")) { + ODataSerializer serializer = server.getSerializer(ODataFormat.XML); + responseEntity = serializer.metadataDocument(edm); + } else { + ODataSerializer serializer = server.getSerializer(ODataFormat.JSON); + responseEntity = serializer.serviceDocument(edm, "http//:root"); + } + + response.setStatus(200); + response.setContentType("application/json"); + + if (responseEntity != null) { + ServletOutputStream out = response.getOutputStream(); + int curByte = -1; + if (responseEntity instanceof InputStream) { + while ((curByte = ((InputStream) responseEntity).read()) != -1) { + out.write((char) curByte); + } + ((InputStream) responseEntity).close(); + } + + out.flush(); + out.close(); + } + + } catch (Exception e) { + throw new ODataRuntimeException(e); + } + } +} diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java index 933422d81..4827fa57f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java @@ -18,13 +18,10 @@ */ package org.apache.olingo.server.core; -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.server.api.ODataHandler; import org.apache.olingo.server.api.ODataServer; +import org.apache.olingo.server.api.edm.provider.EdmProvider; import org.apache.olingo.server.api.serializer.ODataFormat; import org.apache.olingo.server.api.serializer.ODataSerializer; import org.apache.olingo.server.core.serializer.ODataJsonSerializer; @@ -50,14 +47,10 @@ public class ODataServerImpl extends ODataServer { } @Override - public void handle(HttpServletRequest req, HttpServletResponse resp) { - - try { - resp.getWriter().print("Hello World!"); - } catch (IOException e) { - throw new ODataRuntimeException(e); - } - + public ODataHandler getHandler(EdmProvider edmProvider) { + return new ODataHandlerImpl(this, edmProvider); } + + } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/servlet/ODataServlet.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/servlet/ODataServlet.java deleted file mode 100644 index b6d31c999..000000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/servlet/ODataServlet.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.server.core.servlet; - -import java.io.IOException; -import java.io.InputStream; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.olingo.server.api.edm.provider.EdmProvider; -import org.apache.olingo.server.api.serializer.ODataFormat; -import org.apache.olingo.server.api.serializer.ODataSerializer; -import org.apache.olingo.server.core.ODataServerImpl; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; - -public class ODataServlet extends HttpServlet { - - private static final long serialVersionUID = 1L; - - private HttpServletResponse resp; - - @Override - protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws IOException { - this.resp = resp; - - EdmProvider provider = createEdmProvider(); - EdmProviderImpl edm = new EdmProviderImpl(provider); - - ODataServerImpl impl = new ODataServerImpl(); - InputStream responseEntity = null; - if (req.getPathInfo().contains("$metadata")) { - ODataSerializer serializer = impl.getSerializer(ODataFormat.XML); - responseEntity = serializer.metadataDocument(edm); - } else { - ODataSerializer serializer = impl.getSerializer(ODataFormat.JSON); - responseEntity = serializer.serviceDocument(edm, "http//:root"); - } - sendResponse(responseEntity); - } - - protected EdmProvider createEdmProvider() { - return null; - } - - // TODO: check throws - private void sendResponse(final Object entity) throws IOException { - resp.setStatus(200); - resp.setContentType("application/json"); - if (entity != null) { - ServletOutputStream out = resp.getOutputStream(); - int curByte = -1; - if (entity instanceof InputStream) { - while ((curByte = ((InputStream) entity).read()) != -1) { - out.write((char) curByte); - } - ((InputStream) entity).close(); - } else if (entity instanceof String) { - String body = (String) entity; - out.write(body.getBytes("utf-8")); - } - - out.flush(); - out.close(); - } - } - -} diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java index 0be695fc9..47daecbec 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java @@ -25,7 +25,9 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.olingo.server.api.ODataHandler; import org.apache.olingo.server.api.ODataServer; +import org.apache.olingo.server.ref.provider.EdmTechProvider; public class ReferenceServlet extends HttpServlet { @@ -34,8 +36,9 @@ public class ReferenceServlet extends HttpServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - ODataServer server = ODataServer.newInstance(); - server.handle(req, resp); + ODataHandler handler = ODataServer.newInstance().getHandler(new EdmTechProvider()); + + handler.process(req, resp); } From 04a9ad46c5f213150b9074c02ca4cfab46cac1b7 Mon Sep 17 00:00:00 2001 From: Stephan Klevenz Date: Fri, 9 May 2014 16:56:44 +0200 Subject: [PATCH 6/7] [OLINGO-266] log&trace --- lib/server-core/pom.xml | 9 +++++++-- .../test/resources/simplelogger.properties | 20 +++++++++++++++++++ lib/server-ref/pom.xml | 13 +++++++++++- .../olingo/server/ref/ReferenceServlet.java | 6 ++++++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 lib/server-core/src/test/resources/simplelogger.properties diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml index bc7ae718f..d04c5fc28 100644 --- a/lib/server-core/pom.xml +++ b/lib/server-core/pom.xml @@ -66,10 +66,15 @@ com.fasterxml.jackson.core jackson-core + + commons-logging + commons-logging + test + org.slf4j - slf4j-log4j12 - 1.7.6 + slf4j-simple + test diff --git a/lib/server-core/src/test/resources/simplelogger.properties b/lib/server-core/src/test/resources/simplelogger.properties new file mode 100644 index 000000000..2a3350c78 --- /dev/null +++ b/lib/server-core/src/test/resources/simplelogger.properties @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +org.slf4j.simpleLogger.defaultLogLevel=debug +org.slf4j.simpleLogger.logFile=System.out \ No newline at end of file diff --git a/lib/server-ref/pom.xml b/lib/server-ref/pom.xml index 8e69f8121..ce5e30d08 100644 --- a/lib/server-ref/pom.xml +++ b/lib/server-ref/pom.xml @@ -53,7 +53,18 @@ ${project.version} runtime - + + + commons-logging + commons-logging + runtime + + + org.slf4j + slf4j-simple + runtime + + junit junit diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java index 47daecbec..93b766ec7 100644 --- a/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java +++ b/lib/server-ref/src/main/java/org/apache/olingo/server/ref/ReferenceServlet.java @@ -28,13 +28,19 @@ import javax.servlet.http.HttpServletResponse; import org.apache.olingo.server.api.ODataHandler; import org.apache.olingo.server.api.ODataServer; import org.apache.olingo.server.ref.provider.EdmTechProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ReferenceServlet extends HttpServlet { private static final long serialVersionUID = 1L; + private static final Logger LOG = LoggerFactory.getLogger(ReferenceServlet.class); + @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + LOG.debug("ReferenceServlet:service() called"); + ODataHandler handler = ODataServer.newInstance().getHandler(new EdmTechProvider()); From 0d62d15d2fa49488355eac4fa3722a25f111be27 Mon Sep 17 00:00:00 2001 From: Stephan Klevenz Date: Mon, 12 May 2014 13:01:08 +0200 Subject: [PATCH 7/7] [OLINGO-266] initial cargo ref integration test --- fit/pom.xml | 49 ++++++++++++------- .../org/apache/olingo/fit/ref/PingITCase.java | 44 +++++++++++++++++ 2 files changed, 76 insertions(+), 17 deletions(-) create mode 100644 fit/src/test/java/org/apache/olingo/fit/ref/PingITCase.java diff --git a/fit/pom.xml b/fit/pom.xml index 905f1cf3f..9947dd17a 100644 --- a/fit/pom.xml +++ b/fit/pom.xml @@ -1,26 +1,26 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 olingo-fit @@ -45,7 +45,7 @@ olingo-commons-core ${project.version} - + org.apache.olingo client-proxy @@ -104,6 +104,13 @@ ${project.version} test + + org.apache.olingo + olingo-server-ref + ${project.version} + war + test + junit junit @@ -139,7 +146,7 @@ - + org.apache.maven.plugins maven-war-plugin @@ -203,6 +210,14 @@ + + org.apache.olingo + olingo-server-ref + war + + ref + + stub diff --git a/fit/src/test/java/org/apache/olingo/fit/ref/PingITCase.java b/fit/src/test/java/org/apache/olingo/fit/ref/PingITCase.java new file mode 100644 index 000000000..bdc033c35 --- /dev/null +++ b/fit/src/test/java/org/apache/olingo/fit/ref/PingITCase.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.fit.ref; + +import static org.junit.Assert.assertEquals; + +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.Test; + +public class PingITCase { + + private static final String REF_SERVICE = "http://localhost:9080/ref/odata.svc/"; + + @Test + public void ping() throws Exception { + URL url = new URL(REF_SERVICE); + + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("GET"); + connection.connect(); + + int code = connection.getResponseCode(); + assertEquals(200, code); + } + +}